opentelemetry-dotnet
opentelemetry-dotnet copied to clipboard
OTEL_RESOURCE_ATTRIBUTES values are not parsed as defined per spec
From the OTel spec:
The OTEL_RESOURCE_ATTRIBUTES environment variable will contain of a list of key value pairs, and these are expected to be represented in a format matching to the W3C Baggage, except that additional semi-colon delimited metadata is not supported, i.e.: key1=value1,key2=value2. All attribute values MUST be considered strings.
From the W3C spec:
A value contains a URL encoded UTF-8 string. Leading and trailing whitespaces (OWS) are allowed but MUST be trimmed when converting the header into a data structure.
Currently, the values defined in OTEL_RESOURCE_ATTRIBUTES (splitted by ,) are not parsed at all. Source code here.
Found thanks to: https://github.com/open-telemetry/opentelemetry-go/pull/2963
https://github.com/open-telemetry/opentelemetry-specification/pull/2670 updates the Resource spec to take percent-decode into account.
Is this still the case @pellared ?
The OTEL_RESOURCE_ATTRIBUTES env var is still still not properly parsed.
It accepts keys that should not be allowed.
They values are not precent decoded as noted https://github.com/open-telemetry/opentelemetry-dotnet/issues/3395#issuecomment-1200526391
Reference: https://www.w3.org/TR/baggage/#definition