Skip to content
Merged
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ release.
- Specify that environment variable propagation carriers only read and return
normalized environment variable names.
([#5144](https://github.com/open-telemetry/opentelemetry-specification/pull/5144))
- Clarify that environment variable propagation operational guidance is
non-normative and should be documented by language implementations.
([#5165](https://github.com/open-telemetry/opentelemetry-specification/pull/5165))

### Traces

Expand Down
41 changes: 25 additions & 16 deletions specification/context/env-carriers.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ When using environment variables as carriers:
- validating and parsing values
- applying any truncation or other format-specific behaviors

Language implementations SHOULD document
[operational guidance](#operational-guidance), including initialization-time
extraction, child process environment handling, and security considerations.
Comment thread
pellared marked this conversation as resolved.
Comment thread
pellared marked this conversation as resolved.

### Key Name Normalization

Language implementations MUST ensure that environment variable `Get`, `Set`,
Expand Down Expand Up @@ -95,39 +99,44 @@ that name normalizes to `X_B3_TRACEID`.

### Operational Guidance

> [!IMPORTANT]
> This section is non-normative and provides usage guidance only. It does not
> add requirements to the specification.

#### Environment Variable Immutability

Once set for a process, environment variables SHOULD be treated as immutable
within that process:
Context-related environment variables are best treated as process-startup input:

- Applications SHOULD read context-related environment variables during
- Applications should read context-related environment variables during
Comment thread
pellared marked this conversation as resolved.
Outdated
initialization.
Comment thread
pellared marked this conversation as resolved.
- Applications SHOULD NOT modify context-related environment variables of the
- Applications should not modify context-related environment variables in the
environment in which the parent process exists.
Comment thread
pellared marked this conversation as resolved.
Outdated

#### Process Spawning

When spawning child processes:

- Parent processes SHOULD copy the current environment variables (if
applicable), modify, and inject context when spawning child processes.
- Child processes SHOULD extract context from environment variables at startup.
- Parent processes should copy the current environment variables (if
applicable), modify that copy, and inject context into the copy when spawning
child processes.
Comment thread
pellared marked this conversation as resolved.
Outdated
- Child processes should extract context from environment variables at
startup.
- When spawning multiple child processes with different contexts or baggage,
each child SHOULD receive its own copy of the environment variables with
each child should receive its own copy of the environment variables with
appropriate information.
Comment thread
pellared marked this conversation as resolved.
Outdated
- The onus is on the application owner for receiving the set context from the
SDK and passing it to its own process spawning mechanism. The language
implementations MUST NOT handle spawning processes.
- Application code remains responsible for receiving context from the SDK and
passing it to the application's process spawning mechanism.

#### Security

Environment variables are generally accessible to all code running within a
process and with the correct permissions, can be accessed from other processes.
process. On many systems, they can also be accessed by other processes or users
with appropriate permissions.

- Implementations SHOULD NOT store sensitive information in environment
variables.
- Applications running in multi-tenant environments SHOULD be aware that
environment variables may be visible to other processes or users with
- Context propagation via environment variables is not appropriate for sensitive
information.
- Applications running in multi-tenant environments should account for
environment variables being visible to other processes or users with
appropriate permissions.
Comment thread
pellared marked this conversation as resolved.
Outdated

## Supplementary Guidelines
Expand Down
Loading