@routup/prometheus
TypeScript icon, indicating that this package has built-in type declarations

2.4.0 • Public • Published

@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 { createServer } from 'node:http';
import { createNodeDispatcher, Router } from 'routup';
import { prometheus } from '@routup/prometheus';

const router = new Router();

router.use(prometheus({
    // serve metrics on path /metrics
    metricsPath: '/metrics'
}));

const server = createServer(createNodeDispatcher(router));
server.listen(3000);

License

Made with 💚

Published under MIT License.

/@routup/prometheus/

    Package Sidebar

    Install

    npm i @routup/prometheus

    Weekly Downloads

    476

    Version

    2.4.0

    License

    MIT

    Unpacked Size

    49.2 kB

    Total Files

    29

    Last publish

    Collaborators

    • tada5hi