1.0.0 • Published 7 years ago

promking v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

promking

Prometheus HTTP instrumentation for Express/Hapi. Attempts to mimic the official Prometheus Go client in terms of metrics.

Installation

npm install --save promking

Usage (express)

const promking = require('promking')
const expressApp = require('./your-app')

// Note: This should be done BEFORE other routes
// Pass 'app' as middleware parameter to additionally expose Prometheus under 'app.locals'
expressApp.use(promking.express(app))

// Optional: Add custom Prometheus metrics
const counter = new app.locals.prometheus.Counter({ name: 'metric_name', help: 'metric_help' })
counter.inc()

// Set up a metrics summary delivering server on given port
const summaryServer = promking.summaryServer({port: 1234})

Usage (hapi)

const promking = require('promking')
const hapiApp = require('./your-hapi-app')

hapiApp.register(promking.hapi())

const counter = new hapiApp.prometheus.Counter({ name: 'metric_name', help: 'metric_help' })
counter.inc()

// Set up a metrics summary delivering server on given port
const summaryServer = promking.summaryServer({port: 1234})

License

MIT-licensed. See LICENSE.