@bonniernews/exp-metrics

2.0.0 • Public • Published

exp-metrics

Run tests

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.

Types of metrics and API

  • Counter
    • inc([labels,] [value])
  • Gauge
    • set([labels,] value)
    • inc([labels,] [value])
    • dec([labels,] [value])
  • Summary (histogram in OpenTelemetry terms)
    • observe([labels,] value)

Installing

npm install @bonniernews/exp-metrics

Usage

const expMetrics = require("@bonniernews/exp-metrics");

metrics = expMetrics({
  "service.name": "my-service-name",
  "service.namespace": "my-namespace",
  "service.instance.id": "my-instance-id",
});

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @bonniernews/exp-metrics

Weekly Downloads

327

Version

2.0.0

License

MIT

Unpacked Size

6.91 kB

Total Files

4

Last publish

Collaborators

  • daghall
  • andreas.samuelsson
  • norla
  • mattiasobn
  • chrissode
  • jzachrisson
  • hilleso
  • adam.hakansson
  • amundsentb
  • jonaek
  • drgeobn
  • mikael.mattsson
  • morre
  • takolander
  • vitryssen
  • herbola
  • nifo
  • johark
  • aliceboberg
  • varneynz
  • gusliden
  • mxtr
  • karlbergc
  • martindanielson
  • joelekman
  • chavah
  • matsrorbecker
  • axeljohanssonbonniernews
  • markusn
  • linuss
  • joelabrahamsson
  • jonaswalden
  • indeedshouts
  • marcusgronblad