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
Support for OTEL_PROPAGATORS environment variable #5147
Support for OTEL_PROPAGATORS environment variable #5147
Conversation
Thanks for the PR. I will need to check on something before we merge this, as the otel dependency is a bit tricky for some of our users. |
Any progress on this @mholt ? support for b3 (or others) is quite important |
We can merge this, but the lint errors need fixing. Edit: Nevermind -- just looked and for some reason the linter has started complaining about code unrelated to this change. 🤔 I'll look into this... |
I don't think those linter errors make any sense. That's got to be a bug. The code shouldn't even be compiling if some of those are true. I'll merge this and cross fingers. Thanks @krak3n ! |
Awesome thank you @mholt 🎉 |
Currently the propagators are hard coded to W3C TraceContext and Baggage within the tracing module here.
This makes it difficult to integrate Caddy into existing systems that do not use W3C TraceContext or Baggage for propagating traces.
This PR adds support to the
caddyhttp/tracing
module to support the OpenTelemetryOTEL_PROPAGATORS
environment variable which allows users to configure the propagators used to extract and inject trace data from incoming and outgoing requests.For example, users will now be able to define their propagators like this:
export OTEL_PROPAGATORS=b3,b3multi,baggage
As defined here on the OpenTelemetry SDK configuration document.
This is achieved by using the
go.opentelemetry.io/contrib/propagators/autoprop
propagator which also uses the W3C TraceContext and Baggage as the default if no propagators are set on theOTEL_PROPAGATORS
environment variable, see here