Skip to content
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

autoprop: Handle empty env var as unset #4101

Merged
merged 3 commits into from Jul 27, 2023

Conversation

pellared
Copy link
Member

@pellared pellared commented Jul 26, 2023

Why

https://github.com/open-telemetry/opentelemetry-specification/blob/v1.23.0/specification/configuration/sdk-environment-variables.md?plain=1#L19

The SDK MUST interpret an empty value of an environment variable the same way as when the variable is unset.

What

Handle empty value of OTEL_PROPAGATORS environment variable the same way as when the variable is unset

Testing

The returned result of autoprop.NewTextMapPropagator has not changed. The only difference is that we do not log an unnecessary error via

// Communicate to the user their supplied value will not be used.
otel.Handle(err)

I am not sure it it is worth to add a unit test for it.

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #4101 (f113a83) into main (3061fc5) will decrease coverage by 0.1%.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #4101     +/-   ##
=======================================
- Coverage   79.2%   79.1%   -0.1%     
=======================================
  Files        165     165             
  Lines      10318   10318             
=======================================
- Hits        8173    8170      -3     
- Misses      2008    2010      +2     
- Partials     137     138      +1     
Files Changed Coverage Δ
propagators/autoprop/propagator.go 100.0% <100.0%> (ø)

... and 1 file with indirect coverage changes

@pellared pellared marked this pull request as ready for review July 26, 2023 10:13
@pellared pellared requested review from a team and MrAlias as code owners July 26, 2023 10:13
@MrAlias
Copy link
Contributor

MrAlias commented Jul 26, 2023

Doesn't this mean that if a user does something like OTEL_PROPAGATORS="$MY_RESOLVED_PROPS", but $MY_RESOLVED_PROPS is undefined the code will silently drop the error and just choose something for the user?

@pellared
Copy link
Member Author

Doesn't this mean that if a user does something like OTEL_PROPAGATORS="$MY_RESOLVED_PROPS", but $MY_RESOLVED_PROPS is undefined the code will silently drop the error and just choose something for the user?

Correct. This is the expected behavior. More context: open-telemetry/opentelemetry-specification#2045

@pellared pellared merged commit 33c3a8f into open-telemetry:main Jul 27, 2023
22 checks passed
@MrAlias MrAlias added this to the v0.43.0 milestone Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants