trallnag / prometheus-fastapi-instrumentator

Instrument your FastAPI with Prometheus metrics.
ISC License
929 stars 83 forks source link

Allow for custom dynamic labels on default metrics #279

Open iocentos opened 8 months ago

iocentos commented 8 months ago

Hi there,

Thanks for this package, it works like a charm.

I have a use case where I'd like to be able to inject custom labels into existing default metrics. We get an X-Request-Scope header as part of the requests which I'd like to pass as a label into the built in metrics. This would allow us to build dashboards and see metrics based on request scope.

Is this a possibility today or what kind of changes would it require to allow for such option?

Thank you

martian711 commented 6 months ago

https://github.com/trallnag/prometheus-fastapi-instrumentator/pull/287 this pull request works for you