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

1.1.1 • Public • Published

prometheus-metrics-middleware

Prometheus metrics middleware for NodeJS apps on top of prom-client.

Install

npm i prometheus-metrics-middleware --save
yarn add prometheus-metrics-middleware

Usage

import express from 'express'
import metricsMiddleware from 'prometheus-metrics-middleware'

const app = express()

app.use(
  metricsMiddleware({
    metricsPath: '/metrics',
    metricsPrefix: 'my_sample_app_',
    timeout: 1000 * 60,
  })
)

app.get('/healthcheck', (req: Request, res: Response) => {
  ...
})

app.listen(3000)

Options

Name Default Description
metricsPath /metrics Route to fetch metrics from prometheus
metricsPrefix - Prefix for metric names
timeout - Timeout (ms) for how often the probe should be fired

Access metrics

Prometheus format

curl http[s]://[host]:[port]/metrics

JSON format

curl http[s]://[host]:[port]/metrics.json

Readme

Keywords

none

Package Sidebar

Install

npm i prometheus-metrics-middleware

Weekly Downloads

0

Version

1.1.1

License

MIT

Unpacked Size

9.37 kB

Total Files

9

Last publish

Collaborators

  • mersocarlin