Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bonniernews/exp-metrics

Package Overview
Dependencies
Maintainers
35
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bonniernews/exp-metrics

Simple bootstrapping of basic prometheus metrics for your express based application.

  • 3.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
35
Created
Source

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("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

FAQs

Package last updated on 21 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc