Skip to content

Conversation

@Gosling-dude
Copy link

@Gosling-dude Gosling-dude commented Dec 24, 2025

What does this change do?

  • Emits a WARNING when TraceIdRatioBasedSampler is configured as a child sampler via ParentBasedSamplerBuilder.
  • Warning is logged once at configuration time only.
  • No runtime or sampling behavior is changed.

Why is this needed?

  • Required by the OpenTelemetry trace SDK specification.
  • Using TraceIdRatioBasedSampler as a child sampler can lead to unexpected behavior.

Implementation notes:

  • Warning logic lives only in ParentBasedSamplerBuilder.
  • ParentBasedSampler remains behavior-only with no logging or side effects.

How was this tested?

  • ./gradlew :sdk:trace:test
  • ./gradlew spotlessCheck

Closes #7790

@Gosling-dude Gosling-dude requested a review from a team as a code owner December 24, 2025 18:09
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 24, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.07%. Comparing base (1093571) to head (64e09bc).

Files with missing lines Patch % Lines
.../sdk/trace/samplers/ParentBasedSamplerBuilder.java 69.23% 0 Missing and 4 partials ⚠️

❌ Your patch check has failed because the patch coverage (69.23%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7937      +/-   ##
============================================
- Coverage     90.09%   90.07%   -0.03%     
- Complexity     7432     7437       +5     
============================================
  Files           834      834              
  Lines         22537    22550      +13     
  Branches       2236     2236              
============================================
+ Hits          20304    20311       +7     
- Misses         1532     1533       +1     
- Partials        701      706       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Gosling-dude Gosling-dude force-pushed the warn-child-traceidratio branch from 6e2eef7 to db30494 Compare December 24, 2025 19:33
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.

Emit warnings when TraceIdRatioBased Sampler is used as child sampler

1 participant