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

exporter/prometheus: Expose express request handler #748

Open
@jacekjagiello

Description

@jacekjagiello

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 😉

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions