Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

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

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

Test

npm test

Licence

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