-
Notifications
You must be signed in to change notification settings - Fork 543
ensure_integration_enabled_async
doesn't work sometimes
#2892
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
Comments
ensure_integration_enabled_async
decorator makes tests failensure_integration_enabled_async
doesn't work sometimes
What I just noticed. In our starlette integration when using the decorator on |
In my investigation, I found that the issue comes from this part in uvicorn: Basically, it tries to call the "app" (which can be an app factory at this point) with no arguments, and it expects the call to fail if you have an app and not a factory. However, the patched Then, the Hope this helps a little! |
We should remove |
Two different ways in which the decorator seems to alter the behavior of the decorated function. Unsure whether it's the same issue or two different ones.
1. Repro via a simple Starlette app
Install
sentry-sdk==2.0.0
,uvicorn
,starlette
.Create a simple Starlette app as
app.py
:Run with
uvicorn app:app
.Request
http://127.0.0.1:8000/
(or wherever your server is running). We didn't define any routes so it's not expected to resolve -- you should get a 404. Instead you'll get a 500:If you remove the
ensure_integration_enabled_async
decorator from the Starlette integration, rerun the server and request/
again, you'll get a 404 as expected.2. Repro via tests
_create_span_call
wrapper with theensure_integration_enabled_async
decorator.The tests will fail, even though the code should behave the same way as before the change.
This can also be observed with Starlette in CI on this PR: these are the failing tests, and this change makes the tests green.
I've observed this in other integrations as well, so it appears to be a problem with the decorator itself. The sync version of the decorator works without issues.
The text was updated successfully, but these errors were encountered: