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 fabric 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. The generate-sdk command now has DateTime mapping to Date (to read Date as Date object instead of string)
4. GetPrometheusMetricsV1 class is created to handle the corresponding api endpoint
5. IPluginLedgerConnectorFabricOptions interface in PluginLedgerConnectorFabric class now has a prometheusExporter optional field
6. The PluginLedgerConnectorFabric class has relevant functions and codes to incorporate prometheus exporter
7. run-transaction-endpoint-v1.test is changed to incorporate the prometheus exporter for both fabric 1.4.x and 2.x versions
8. Added Readme.md on the prometheus exporter usage
Fixeshyperledger-cacti#531
Signed-off-by: jagpreetsinghsasan <[email protected]>
Copy file name to clipboardExpand all lines: packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts
Copy file name to clipboardExpand all lines: packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/configuration.ts
This class creates a prometheus exporter, which scraps the transactions (total transaction count) for the use cases incorporating the use of Fabric connector plugin.
6
6
7
+
8
+
### Usage
9
+
The prometheus exporter object is initialized in the `PluginLedgerConnectorFabric` class constructor itself, so instantiating the object of the `PluginLedgerConnectorFabric` class, gives access to the exporter object.
10
+
You can also initialize the prometheus exporter object seperately and then pass it to the `IPluginLedgerConnectorFabricOptions` interface for `PluginLedgerConnectoFabric` constructor.
11
+
12
+
`getPrometheusExporterMetricsEndpointV1` function returns the prometheus exporter metrics, currently displaying the total transaction count, which currently increments everytime the `transact()` method of the `PluginLedgerConnectorFabric` class is called.
13
+
14
+
### Prometheus Integration
15
+
To use Prometheus with this exporter make sure to install [Prometheus main component](https://prometheus.io/download/).
16
+
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-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.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.
30
+
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 **totalTxCount** and click **execute**
31
+
32
+
### Helper code
33
+
34
+
###### response.type.ts
35
+
This file contains the various responses of the metrics.
36
+
37
+
###### data-fetcher.ts
38
+
This file contains functions encasing the logic to process the data points
39
+
40
+
###### metrics.ts
41
+
This file lists all the prometheus metrics and what they are used for.
0 commit comments