forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(quorum): add prometheus exporter
Primary Change -------------- 1. The quorum 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. IPluginLedgerConnectorQuorumOptions interface in PluginLedgerConnectorQuorum class now has a prometheusExporter optional field 5. The PluginLedgerConnectorQuorum class has relevant functions and codes to incorporate prometheus exporter 6. Added Readme.md on the prometheus exporter usage Fixes hyperledger-cacti#534 Signed-off-by: Jagpreet Singh Sasan <[email protected]>
- Loading branch information
1 parent
ea117ef
commit f7db336
Showing
12 changed files
with
403 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/cactus-plugin-ledger-connector-quorum/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...us-plugin-ledger-connector-quorum/src/main/typescript/prometheus-exporter/data.fetcher.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Transactions } from "./response.type"; | ||
|
||
import { totalTxCount, K_CACTUS_QUORUM_TOTAL_TX_COUNT } from "./metrics"; | ||
|
||
export async function collectMetrics(transactions: Transactions) { | ||
transactions.counter++; | ||
totalTxCount.labels(K_CACTUS_QUORUM_TOTAL_TX_COUNT).set(transactions.counter); | ||
} |
9 changes: 9 additions & 0 deletions
9
.../cactus-plugin-ledger-connector-quorum/src/main/typescript/prometheus-exporter/metrics.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Gauge } from "prom-client"; | ||
|
||
export const K_CACTUS_QUORUM_TOTAL_TX_COUNT = "cactus_quorum_total_tx_count"; | ||
|
||
export const totalTxCount = new Gauge({ | ||
name: K_CACTUS_QUORUM_TOTAL_TX_COUNT, | ||
help: "Total transactions executed", | ||
labelNames: ["type"], | ||
}); |
Oops, something went wrong.