-
Notifications
You must be signed in to change notification settings - Fork 282
added support for otlp headers #3201
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
base: main
Are you sure you want to change the base?
added support for otlp headers #3201
Conversation
Signed-off-by: Aminu 'Seun Joshua <[email protected]>
Did anyone try this without any code changes? I think the opentelemetry crate already checks some of the standard env vars... |
Yeah, looks like they all are checked. Judging by the code base. |
use crate::env::OtelExporterOtlpHeaders; | ||
|
||
/// Injects the current W3C TraceContext into the provided request. | ||
pub fn inject_trace_context<'a>(req: impl Into<HeaderInjector<'a>>) { | ||
let mut injector = req.into(); | ||
for (key, value) in OtelExporterOtlpHeaders::headers() { | ||
injector.set(&key, value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wouldn't want to inject the headers here. This is for propagating context to outgoing requests. OTEL_EXPORTER_OTLP_TRACES_HEADERS
is for setting headers on requests made to the OTel collector to export traces.
Fixes #2811