-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move from prom-client to OpenTelemetry metrics
Signed-off-by: Jessica He <[email protected]>
- Loading branch information
1 parent
4e70265
commit dfeb858
Showing
9 changed files
with
1,389 additions
and
85 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This is an example configuration file for Prometheus, that is set to scrape | ||
# the metrics endpoint exposed by the example backend. | ||
# | ||
# If you want to run a docker based Prometheus instance locally to try it out, | ||
# run the following command in the Backstage root: | ||
# | ||
# docker run --mount type=bind,source=./packages/backend/prometheus.yml,destination=/etc/prometheus/prometheus.yml --publish published=9090,target=9090,protocol=tcp prom/prometheus | ||
# | ||
# After this, you have a Prometheus instance on http://localhost:9090 | ||
|
||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: 'prometheus' | ||
static_configs: | ||
# This target address specifically works on Docker for MacOS - you may | ||
# need to change it to another host depending on your OS and Docker | ||
# engine. | ||
- targets: ['host.docker.internal:9464'] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const { NodeSDK } = require('@opentelemetry/sdk-node'); | ||
const { | ||
getNodeAutoInstrumentations, | ||
} = require('@opentelemetry/auto-instrumentations-node'); | ||
const { | ||
RuntimeNodeInstrumentation, | ||
} = require('@opentelemetry/instrumentation-runtime-node'); | ||
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); | ||
const { HostMetrics } = require('@opentelemetry/host-metrics'); | ||
const { MeterProvider } = require('@opentelemetry/sdk-metrics'); | ||
|
||
// Application metrics will be exported to localhost:9464/metrics | ||
const prometheusApplication = new PrometheusExporter(); | ||
const sdk = new NodeSDK({ | ||
metricReader: prometheusApplication, | ||
instrumentations: [ | ||
getNodeAutoInstrumentations(), | ||
new RuntimeNodeInstrumentation(), | ||
], | ||
}); | ||
|
||
sdk.start(); | ||
|
||
// Host/process metrics will be exported to localhost:9463/metrics | ||
const prometheusHost = new PrometheusExporter({ port: 9463 }); | ||
const meterProvider = new MeterProvider({ | ||
readers: [prometheusHost], | ||
}); | ||
const hostMetrics = new HostMetrics({ meterProvider }); | ||
hostMetrics.start(); |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './authProvidersModule'; | ||
export * from './rbacDynamicPluginsModule'; | ||
export * from './healthcheck'; | ||
export * from './metrics'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.