1.1.1 • Published 4 years ago

prometheus-metrics-middleware v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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

NameDefaultDescription
metricsPath/metricsRoute 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
1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago