opentelemetry-js/examples/prometheus
naseemkullah 144e11ab70
docs(prom-example): remove deprecated startServer option (#2802)
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
2022-02-22 14:51:54 -05:00
..
images chore: update metrics example with UpDownCounter (#1239) 2020-06-27 19:10:34 -07:00
README.md chore: add markdown link checks (#2657) 2021-12-11 21:31:36 +01:00
index.js docs(prom-example): remove deprecated startServer option (#2802) 2022-02-22 14:51:54 -05:00
package.json chore: release proposal 0.25.0 (#2415) 2021-08-18 16:13:38 -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