-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api-server): add prometheus exporter
Primary Change -------------- 1. The api-server 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. IApiServerConstructorOptions interface in ApiServer class now has a prometheusExporter optional field 5. The ApiServer class has relevant functions and codes to incorporate prometheus exporter 6. runtime-plugin-imports.test.ts is changed to incorporate the prometheus exporter 7. Added Readme.md on the prometheus exporter usage 8. Fixed Readme.md under keychain-memory and consortium-manual plugins Resolve #539 Signed-off-by: Jagpreet Singh Sasan <jagpreet.singh.sasan@accenture.com>
- Loading branch information
1 parent
a15105b
commit c348aa4
Showing
13 changed files
with
383 additions
and
4 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
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
12 changes: 12 additions & 0 deletions
12
packages/cactus-cmd-api-server/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,12 @@ | ||
import { TotalPluginImports } from "./response.type"; | ||
|
||
import { | ||
totalTxCount, | ||
K_CACTUS_API_SERVER_TOTAL_PLUGIN_IMPORTS, | ||
} from "./metrics"; | ||
|
||
export async function collectMetrics(totalPluginImports: TotalPluginImports) { | ||
totalTxCount | ||
.labels(K_CACTUS_API_SERVER_TOTAL_PLUGIN_IMPORTS) | ||
.set(totalPluginImports.counter); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/cactus-cmd-api-server/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_API_SERVER_TOTAL_PLUGIN_IMPORTS = | ||
"cactus_api_server_total_plugin_imports"; | ||
|
||
export const totalTxCount = new Gauge({ | ||
name: K_CACTUS_API_SERVER_TOTAL_PLUGIN_IMPORTS, | ||
help: "Total number of plugins imported", | ||
labelNames: ["type"], | ||
}); |
Oops, something went wrong.