req.url comes from NodeJS and doesn't provide the right value (/ instead of /metrics or /metrics.json) to check the metricsPath against if prometheus-api-metrics is attached like this:
In this case, req.url is simply /. req.originalUrl is /metrics or /metrics.json. This PR will attempt to use req.originalUrl if set and fallback to req.url.
A workaround would be to simply set metricsPath to / but that both feels not great and doesn't work for the JSON path.
req.url
comes from NodeJS and doesn't provide the right value (/
instead of/metrics
or/metrics.json
) to check themetricsPath
against ifprometheus-api-metrics
is attached like this:In this case,
req.url
is simply/
.req.originalUrl
is/metrics
or/metrics.json
. This PR will attempt to usereq.originalUrl
if set and fallback toreq.url
.A workaround would be to simply set
metricsPath
to/
but that both feels not great and doesn't work for the JSON path.More info on
req.originalUrl
from the ExpressJS docs