You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Primary Change
--------------
1. The besu ledger connector plugin now includes the prometheus metrics exporter integration
2. OpenAPI spec now has api endpoint for the getting the prometheus metrics
Refactorings that were also necessary to accomodate 1) and 2)
------------------------------------------------------------
3. GetPrometheusMetricsV1 class is created to handle the corresponding api endpoint
4. IPluginLedgerConnectorBesuOptions interface in PluginLedgerConnectorBesu class now has a prometheusExporter optional field
5. The PluginLedgerConnectorBesu class has relevant functions and codes to incorporate prometheus exporter
6. Added Readme.md on the prometheus exporter usage
Fixes#533
Signed-off-by: Jagpreet Singh Sasan <[email protected]>
> Extensive documentation and examples in the [readthedocs](https://readthedocs.org/projects/hyperledger-cactus/) (WIP)
82
81
82
+
## Prometheus Exporter
83
+
84
+
This class creates a prometheus exporter, which scrapes the transactions (total transaction count) for the use cases incorporating the use of Besu connector plugin.
85
+
86
+
### Usage
87
+
The prometheus exporter object is initialized in the `PluginLedgerConnectorBesu` class constructor itself, so instantiating the object of the `PluginLedgerConnectorBesu` class, gives access to the exporter object.
88
+
You can also initialize the prometheus exporter object seperately and then pass it to the `IPluginLedgerConnectorBesuOptions` interface for `PluginLedgerConnectoBesu` constructor.
89
+
90
+
`getPrometheusExporterMetricsV1` function returns the prometheus exporter metrics, currently displaying the total transaction count, which currently increments everytime the `transact()` method of the `PluginLedgerConnectorBesu` class is called.
91
+
92
+
### Prometheus Integration
93
+
To use Prometheus with this exporter make sure to install [Prometheus main component](https://prometheus.io/download/).
94
+
Once Prometheus is setup, the corresponding scrape_config needs to be added to the prometheus.yml
Here the `host:port` is where the prometheus exporter metrics are exposed. The test cases (For example, packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/deploy-contract/deploy-contract-from-json.test.ts) exposes it over `0.0.0.0` and a random port(). The random port can be found in the running logs of the test case and looks like (42379 in the below mentioned URL)
Once edited, you can start the prometheus service by referencing the above edited prometheus.yml file.
108
+
On the prometheus graphical interface (defaulted to http://localhost:9090), choose **Graph** from the menu bar, then select the **Console** tab. From the **Insert metric at cursor** drop down, select **cactus_besu_total_tx_count** and click **execute**
109
+
110
+
### Helper code
111
+
112
+
###### response.type.ts
113
+
This file contains the various responses of the metrics.
114
+
115
+
###### data-fetcher.ts
116
+
This file contains functions encasing the logic to process the data points
117
+
118
+
###### metrics.ts
119
+
This file lists all the prometheus metrics and what they are used for.
120
+
83
121
## Running the tests
84
122
85
123
To check that all has been installed correctly and that the pugin has no errors run the tests:
@@ -99,4 +137,4 @@ Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
99
137
100
138
This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file.
Copy file name to clipboardExpand all lines: packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts
0 commit comments