-
Notifications
You must be signed in to change notification settings - Fork 701
fastapi: fix wrapping of middlewares #3012
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice comment and test!
@adriangb Please take a look at the failing tests |
.../opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py
Outdated
Show resolved
Hide resolved
fixes #795 |
e406be8
to
3d8dd4f
Compare
instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py
Show resolved
Hide resolved
@xrmx see #3012 (comment) |
@Kludex could you update the Starlette instrumentations after we finish up this PR? I'm assuming they have the same bugs. |
The pipeline has been running for some hours... 👀 |
.../opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py
Outdated
Show resolved
Hide resolved
Hello! Just wondering if you'd expect this to enable getting the This has been discussed in more detail here: open-telemetry/opentelemetry-python#3477, but currently OpenTelemetryMiddleware's context seems to be removed by the time an exception gets to the Would be great to enable users to report back a [Update]: Have now verified this achieves the above behaviour - this fix is greatly appreciated! |
Fixed issue with test shutdown hanging. All checks passing now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I trust you on the fastapi knowledge but would be nice to add a test to check that the change does what it's supposed to fix
Ups looks like that got lost, I had added it in 4220b09 |
7497d32
to
f825c76
Compare
Added back and updated the branch |
.../opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py
Show resolved
Hide resolved
ICYMI the added test is red |
Thanks. I hadn't understood how the tests are parametrized and that |
.../opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py
Show resolved
Hide resolved
|
I've just signed the CLA, any way to re-trigger the check? |
Signed-off-by: emdneto <[email protected]>
Signed-off-by: emdneto <[email protected]>
instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py
Outdated
Show resolved
Hide resolved
@adriangb CI should be OK now |
Co-authored-by: Emídio Neto <[email protected]>
Signed-off-by: emdneto <[email protected]>
Anything else in the way of merging now? |
Signed-off-by: emdneto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adriangb I fixed the changelog conflict and added this note:
opentelemetry-instrumentation-fastapi
: Drop support for FastAPI versions earlier than 0.92
Signed-off-by: emdneto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a shot, lets see what CI says |
@adriangb we merged a PR stopping using SpanAttributes in favor of semconv._incubating.attributes.* |
Ok sounds like this 2 year old PR now needs another round of adjusting for upstream changes 😢. Any chance you can make the change here since you're familiar with the implications? |
Signed-off-by: emdneto <[email protected]>
Does @codefromthecrypt need to approve? |
@alexmojaki github was saying so but your approval was good enough 😅 |
Thanks everyone for getting this across! |
Amazing folks thanks so much!! |
MRE:
With this change it shows up properly
Run this and you'll see that there is no
"http.status_code": 500
in the logs.