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

[sdk-traces] Add support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG #5448

Merged
merged 29 commits into from
Mar 19, 2024

Conversation

matt-hensley
Copy link
Contributor

@matt-hensley matt-hensley commented Mar 14, 2024

Fixes #3601

Changes

TracerProviders can now have a sampler configured via the OTEL_TRACES_SAMPLER environment variable.

The supported values are: always_off, always_on, traceidratio, parentbased_always_on, parentbased_always_off, and parentbased_traceidratio.

The options traceidratio and parentbased_traceidratio may have the sampler probability configured via the OTEL_TRACES_SAMPLER_ARG environment variable.

For details see: OpenTelemetry Environment Variable Specification.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 97.61905% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 85.48%. Comparing base (6250307) to head (1ea40e8).
Report is 134 commits behind head on main.

❗ Current head 1ea40e8 differs from pull request most recent head bb35bce. Consider uploading reports for the commit bb35bce to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5448      +/-   ##
==========================================
+ Coverage   83.38%   85.48%   +2.09%     
==========================================
  Files         297      289       -8     
  Lines       12531    12463      -68     
==========================================
+ Hits        10449    10654     +205     
+ Misses       2082     1809     -273     
Flag Coverage Δ
unittests ?
unittests-Solution-Experimental 85.43% <97.61%> (?)
unittests-Solution-Stable 85.45% <97.61%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...nTelemetry/Internal/OpenTelemetrySdkEventSource.cs 80.73% <100.00%> (-1.18%) ⬇️
src/OpenTelemetry/Trace/TracerProviderSdk.cs 99.36% <97.36%> (+0.08%) ⬆️

... and 61 files with indirect coverage changes

@matt-hensley matt-hensley marked this pull request as ready for review March 14, 2024 17:42
@matt-hensley matt-hensley requested a review from a team March 14, 2024 17:42
@CodeBlanch CodeBlanch added pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package traces Tracing signal related labels Mar 14, 2024
@CodeBlanch CodeBlanch changed the title Add support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG [sdk-traces] Add support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG Mar 14, 2024
Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Looks good. Left couple of comments - Could you resolve them before merge?

@utpilla utpilla merged commit 76cafe5 into open-telemetry:main Mar 19, 2024
37 checks passed
julealgon pushed a commit to julealgon/opentelemetry-dotnet that referenced this pull request Mar 27, 2024
… 'Unreleased'

The feature was added to the codebase _after_ `1.8.0-beta.1` had already been cut. It should be made available in the next release instead, which is why it should be in the "Unreleased" section of the changelog.

This was originally introduced in:
- [sdk-traces] Add support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG (open-telemetry#5448) (76cafe5)
julealgon pushed a commit to julealgon/opentelemetry-dotnet that referenced this pull request Mar 27, 2024
… 'Unreleased'

The feature was added to the codebase _after_ `1.8.0-beta.1` had already been cut. It should be made available in the next release instead, which is why it should be in the "Unreleased" section of the changelog.

This was originally introduced in:
- [sdk-traces] Add support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG (open-telemetry#5448) (76cafe5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package traces Tracing signal related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG
6 participants