Socket
Socket
Sign inDemoInstall

@routup/prometheus

Package Overview
Dependencies
2
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@routup/prometheus


Version published
Maintainers
0
Created

Readme

Source

@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.

Keywords

FAQs

Last updated on 29 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc