Koa middleware exposing Prometheus metrics.
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.
npm install @sigfox/koa-prometheus
const prometheus = require('@sigfox/koa-prometheus');
const Koa = require('koa');
const app = new Koa().use(prometheus());
const server = app.listen();
Default response format is Prometheus-formatted text.
To receive it as a JSON-formatted response, set request's Accept header to application/json.
Type | Default | Description | |
---|---|---|---|
interval | number | 10000 | The interval at which metrics are collected |
prefix | string | none | Prefix to add to each metric attribute name |
url | string | /metrics | API endpoint URL configuration |
npm test
This project is licensed under the MIT License - see the LICENSE file for details.