Does sentry honor asynchronous code? [Python, Asyncio]

Greetings. I want to intergrate Sentry, but I am worried with perfomance issues. My app is using gunicorn + aiohttp workers, so it makes all requests in asynchronous manner. Will Sentry honor asynchronous code or it’ll block the event loop every time sending logs to the sentry servers?

1 Like

Are you using the AIoHttp integration?

Yes, I’m using the AIoHttp integration. But what do I need to use for Gunicorn + Uvicorn workers? It also uses asynchronous python and Sentry does not provide proper integration solution.

1 Like

Sentry does not integrate with web servers, but web frameworks. For ASGI it has an ASGI middleware that you need to wrap your app in for instrumentation.

It’s clear
But how it relates to the question about blocking code? :slight_smile:

It should work out of the box. Sentry spawns a background thread for sending outbound http requests. This generally works out fine regardless of whether your own code is async vs not. It is hard to tell whether this approach will have to change in the future, but if it will and we need specialized code for uvicorn, it will be part of a respective integration.

1 Like