1.1.0 • Published 6 years ago

@sigfox/koa-prometheus v1.1.0

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

koa-prometheus

Koa middleware exposing Prometheus metrics.

Features

Mount route providing metrics formatted for Prometheus, as text or JSON. Metrics collection interval is customizable, as well as the endpoint URL and metric attribute name prefix.

Install

npm install @sigfox/koa-prometheus

Usage

const prometheus = require('@sigfox/koa-prometheus');
const Koa = require('koa');

const app = new Koa().use(prometheus());
const server = app.listen();

Response format

Default response format is Prometheus-formatted text.

To receive it as a JSON-formatted response, set request's Accept header to application/json.

Configuration

TypeDefaultDescription
intervalnumber10000The interval at which metrics are collected
prefixstringnonePrefix to add to each metric attribute name
urlstring/metricsAPI endpoint URL configuration

Test

npm test

Licence

This project is licensed under the MIT License - see the LICENSE file for details.