-
Notifications
You must be signed in to change notification settings - Fork 894
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
Not clear whether values in OTEL_EXPORTER_OTLP_HEADERS
should be URL encoded
#3832
Comments
I think the spec is clear and its just a bug in the case of java not dealing with URL encoded values. For proof, consider that the resource specification contains similar language for how key / values are encoded: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable And in otel java, we perform url decoding on resource attribute values: https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/ResourceConfiguration.java#L70 We should just do the same thing for |
Looking at different exporter implementations, it seems that implications of referring to W3C Baggage aren't all that clear:
What's not clear to me is whether the desired behavior is the one implemented in Go (both encoded and non-encoded headers are supported) or the one implemented in Python (only encoded headers are supported). I assume that languages currently not supporting encoded headers will do what Go does and support both, as otherwise this would be a breaking change. Note that this isn't an esoteric use case, as authentication headers contain spaces. |
JS also url-decodes OTEL_EXPORTER_OTLP_HEADERS |
@dyladan But JS still accepts non URL-encoded values in |
I'm interpreting this as a bug fix. |
It does not strictly require it in JS |
Agreed. However, it's not clear to me how best to fix it in a consistent ways across languages. Two possibilities proposed today in the spec meeting:
|
👍 FWIW, in the proposed java fix for this, I just added a test to confirm that non-url encoded values continue to work as well. So with the fix, java would join js and go in supporting both URL-encoded and non-URL-encoded. |
This seems to be the feasible way to go. If there are no objections, I can create PRs for languages currently not supporting URL encoded values to:
|
The headers from environment variables are expected to be URL encoded according to the spec. This change tries to URL decode them. See open-telemetry/opentelemetry-specification#3832 See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
Per a recent spec clarification in open-telemetry/opentelemetry-specification#3832 OTLP headers should support url-encoded header values.
Per a recent spec clarification in open-telemetry/opentelemetry-specification#3832 OTLP headers should support url-encoded header values. Co-authored-by: Tobias Bachert <[email protected]>
Per a recent spec clarification in open-telemetry/opentelemetry-specification#3832 OTLP headers should support url-encoded header values. Co-authored-by: Tobias Bachert <[email protected]>
PRs for implementing the solution described in #3832 (comment) have been submitted for .NET, Java, PHP, Rust, and C++. For Erlang and Swift I don't know the current state of support of URL encoded values, however, I raised this issue in the relevant Slack channels. Given this, I'll close this issue. |
What are you trying to achieve?
We're trying to share the same values for
OTEL_EXPORTER_OTLP_HEADERS
across different languages. However, while Python requires header values to be URL encoded, Java and .NET cannot deal with URL encoded values. I didn't yet check other languages.Additional context.
The specification refers to the W3C Baggage specification for details about the format of
OTEL_EXPORTER_OTLP_HEADERS
:The W3C Baggage spec requires values to be URL encoded:
I wonder whether it was the original intent of requiring URL encoding for
OTEL_EXPORTER_OTLP_HEADERS
, or whether that's an unintended side-effect of referencing the W3C Baggage spec.The text was updated successfully, but these errors were encountered: