JSPM

@opentelemetry/metrics

0.5.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12201
  • Score
    100M100P100Q97465F
  • License Apache-2.0

OpenTelemetry metrics SDK

Package Exports

  • @opentelemetry/metrics
  • @opentelemetry/metrics/build/src/export/Batcher

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/metrics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenTelemetry Metrics SDK

Gitter chat NPM Published Version dependencies devDependencies Apache License

OpenTelemetry metrics allow a user to collect data and export it to a metrics backend like Prometheus.

Installation

npm install --save @opentelemetry/metrics

Usage

Counter

Choose this kind of metric when the value is a quantity, the sum is of primary interest, and the event count and value distribution are not of primary interest. Counters are defined as Monotonic = true by default, meaning that positive values are expected.

const { MeterProvider } = require('@opentelemetry/metrics');

// Initialize the Meter to capture measurements in various ways.
const meter = new MeterProvider().getMeter('your-meter-name');

const counter = meter.createCounter('metric_name', {
  labelKeys: ["pid"],
  description: "Example of a counter"
});

const labels = meter.labels({ pid: process.pid });

// Create a BoundInstrument associated with specified label values.
const boundCounter = counter.bind(labels);
boundCounter.add(10);

See examples/prometheus for a short example.

Measure

Work in progress

License

Apache 2.0 - See LICENSE for more information.