JSPM

@opentelemetry/exporter-prometheus

0.200.0-dev.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5932748
  • Score
    100M100P100Q322965F
  • License Apache-2.0

OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@opentelemetry/exporter-prometheus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    OpenTelemetry Prometheus Metric Exporter

    NPM Published Version Apache License

    Note: This is an experimental package under active development. New releases may include breaking changes.

    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.

    Installation

    npm install --save @opentelemetry/sdk-metrics
    npm install --save @opentelemetry/exporter-prometheus

    Usage

    Create & register the exporter on your application.

    const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
    const { MeterProvider }  = require('@opentelemetry/sdk-metrics');
    
    // Add your port and startServer to the Prometheus options
    const options = {port: 9464};
    const exporter = new PrometheusExporter(options);
    
    // Creates MeterProvider and installs the exporter as a MetricReader
    const meterProvider = new MeterProvider({
      readers: [exporter],
    });
    const meter = meterProvider.getMeter('example-prometheus');
    
    // Now, start recording data
    const counter = meter.createCounter('metric_name', {
      description: 'Example of a counter'
    });
    counter.add(10, { pid: process.pid });
    
    // .. 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

    License

    Apache 2.0 - See LICENSE for more information.