env var carriers to only read and return normalized names#5144
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the environment-variable carrier specification to avoid requiring environment enumeration during extraction by defining that carriers only operate on normalized environment variable names (for reads and key listing), addressing the efficiency and determinism concerns raised in issue #5143.
Changes:
- Redefine env-var carrier
Getbehavior to read only the normalized key name (no matching against non-normalized env var names). - Redefine
Keysbehavior to return only already-normalized environment variable names. - Add a changelog entry documenting this specification clarification.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| specification/context/env-carriers.md | Tightens normalization semantics so Get reads only normalized env var names and Keys returns only already-normalized names. |
| CHANGELOG.md | Records the env-var carrier normalization behavior change in the Unreleased Context section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
CC @open-telemetry/semconv-cicd-approvers @marcalff @jack-berg |
marcalff
left a comment
There was a problem hiding this comment.
LGTM,
Thanks for supporting this simplification.
Check out the java implementation of this. Some notes:
Finally, starting a new process that needs env var context propagation seems like orders of magnitude more resource utilization that what we're talking about for reading / normalizing all env vars. Does this really matter?
Does this solve that? The real inefficiency comes from keys(), which in the current implementation has to iterate / normalize all |
|
@jack-berg, regarding #5144 (comment) I suggest continuing the discussion in #5143. Notably please check #5143 (comment) which should answer your concern. |
Fixes #5143
Prototypes:
Rationale
The previous wording required environment variable carriers to normalize every key present in the carrier before matching a requested propagation key.
This PR removes that requirement for two reasons:
Instead, carriers normalize the key requested by the propagator and read only the corresponding normalized environment variable name.
Keyssimilarly returns only environment variable names that are already normalized.This keeps injection behavior unchanged while making extraction predictable and avoiding unnecessary environment enumeration.