Simple wrapper of OpenTelemetry metrics with the same API as prom-client,
to make the transition from prom-client
easy, and also add functionality that
OpenTelemetry lacks.
- Counter
inc([labels,] [value])
- Gauge
set([labels,] value)
inc([labels,] [value])
dec([labels,] [value])
- Summary (histogram in OpenTelemetry terms)
observe([labels,] value)
npm install @bonniernews/exp-metrics
const expMetrics = require("@bonniernews/exp-metrics");
metrics = expMetrics("my-service-name", {
// optional overrides, see more below
});
const myCounter = metrics.counter({
name: "my_counter",
help: "My counter",
})
myCounter.inc(2);
myCounter.inc({ foo: "bar" }, 3);
See more in the prom-client documentation.
For overriding the default OpenTelemetry configuration, see the OpenTelemetry documentation