prometheus-express
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Prometheus-Express

prometheus-express is a simple to use, extensible express plugin to serve request statistics through prometheus.

Getting Started

Installation

npm install --save prometheus-express

Usage

Using with JavaScript:

const express = require('express');
const promExpress = require('prometheus-express');
const app = express();
app.use(promExpress.instrumentExpress());
 
// ... your code

Using with TypeScrypt:

import express from 'express';
import promExpress from 'prometheus-express';
const app = express();
app.use(promExpress.instrumentExpress());
 
// ... your code

Expose metrics on different port, different express app.

const express = require('express');
const promExpress = require('prometheus-express');
const mainApp = express();
mainApp.use(promExpress.instrumentExpress({exposeMetrics: false}));
mainApp.listen(3000, (e) => {
    console.log('listening on a friendly 3000 port serving public traffic');
});
 
const metricsApp = express();
metricsApp.use(promExpress.exposeMetrics());
metricsApp.listen(3001, (e) => {
    console.log('exposing metrics for mainApp on port 3001, which isn\'t serving public traffic');
});

Readme

Keywords

Package Sidebar

Install

npm i prometheus-express

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

17.1 kB

Total Files

8

Last publish

Collaborators

  • briankopp