Skip to content

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

Merged
utpilla merged 29 commits intoopen-telemetry:mainfrom
matt-hensley:sampler-config
Mar 19, 2024
Merged

[sdk-traces] Add support for OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG#5448
utpilla merged 29 commits intoopen-telemetry:mainfrom
matt-hensley:sampler-config

Conversation

@matt-hensley
Copy link
Copy Markdown
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)

@codecov
Copy link
Copy Markdown

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
Copy Markdown
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

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