Skip to content
New issue

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

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

Already on GitHub? # to your account

buildSamplerFromEnv() in sdk-trace-base package should use parentbased_always_on if the given OTEL_TRACES_SAMPLER is unknown #5476

Open
trentm opened this issue Feb 13, 2025 · 0 comments · May be fixed by #5494
Assignees
Labels
bug Something isn't working pkg:sdk-trace-base priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@trentm
Copy link
Contributor

trentm commented Feb 13, 2025

Per https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration the default for OTEL_TRACES_SAMPLER is "parentbased_always_on".

Current process.env handling for OTEL_TRACES_SAMPLER does default to that value if the envvar is not specified, or empty. However, if a value is given but is unknown, the code is falling back to always_on instead of parentbased_always_on:

default:
diag.error(
`OTEL_TRACES_SAMPLER value "${environment.OTEL_TRACES_SAMPLER} invalid, defaulting to ${FALLBACK_OTEL_TRACES_SAMPLER}".`
);
return new AlwaysOnSampler();

@pichlermarc pichlermarc added bug Something isn't working priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect pkg:sdk-trace-base labels Feb 17, 2025
@pichlermarc pichlermarc self-assigned this Feb 20, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working pkg:sdk-trace-base priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
2 participants