@routup/prometheus
This is a routup plugin to collect and serve metrics for prometheus.
It provides two built-in metrics:
uptime: This metric provides information about the total uptime of the http server.requestDuration: This metric provides information about the duration of incoming requests.
The plugin is based on the prom-client library.
Table of Contents
Installation
npm install @routup/prometheus --save
Documentation
To read the docs, visit https://routup.net
Usage
The metrics collected in the following example, can be inspected on: http://localhost:3000/metrics
The plugin should be installed before registering any other plugins or routes!
import {
App,
serve,
} from 'routup';
import { prometheus } from '@routup/prometheus';
const router = new App();
router.use(prometheus({
// serve metrics on path /metrics
metricsPath: '/metrics'
}));
serve(router, { port: 3000 });
License
Made with
Published under MIT License.