opentelemetry-js/examples/prometheus
Daniel Dyla 65b5ba2d04
chore: 0.8.3 release proposal (#1122)
2020-05-28 16:13:08 -04:00
..
images chore: add prometheus example (#560) 2019-11-25 14:13:03 -08:00
README.md chore: add prometheus example (#560) 2019-11-25 14:13:03 -08:00
index.js Remove label set from metrics API (#915) 2020-04-01 12:36:20 -07:00
package.json chore: 0.8.3 release proposal (#1122) 2020-05-28 16:13:08 -04:00
prometheus.yml chore: add prometheus example (#560) 2019-11-25 14:13:03 -08:00

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.yml provided 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

LICENSE

Apache License 2.0