You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Latest release 0.32b0 introduced a bug where an additional span is created every time a new aiohttp ClientSession is created. This leads to 1 span per request when the first session is created, 2 spans when the second session gets created, ... and so on.
When AioHttpClientInstrumentor.instrument() the instrumentor intercepts the ClientSession.__init__ call and injects a TraceConfig instance into the parameters that are passed to the ClientSession. With the latest release an additional parameter trace_configs was added to the AioHttpClientInstrumentor.instrument() method.
The problem is that the trace_configs argument is now injected into every newly created ClientSession but it is also shared between all ClientSessions.
Every time a new ClientSession is created the instrumented __init__ call now adds one additional trace_config to the shared trace_configs argument (associated code can be found here). Since one trace_config defines the hooks to create and end one span, every added trace_config will produce an additional span per request.
Steps to reproduce
Instrument the aiohttp-client with AioHttpClientInstrumentor.instrument(). Create at least two ClientSessions and make one HTTP request to some arbitrary URL. The produced spans increase with every new ClientSession that is created.
Describe exactly how to reproduce the error. Include a code sample if applicable.
What is the expected behavior?
One span per HTTP request independent of the number of ClientSessions that are created.
What is the actual behavior?
Number of created spans increase with each newly created ClientSession.
The text was updated successfully, but these errors were encountered:
Thinking about it some more i don't quite see the purpose of the newly added trace_configs parameter in AioHttpClientInstrumentor.instrument().
A TraceConfig is the mechanism that aiohttp provides to trace requests by registering callbacks for all kind of events (start, end, exception, ...). This is what the instrumentor already uses to create and end spans accordingly. From an OpenTelemetry point of view adding further TraceConfigs would just mean creating more spans. So imo the trace_configs parameter to externally add additional TraceConfigs doesn't make much sense.
Latest release 0.32b0 introduced a bug where an additional span is created every time a new aiohttp ClientSession is created. This leads to 1 span per request when the first session is created, 2 spans when the second session gets created, ... and so on.
When
AioHttpClientInstrumentor.instrument()
the instrumentor intercepts theClientSession.__init__
call and injects a TraceConfig instance into the parameters that are passed to the ClientSession. With the latest release an additional parametertrace_configs
was added to theAioHttpClientInstrumentor.instrument()
method.The problem is that the
trace_configs
argument is now injected into every newly created ClientSession but it is also shared between all ClientSessions.Every time a new ClientSession is created the instrumented
__init__
call now adds one additional trace_config to the sharedtrace_configs
argument (associated code can be found here). Since one trace_config defines the hooks to create and end one span, every added trace_config will produce an additional span per request.Steps to reproduce
Instrument the aiohttp-client with
AioHttpClientInstrumentor.instrument()
. Create at least two ClientSessions and make one HTTP request to some arbitrary URL. The produced spans increase with every new ClientSession that is created.Describe exactly how to reproduce the error. Include a code sample if applicable.
What is the expected behavior?
One span per HTTP request independent of the number of ClientSessions that are created.
What is the actual behavior?
Number of created spans increase with each newly created ClientSession.
The text was updated successfully, but these errors were encountered: