hynek / prometheus-async

Async Python helpers for the official prometheus-client.
https://prometheus-async.readthedocs.io/
Apache License 2.0
159 stars 15 forks source link

Is it fully async and non-blocking? #59

Open stephanecollot opened 7 months ago

stephanecollot commented 7 months ago

Hello,

I'm currently using aioprometheus in a FastAPI Uvicorn app, but the metric exposure is blocking all the routes: https://github.com/claws/aioprometheus/issues/98

Looking at the official client, it seems that they added async ASGI metric exposure. But I don't know if their metrics update will then be blocking. I didn't try it yet. See https://github.com/prometheus/client_python/pull/512

So I would like to know if prometheus-async is non-blocking for metrics update and metrics exposure, i.e. these two operations won't block execution of other HTTP requests.

hynek commented 7 months ago

What do you understand under "blocking" exactly? In the context of async, we usually call things blocking that block on I/O. Purely computational overhead is not considered blocking.

Without double-checking, I suspect our start_http_server_in_thread should do what you're asking for?

hynek commented 7 months ago

oh and see #13!