Skip to content

Commit 4df9f1a

Browse files
Refine the handling of OTEL_RESOURCE_ATTRIBUTES. (#4856)
Fixes #4847 * Fail fast, e.g. discard the ENTIRE env var value in the case of an error. * Values outside the baggage-octet (an ANSI subset) SHOULD be percent encoded, rather than MUST. --------- Co-authored-by: Reiley Yang <[email protected]>
1 parent 8a39837 commit 4df9f1a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ release.
2929

3030
### Resource
3131

32+
- Refine the handling of OTEL_RESOURCE_ATTRIBUTES.
33+
([#4856](https://github.com/open-telemetry/opentelemetry-specification/pull/4856))
34+
3235
### Entities
3336

3437
### Common

specification/resource/sdk.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,15 @@ information provided by the user, i.e. the user provided resource information
182182
has higher priority.
183183

184184
The `OTEL_RESOURCE_ATTRIBUTES` environment variable will contain of a list of
185-
key value pairs, and these are expected to be represented in a format matching
186-
to the [W3C Baggage](https://www.w3.org/TR/baggage/#header-content), except that additional
187-
semi-colon delimited metadata is not supported, i.e.: `key1=value1,key2=value2`.
188-
All attribute values MUST be considered strings and characters outside the
189-
`baggage-octet` range MUST be percent-encoded.
185+
key value pairs, represented as `key1=value1,key2=value2`.
186+
All attribute values MUST be considered strings. The `,` and `=` characters
187+
in keys and values MUST be percent encoded. Other characters MAY be
188+
[percent-encoded](https://datatracker.ietf.org/doc/html/rfc3986#section-2.1),
189+
e.g. values outside the ANSI characters set.
190+
191+
In case of any error, e.g. failure during the decoding process, the entire environment
192+
variable value SHOULD be discarded and an error SHOULD be reported following the
193+
[Error Handling principles](../error-handling.md#basic-error-handling-principles).
190194

191195
## Resource operations
192196

0 commit comments

Comments
 (0)