You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a similar setup to what is described here. The only difference is that I have nginx in front talking to gunicorn over sockets, but I don't think that matters as far as I can tell.
I wasn't able to use this code:
# Using multiprocess collector for registrydefmake_metrics_app():
registry=CollectorRegistry()
multiprocess.MultiProcessCollector(registry)
returnmake_asgi_app(registry=registry)
metrics_app=make_metrics_app()
app.mount("/metrics", metrics_app)
It results in a page that gets a 307, so I implemented this:
My in progress counter always remains at zero, but I'm hoping that's because requests finish faster than I can see them. The histogram, however, never shows up - I see no record of it in my PROMETHEUS_MULTIPROC_DIR and it's never rendered in the output. Any ideas for what I could troubleshoot?
The text was updated successfully, but these errors were encountered:
Some extra context: most all of these get called in async middleware. Here's a rather benign one:
asyncdefadd_request_id(
request: Request, call_next: Callable[[Request], Awaitable[Response]]
) ->Response:
ifnotis_prometheus_endpoint(request):
REQUESTS_IN_PROGRESS_TOTAL.inc()
request.state.request_id=correlation_id.get()
start_time=time.time()
response=awaitcall_next(request)
ifnotis_prometheus_endpoint(request):
time_taken=time.time() -start_time# we replace UUIDs with <uuid> so that we flatten the curve of cardinality with unique URLs across all urlsREQUEST_TIME_SECONDS.labels(
method=request.method,
url_rule=replace_uuids(request.url.path),
status_code=response.status_code,
).observe(time_taken)
REQUESTS_IN_PROGRESS_TOTAL.dec()
returnresponse
Hey folks,
I have a similar setup to what is described here. The only difference is that I have nginx in front talking to gunicorn over sockets, but I don't think that matters as far as I can tell.
I wasn't able to use this code:
It results in a page that gets a 307, so I implemented this:
Apart from that my setup is pretty typical, I have some counters and a histogram:
My in progress counter always remains at zero, but I'm hoping that's because requests finish faster than I can see them. The histogram, however, never shows up - I see no record of it in my
PROMETHEUS_MULTIPROC_DIR
and it's never rendered in the output. Any ideas for what I could troubleshoot?The text was updated successfully, but these errors were encountered: