jochen-schweizer / express-prom-bundle

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

Need a way to exclude certain routes in the configuration #59

Closed himelnagrana closed 3 years ago

himelnagrana commented 4 years ago

Right now to avoid certain routes to be excludes from the metrics - we need to do (as per documentation): app.use("/((?!foo))*", promBundle({includePath: true}));

It is a bit redundant in our use case as we are using this bundle inside a wrapper and using that wrapper into couple of node apps and we need to exclude multiple routes to be entered into metrics.

It would have been a great thing if somehow the excluded routes can be put inside this bundle configuration object. Or is it something existing and I have missed?

yacineb commented 3 years ago

Hi, done in this PR : https://github.com/jochen-schweizer/express-prom-bundle/pull/70

I've added a custom filter criteria on express request, this allows more control and it's more generic

yacineb commented 3 years ago

closed ==> done using the new bypass option