fastify-metrics-js-prometheus

4.0.0 • Public • Published

Fastify Metrics-js Prometheus

A Fastify plugin for consuming @metrics/client (https://www.npmjs.com/package/@metrics/client) streams and rendering a prometheus scraping page

Usage

import fastify from 'fastify';
import plugin from 'fastify-metrics-js-prometheus';
import client from 'prom-client';
import Metrics from '@metrics/client';
const app = fastify();
const metrics = new Metrics();

app.register(plugin, { client, metrics });

By default, a metrics scraping page for prometheus will be served at /metrics. This can be configured by setting the plugin option pathname.

Plugin options

app.register(pluginMetrics, {
    client,
    pathname,
    logger,
    guard,
    consumer,
    metrics,
});
name description type default required
client metrics client library. prom-client is currently supported. object yes
pathname url pathname to serve metrics scraping page on. string /metrics
logger log4j compatible logger (usually pino) to use for logging. object
guard options to be passed to the @metrics/guard module (used internally.) object {}
consumer options to be passed to the @metrics/prometheus-consumer module used internally. object {}
metrics Stream or streams of metrics generated by @metrics/client to be consumed object[] or object] []

Readme

Keywords

none

Package Sidebar

Install

npm i fastify-metrics-js-prometheus

Weekly Downloads

109

Version

4.0.0

License

ISC

Unpacked Size

9.53 kB

Total Files

8

Last publish

Collaborators

  • trygve-lie
  • digitalsadhu