Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr> |
||
|---|---|---|
| .. | ||
| images | ||
| README.md | ||
| index.js | ||
| package.json | ||
| prometheus.yml | ||
README.md
Overview
OpenTelemetry metrics allow a user to collect data and export it to a metrics backend like Prometheus.
This is a simple example that demonstrates basic metrics collection and exports those metrics to a Prometheus compatible endpoint.
Installation
# from this directory
npm install
Setup Prometheus
Run the Application
- Run the server
# from this directory
npm run start
- Replace the
prometheus.ymlprovided by the Prometheus installation with the following:
global:
scrape_interval: 15s # Default is every 1 minute.
scrape_configs:
- job_name: 'opentelemetry'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9464']
- Start Prometheus
# from the directory you downloaded prometheus
prometheus --config.file=prometheus.yml
Prometheus UI
If you are using the default configurations, the prometheus client will be available at http://localhost:9090


Useful links
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more information on OpenTelemetry metrics, visit: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-metrics-base
- For more information on OpenTelemetry for Node.js, visit: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node
LICENSE
Apache License 2.0