npm.io
4.0.0 • Published 4 months ago

@routup/prometheus

Licence
MIT
Version
4.0.0
Deps
0
Size
22 kB
Vulns
0
Weekly
0
Stars
1

@routup/prometheus

npm version main codecov Known Vulnerabilities Conventional Commits

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.

Keywords