Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sigfox/koa-prometheus

sigfox6MIT1.1.0

Koa middleware exposing Prometheus metrics.

k8s, koa, kubernetes, metrics, middleware, prometheus

readme

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.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.1.0 (2019-06-17)

Features

  • koa-prometheus: allow passing of options on instantiation (a00726f)

1.0.0 (2019-05-17)

Features

  • koa-prometheus: add middleware that exposes metrics for Prometheus (#3) (a7ae4b2)