@numbereight/metric
TypeScript icon, indicating that this package has built-in type declarations

3.0.5 • Public • Published

Metric

Enables prometheus Metrics Sets using 'prom-client'.

Setup

Takes ENVIRONMENT_VARIABLES:

variable purpose required
SERVICE_NAME identify service yes

Usage

import { MetricSet } from '@numbereight/metric'; const MetricSet = require('@numbereight/metric').MetricSet;

MetricSet is a wrapper for a prom-client object. Refer to the prom-client documentation for usage.

Adding Metrics

import { MetricSet, prometheus } from '@numbereight/metric';
const metrics = new MetricSet();

const counter = new prometheus.Counter({
    name: 'example_counter',
    help: 'help',
    registers: [],
});

metrics.registerMetrics([counter]);

app.use(makeDefaultMetricMiddleware({ registry: metrics.registry }));

Readme

Keywords

none

Package Sidebar

Install

npm i @numbereight/metric

Weekly Downloads

64

Version

3.0.5

License

none

Unpacked Size

43 kB

Total Files

24

Last publish

Collaborators

  • nechris