-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix: HTTPX tracing parallel requests #1404
base: main
Are you sure you want to change the base?
Conversation
When performing parallel requests eg. HTTPX.with_origin('https://api.ventrata.com').get('/', '/', '/‘) The parallel requests have their context nested so appear like: - HTTP GET - HTTP GET - HTTP GET This change injects the headers only with that request's context so doesn't pollute the global state and the results are what we expect: - HTTP GET - HTTP GET - HTTP GET
👋 not so much into the internals of the otel lib to understand what's happening. FWIW this was based on excon's integration. What I don't get is what's the problem of the current API, considering that the enhanced tracing context only injects the headers in the (single) request there. Did this work locally? I'd also compare this integration to the datadog plugin implementation. The code was very similar back then, and I believe there were some bugs fixed in the datadog plugin which may not have been ported back to otel. |
@HoneyryderChuck i've checked your datadog plugin and i think you have a bug in it. |
minus reset method as we can't reset the start_timestamp of a span
Regardless, i've followed your datadog plugin minus the reset and moved the start span up to the call method from the finish call. Let me know if this aligns more closely. |
You are absolutely right! In fact, I have been investigating a bug report in the last weeks related to distributed headers, and had a working branch which the reporter hadn't picked up yet for testing. Your comment actually made me realize what was happening, thank you for that. I did some additional changes to the structure. I'll be merging it today still, so feel free to use it as a blueprint. |
Thanks @HoneyryderChuck i've updated the PR to match your datadog plugin as a blueprint. I'd still appreciate you to do a quick review of the change, just in case i'm missing anything. But I believe otherwise this should be good for review. |
instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb
Outdated
Show resolved
Hide resolved
@HoneyryderChuck i just updated the PR with your proposed changes, can you take one final look please? |
@arielvalentin what's the process for getting this merged? |
The gem owner and at least one I'll review the PR later today and merge unless I find anything unusual. Gems are typically released every Tuesday. |
@HoneyryderChuck I followed your new datadog plugin nearly exactly but the tests now failing even worse than they were before. When you have time can you help take a look for me please? As I'm a little out of my depth as I'm neither an export of opentelemetry-ruby or httpx. |
@HoneyryderChuck i spent some more time on this, and believe the issue with the tests is because |
@HoneyryderChuck I've proposed a change I that i think fixes this, let me know |
… state, due to event emission one of them being the otel plugin, see open-telemetry/opentelemetry-ruby-contrib#1404
… state, due to event emission one of them being the otel plugin, see open-telemetry/opentelemetry-ruby-contrib#1404
@HoneyryderChuck better, but still getting failures:
Seems like |
When performing parallel requests eg.
HTTPX.with_origin('https://api.ventrata.com').get('/', '/', '/‘)
The parallel requests have their context nested so appear like:
This change injects the headers only with that request's context so doesn't pollute the global state and the results are what we expect:
@HoneyryderChuck would appreciate your review as HTTPX is your project. Thanks!