# 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 ```sh # from this directory npm install ``` ## Run the Application ```sh # from this directory npm run start ``` If you are using the default configurations, the metrics should be available at ## Run Prometheus ### With docker ```sh # from this directory docker compose up ``` ### With binary Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/) - Replace the `prometheus.yml` provided by the Prometheus installation with the following: ```yaml 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 ```sh # 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

Prometheus UI showing a charted Counter

Prometheus UI showing a charted UpDownCounter

Prometheus UI showing a charted Gauge

## Useful links - For more information on OpenTelemetry, visit: - For more information on OpenTelemetry metrics, visit: - For more information on OpenTelemetry for Node.js, visit: ## LICENSE Apache License 2.0