Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

exporter/prometheus: Expose express request handler #748

Open
jacekjagiello opened this issue Jan 27, 2020 · 0 comments
Open

exporter/prometheus: Expose express request handler #748

jacekjagiello opened this issue Jan 27, 2020 · 0 comments

Comments

@jacekjagiello
Copy link

Is your feature request related to a problem? Please describe.
I would like to expose metrics from my app, without having to create a separate HTTP server for metrics endpoint.
Currently, PrometheusStatsExporter can only start a new HTTP server on the configured port. It does not expose an API that would allow integrating metrics endpoint to my app.

Describe the solution you'd like
Because Prometheus exporter leverages express to create an HTTP server, the simplest solution would be to expose express request handler, which can be further attached to the router of application.

Example:

const myApp = express()

const exporter = new PrometheusStatsExporter()

myApp.get('/metrics', exporter.getRequestHandler())

If this feature makes sense to you, I'll be happy to open PR 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant