Skip to content

Clarify case-insensitive env carrier lookup#5180

Merged
pellared merged 1 commit into
open-telemetry:mainfrom
pellared:env-var-windows-lookup
Jun 29, 2026
Merged

Clarify case-insensitive env carrier lookup#5180
pellared merged 1 commit into
open-telemetry:mainfrom
pellared:env-var-windows-lookup

Conversation

@pellared

@pellared pellared commented Jun 26, 2026

Copy link
Copy Markdown
Member

I think adding this note may be helpful for implementation and troubleshooting.

Personally, even though I was fully aware of the behavior on Windows, I still forgot about it at least twice while working on the implementations for OTel JS (open-telemetry/opentelemetry-js#6853 (comment)) and OTel Go (open-telemetry/opentelemetry-go-contrib#9112).

In OTel Go, I even decided to include this in method documentation.

// Get normalizes key and returns the corresponding value from the current
// process environment. It returns an empty string if the normalized
// environment variable is unset or set to an empty value.
//
// On platforms with case-insensitive environment lookup, such as Windows, the
// lookup may match an environment variable whose name differs from the
// normalized key only by case.
func (*Carrier) Get(key string) string {
	return os.Getenv(normalize(key))
}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds clarification to the environment carrier specification to help implementers understand that case-insensitive environment lookups (notably on Windows) can cause Get to match variables that differ only by case, despite key normalization rules.

Changes:

  • Documented the behavior of Get on platforms with case-insensitive environment variable lookup (e.g., Windows).
  • Added a concrete example showing how TRACEPARENT may resolve to an env var named traceparent on Windows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pellared pellared added the Skip Changelog Label to skip the changelog check label Jun 26, 2026
@pellared

Copy link
Copy Markdown
Member Author

@open-telemetry/semconv-cicd-approvers, @maryliag, @jack-berg, @marcalff, @xrmx, @pichlermarc, @martincostello, PTAL

@pellared
pellared added this pull request to the merge queue Jun 29, 2026
Merged via the queue into open-telemetry:main with commit 5598a97 Jun 29, 2026
10 of 14 checks passed
@pellared
pellared deleted the env-var-windows-lookup branch June 29, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog Label to skip the changelog check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants