-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iroha-connector): add prometheus exporter to the plugin
Primary Changes ---------------- 1. Added Prometheus Exporter to Iroha ledger plugin 2. Added Prometheus Metrics tracker to relevant iroha tests. Fixes #1260 Signed-off-by: ashnashahgrover <ashnashahgrover777@gmail.com>
- Loading branch information
1 parent
bf35762
commit fe6f61f
Showing
13 changed files
with
367 additions
and
1 deletion.
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
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
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
10 changes: 10 additions & 0 deletions
10
...us-plugin-ledger-connector-iroha2/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,10 @@ | ||
import { Transactions } from "./response.type"; | ||
|
||
import { totalTxCount, K_CACTUS_IROHA2_TOTAL_TX_COUNT } from "./metrics"; | ||
|
||
export async function collectMetrics( | ||
transactions: Transactions, | ||
): Promise<void> { | ||
transactions.counter++; | ||
totalTxCount.labels(K_CACTUS_IROHA2_TOTAL_TX_COUNT).set(transactions.counter); | ||
} |
10 changes: 10 additions & 0 deletions
10
.../cactus-plugin-ledger-connector-iroha2/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,10 @@ | ||
import { Gauge } from "prom-client"; | ||
|
||
export const K_CACTUS_IROHA2_TOTAL_TX_COUNT = "cactus_iroha2_total_tx_count"; | ||
|
||
export const totalTxCount = new Gauge({ | ||
registers: [], | ||
name: "cactus_iroha2_total_tx_count", | ||
help: "Total transactions executed", | ||
labelNames: ["type"], | ||
}); |
Oops, something went wrong.