-
Notifications
You must be signed in to change notification settings - Fork 663
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
HTTPX instrumentor wraps transport repeatedly #554
Comments
I believe calling |
Oh, yeah, my bad. This is due to me changing up the approach of wrapping I think we can easily add an attribute that says it's been instrumented and checked. The only issue left after that still would be the leftover attribute and transport on those instances. It's tricky (I think), and makes me rethink the approach of using the transport. Maybe this instrumentation should just wrap the I won't have the time to get a PR up for this, so I would appreciate if someone else could look into it. |
@lzchen So subclassing both client classes and replacing them in the module? Seems like it should work and would be easier to clean up when removing the instrumentation. |
The new HTTPX instrumentor wraps
client._transport
repeatedly if the same client is re-used for multiple requests. @jomastiDescribe your environment
Steps to reproduce
Create an instance of
httpx.Client
and make multiple calls on it. Observe that the number of nested spans increases with each successive call, because the wrapped transport is re-wrapped with each request.What is the expected behavior?
A single span should appear per request.
What is the actual behavior?
One, two, then three spans appear per request.
Additional context
The problem is in
instrumented_sync_send
where the transport is indiscriminately wrapped, even if it already is an instance ofSyncOpenTelemetryTransport
.The text was updated successfully, but these errors were encountered: