jochen-schweizer / express-prom-bundle

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

Declare that the metricsMiddleware is accessible on the bundle as well #56

Closed ankon closed 3 years ago

ankon commented 4 years ago

Related-to: #49


Note that this only adds the metricsMiddleware, not the promClient: I didn't feel comfortable to declare that as simply any.

jorge07 commented 4 years ago

Currently doing this

        const metricsRequestMiddleware: any = prometheus({
            autoregister: false,
            includeMethod: true,
            includePath: true,
           ...
            promClient: {
                collectDefaultMetrics: {},
            }
        });

        this.http.use(metricsRequestMiddleware);
        this.monitor.use(metricsRequestMiddleware.metricsMiddleware);

This PR, even if simple, adds lot of value here 👍

ankon commented 4 years ago

I have exactly the same use case: Multiple listeners, all should be collecting metrics, but only one should expose the /metrics endpoint.

jorge07 commented 3 years ago

@disjunction sorry to ping you directly. Are you folks considering this pr? It really add value to certain use cases

disjunction commented 3 years ago

I'll see to it tomorrow

disjunction commented 3 years ago

Hey guys. I'm sorting out the permissions for this repo. There was some misunderstanding. But will merge and publish to npm as soon as it's resolved.

jorge07 commented 3 years ago

Great, thanks!

disjunction commented 3 years ago

it's available on npm with a new version 6.2.0

jorge07 commented 3 years ago

Thanks a lot!