Repository navigation
fix(aiohttp-server): resolve tracer dynamically for legacy middleware - #5256
VimalN2005 wants to merge 3 commits into
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-10-30 18:35 UTC Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):
Status above doesn't look right?
|
|
Hey @VimalN2005, took a quick look. The 3 red checks are all small things:
Since |
|
Hi @dipesh-cvg, Thank you for the quick and helpful feedback! I have addressed all points:
Everything is pushed now and ready for review. Thanks again! |
|
Nice, thanks for the quick update @VimalN2005! Just a heads-up: the CI workflows on the new commit are waiting for a maintainer to approve them (they show "action_required"), so the checks haven't run yet. Might be worth mentioning that in the Slack thread so someone can approve the run. Good luck with the review! |
Description
The backwards-compatible
middlewareexported byopentelemetry.instrumentation.aiohttp_serveris instantiated at import time and captures_tracer = NonebecauseAioHttpServerInstrumentor().instrument()has not yet executed. Later requests routed through this middleware fail withAttributeError: 'NoneType' object has no attribute 'start_as_current_span'and return HTTP 500.Resolve the tracer dynamically at request time when
_tracerwas captured asNone, falling back to the module tracer (or global tracer), while preserving explicit tracer provider bindings configured viacreate_aiohttp_middleware(tracer_provider=...).Fixes #5164
Type of change
Checklist:
.changelog/5164.fixed