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

feat: handle OTEL_TRACES_SAMPLER env var #2111

Merged
merged 4 commits into from
Apr 20, 2021

Conversation

jtmalinowski
Copy link
Contributor

Adds support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG, in favor of
OTEL_SAMPLING_PROBABILITY.

Which problem is this PR solving?

Short description of the changes

  • removes support for OTEL_SAMPLING_PROBABILITY
  • adds support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG

Adds support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG, in favor of
OTEL_SAMPLING_PROBABILITY.
@codecov
Copy link

codecov bot commented Apr 14, 2021

Codecov Report

Merging #2111 (c049704) into main (09c2aa7) will decrease coverage by 0.08%.
The diff coverage is 89.36%.

@@            Coverage Diff             @@
##             main    #2111      +/-   ##
==========================================
- Coverage   92.73%   92.64%   -0.09%     
==========================================
  Files         138      139       +1     
  Lines        4927     4964      +37     
  Branches     1016     1026      +10     
==========================================
+ Hits         4569     4599      +30     
- Misses        358      365       +7     
Impacted Files Coverage Δ
packages/opentelemetry-tracing/src/config.ts 86.84% <86.48%> (-13.16%) ⬇️
...ckages/opentelemetry-core/src/utils/environment.ts 95.83% <100.00%> (-4.17%) ⬇️
packages/opentelemetry-core/src/utils/sampling.ts 100.00% <100.00%> (ø)
packages/opentelemetry-tracing/src/utility.ts 100.00% <100.00%> (ø)

Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

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

overall looks good

packages/opentelemetry-tracing/src/config.ts Outdated Show resolved Hide resolved
packages/opentelemetry-tracing/src/config.ts Outdated Show resolved Hide resolved
@naseemkullah
Copy link
Member

lgtm, but could you mark this as breaking and add documentation as how to migrate form OTEL_SAMPLING_PROBABILITY?

If I understand correctly it would be:

old:

OTEL_SAMPLING_PROBABILITY: <SAMPLING_PROBABILITY>

new:

OTEL_TRACES_SAMPLER: parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG: <SAMPLING_PROBABILITY>

@vmarchaud
Copy link
Member

but could you mark this as breaking

I've already added the "breaking" label which should generated the correct entry in the changelog

@jtmalinowski
Copy link
Contributor Author

@naseemkullah @vmarchaud fixed

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

generally ok, just one concern with the hardcoded values, please create enum / const for that

@jtmalinowski
Copy link
Contributor Author

@obecny done, let me know if we need anything else

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

lgtm, thx for the changes

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.

General environment configuration
4 participants