jochen-schweizer / express-prom-bundle

express middleware with standard prometheus metrics in one bundle
MIT License
303 stars 67 forks source link

Disable http_request_duration_seconds #94

Closed toymachiner62 closed 3 years ago

toymachiner62 commented 3 years ago

Is it possible to completely disable the default http_request_duration_seconds metric?

disjunction commented 3 years ago

This is the only metric provided by the library. How else do you use it?

toymachiner62 commented 3 years ago

It provides us the middleware function. We use prom-client to create all our own metrics along with this middleware.

disjunction commented 3 years ago

You shouldn't use this library for that. Exposing a metric is as easy as:

const promClient = require('prom-client')

app.get('/metrics', function(req,res) {
  res.status(200).set('Content-Type', 'text/plain')
  promClient.register.metrics()
    .then(output => res.end(output))
})

(I wish prom-client had an explicit example in their docs)