Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics exposure is blocking #98

Open
stephanecollot opened this issue Jan 29, 2024 · 1 comment
Open

Metrics exposure is blocking #98

stephanecollot opened this issue Jan 29, 2024 · 1 comment

Comments

@stephanecollot
Copy link

Hello,

I'm using aioprometheus in my FastAPI like this:

@app.get("/metrics")
async def handle_metrics(
    accept: List[str] = Header(None),
) -> Response:
    content, http_headers = render(REGISTRY, accept)
    return Response(content=content, media_type=http_headers["Content-Type"])

And I notice that when querying /metrics my application freeze for few seconds.
Is this normal? I'm looking at the code of render() and it seems not async.

Do you plan to make it async?
If not what solution do you suggest?

Thank you in advance

@stephanecollot
Copy link
Author

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.
prometheus/client_python#512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant