-
Notifications
You must be signed in to change notification settings - Fork 821
Description
Describe your environment
OS: Ubuntu
Python version: 3.13.3
Package version: 0.60b0.dev
What happened?
The aiohttp client instrumentation library currently does not support suppressing instrumentation with suppress_http_instrumentation() which leads to unexpected behavior when using this functionality. For example, the following code produces a Span even though none should be created:
async with aiohttp.ClientSession() as session:
with suppress_http_instrumentation():
async with session.get('http://localhost:8080/success') as response:
_ = await response.text()
My guess is that this library simply never got updated when the suppress_http_instrumentation() API was introduced. The fix should be as trivial as replacing the call to is_instrumentation_enabled() to is_http_instrumentation_enabled() in the library here
async def on_request_start(
unused_session: aiohttp.ClientSession,
trace_config_ctx: types.SimpleNamespace,
params: aiohttp.TraceRequestStartParams,
):
if (
not is_instrumentation_enabled()
or trace_config_ctx.excluded_urls.url_disabled(str(params.url))
):
trace_config_ctx.span = None
return
...
Expected Result
No Spans are created when using suppress_http_instrumentation()
Actual Result
Spans are created when using suppress_http_instrumentation()
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.