Skip to content

SDK env var config Enum values are case-insensitive #4576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pellared
Copy link
Member

@pellared pellared commented Jul 2, 2025

What

Enum values provided via environment variables SHOULD be interpreted in a case-insensitive manner.
When reporting configuration errors, implementations SHOULD display the original user-provided value to aid debugging.

Why

This improves user experience by allowing more flexible configuration (e.g., OTEL_EXPORTER_OTLP_PROTOCOL=grpc and OTEL_EXPORTER_OTLP_PROTOCOL=gRPC can be treated equivalently).

This improves consistency as it is also similar to the Boolean definition which has many in common to Enum type:

Any value that represents a Boolean MUST be set to true only by the case-insensitive string "true"

Implementations

Here is an example from OTel Go (existing code from main branch) where OTEL_TRACES_SAMPLER enum value is lower-cased before comparing with known-values:

https://github.com/open-telemetry/opentelemetry-go/blob/118298edcfd5a38c7eb767bc290a528d380a79fd/sdk/trace/sampler_env.go#L49-L54

tsloughter
tsloughter previously approved these changes Jul 2, 2025
Copy link
Member

@tsloughter tsloughter left a comment

Choose a reason for hiding this comment

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

Oops, only way to undo an approval is to make a comment it seems.

@pellared pellared dismissed tsloughter’s stale review July 2, 2025 14:15

Dismissing 😉

@pellared
Copy link
Member Author

pellared commented Jul 2, 2025

Oops, only way to undo an approval is to make a comment it seems.

Not really. I dismissed your approval.

@pellared pellared added enhancement New feature or request area:configuration Related to configuring the SDK labels Jul 2, 2025
@pellared pellared marked this pull request as ready for review July 2, 2025 14:23
@pellared pellared requested review from a team as code owners July 2, 2025 14:23
@pellared pellared requested a review from tsloughter July 2, 2025 14:24
@pellared pellared changed the title Enum value is case-insensitive Enum values are case-insensitive Jul 2, 2025
@carlosalberto
Copy link
Contributor

Let's advertise this PR in the next spec call so maintainers can double check it.

@arminru arminru changed the title Enum values are case-insensitive SDK env var config Enum values are case-insensitive Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:configuration Related to configuring the SDK enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants