OpenTelemetry Prometheus Metric Exporter
The OpenTelemetry Prometheus Metrics Exporter allows the user to send collected OpenTelemetry Metrics to Prometheus.
Prometheus is a monitoring system that collects metrics, by scraping exposed endpoints at regular intervals, evaluating rule expressions. It can also trigger alerts if certain conditions are met. For assistance setting up Prometheus, Click here for a guided codelab.
npm install --save @opentelemetry/metricsnpm install --save @opentelemetry/exporter-prometheus
Create & register the exporter on your application.
const PrometheusExporter = ;const MeterProvider = ;// Add your port and startServer to the Prometheus optionsconst options = port: 9464 startServer: true;const exporter = options;// Register the exporterconst meter =exporterinterval: 1000;// Now, start recording dataconst counter = meter;counter;// Record data using Instrument: It is recommended to keep a reference to the Bound Instrument instead of// always calling `bind()` method for every operations.const boundCounter = counter;boundCounter;// .. some other work
Viewing your metrics
With the above you should now be able to navigate to the Prometheus UI at: http://localhost:9464/metrics
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- To learn more about Prometheus, visit: https://prometheus.io/
- For help or feedback on this project, join us on gitter
Apache 2.0 - See LICENSE for more information.