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

OTLP gRPC exporter doesn't support OTEL_EXPORTER_OTLP_HEADERS but OTLP/HTTP supports it. #1336

Closed
srikanthccv opened this issue Nov 2, 2023 · 3 comments · Fixed by #1377
Closed
Labels
A-common Area:common issues that not related to specific pillar enhancement New feature or request

Comments

@srikanthccv
Copy link
Member

The kv pairs from the env OTEL_EXPORTER_OTLP_HEADERS should be set as metadata for grpc exporter.

@TommyCpp TommyCpp added bug Something isn't working A-common Area:common issues that not related to specific pillar labels Nov 2, 2023
@TommyCpp TommyCpp self-assigned this Nov 2, 2023
@TommyCpp
Copy link
Contributor

TommyCpp commented Nov 2, 2023

Thanks for the report I will take a look. Should be an easy fix

@hdost hdost added this to the OTLP Tracing Exporter Stable milestone Nov 2, 2023
@cijothomas
Copy link
Member

#1290 The PR description explains why supporting this for gRPC is non-trivial, hence not done (yet).

@cijothomas
Copy link
Member

@TommyCpp given Env vars are optional from spec, I think this can be treated as an enhancement, not a bug.

@TommyCpp TommyCpp added enhancement New feature or request and removed bug Something isn't working labels Nov 2, 2023
@TommyCpp TommyCpp removed their assignment Nov 6, 2023
hdost pushed a commit that referenced this issue Nov 19, 2023
Fixes #1336

As per the
[specs](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.25.0/specification/protocol/exporter.md#specifying-headers-via-environment-variables),
the custom headers for OTLP exporter can be specified through env
variables - `OTEL_EXPORTER_OTLP_HEADERS`,
`OTEL_EXPORTER_OTLP_TRACES_HEADERS`,
`OTEL_EXPORTER_OTLP_METRICS_HEADERS`.
This PR completes the work already done in PR
#1290 adding support for tonic metadata
To reproduce the same behavior as http exporter, the env-variable takes
precedence (as discussed in
open-telemetry/opentelemetry-rust-contrib#10)

* Move common code for http and tonic exporters in `exporter/mod.rs`
(function to parse header from string and test helper to run tests with
isolated env variables)
I wanted to minimize the changes but maybe it should be a good idea to
use a crate like https://crates.io/crates/temp-env for environment
related testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-common Area:common issues that not related to specific pillar enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants