Skip to content
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

Allowing okhttp event listeners to access the current http span's context #537

Open
LikeTheSalad opened this issue Aug 14, 2024 · 1 comment

Comments

@LikeTheSalad
Copy link
Contributor

Seems like okhttp event listener's callback methods are called before the HTTP span's context becomes the current one for the dispatcher's thread. This causes that calls to Context.curent() within an event listener's method (all of them?) to not return the HTTP span's context.

@serkan-ozal
Copy link

Thanks for the issue @LikeTheSalad. As we have discussed in the Slack, while some of the EventListener callbacks (for ex. dnsStart, dnsEnd, secureConnectStart, secureConnectEnd) are called before the actual HTTP request (and so HTTP span), some others are called after it. So at the time of those event callbacks are triggered, there is no active HTTP span's context, so Context.current() returns the outer span (active span just before the OkHTTP client call) or null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants