Skip to content

Update to opentelemetry 0.24 #2

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

Merged
merged 5 commits into from
Sep 2, 2024
Merged

Update to opentelemetry 0.24 #2

merged 5 commits into from
Sep 2, 2024

Conversation

hardbyte
Copy link
Owner

@hardbyte hardbyte commented Aug 5, 2024

@hardbyte
Copy link
Owner Author

hardbyte commented Aug 5, 2024

PR just to solicit help with why the trace propagation no longer works after updating to 0.24.

Not planning to merge until reqwest-middleware is released - TrueLayer/reqwest-middleware#171

@mladedav
Copy link

mladedav commented Aug 7, 2024

The propagation doesn't work exactly because reqwest-tracing uses different tracing-opentelemetry from the verison you're using. The problem is that tracing-opentelemetry adds information to the spans but reqwest-tracing can't read it because it looks for different OtelData from different version of tracing-opentelemetry which isn't there.

Once reqwest-tracing is updated, propagation should work again. You can verify that with patching the dependency from git.

@hardbyte
Copy link
Owner Author

hardbyte commented Aug 9, 2024

Thank you very much for the pointer @mladedav - really appreciate it. I had used an upstream git revision of reqwest-tracing and middleware but I suspect it the same issue for axum-tracing-opentelemetry via its workspace cargo file, as it specifies opentelemetry and opentelemetry_sdk at version 0.23, and = tracing-opentelemetry at 0.24.

I'll see about updating the versions in axum-tracing-opentelemetry to see if they can all got along.

@hardbyte
Copy link
Owner Author

hardbyte commented Aug 9, 2024

Ok that was it - with a very hacky fork of axum-tracing-opentelemetry everything works again:

image

@davidB
Copy link

davidB commented Aug 31, 2024

You should have only one version of opentelemetry in your dependency's graph, because opentelemetry::global used static variables to store tracer_provider, propagator, ... So several versions imply several contexts, tracers,...
(tips on some of my projects I added a check (as part of the ci) into the dependency graph to enforce the one version of opentelemetry. Sorry I don't have access to the command, currently)

@davidB
Copy link

davidB commented Aug 31, 2024

FYI, I release new version of crates at https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk with support of opentelemetry 0.24

@hardbyte
Copy link
Owner Author

hardbyte commented Sep 2, 2024

You should have only one version of opentelemetry in your dependency's graph, because opentelemetry::global used static variables to store tracer_provider, propagator, ... So several versions imply several contexts, tracers,... (tips on some of my projects I added a check (as part of the ci) into the dependency graph to enforce the one version of opentelemetry. Sorry I don't have access to the command, currently)

Yes that's a bit of a trap! I'd managed to find that using cargo tree. Will update this branch to use the new tracing-opentelemetry-instrumentation-sdk now. Thanks!

@hardbyte hardbyte merged commit 2c96b8a into main Sep 2, 2024
@hardbyte hardbyte deleted the feature/otel-24 branch September 2, 2024 09:02
@hardbyte hardbyte changed the title Attempt to get opentelemetry 0.24 working Update to opentelemetry 0.24 Sep 2, 2024
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

Successfully merging this pull request may close these issues.

3 participants