GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Emit warning when TraceIdRatioBasedSampler is used as child sampler by Gosling-dude · Pull Request #7937 · open-telemetry/opentelemetry-java

Conversation

@Gosling-dude

@Gosling-dude Gosling-dude commented Dec 24, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Gosling-dude
Emit warning when TraceIdRatioBasedSampler is used as child sampler
49677d9
@Gosling-dude
Gosling-dude requested a review from a team as a code owner December 24, 2025 18:09
@linux-foundation-easycla

linux-foundation-easycla Bot commented Dec 24, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Gosling-dude / name: Sumit Chauhan (49677d9, 4af9078, 64e09bc, db30494, e944463, ef83131, efdcb79)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Gosling-dude
Format ParentBasedSamplerBuilder with Spotless
4af9078
@codecov

codecov Bot commented Dec 24, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.10%. Comparing base (1093571) to head (efdcb79).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7937   +/-   ##
=========================================
  Coverage     90.09%   90.10%           
- Complexity     7432     7438    +6     
=========================================
  Files           834      834           
  Lines         22537    22546    +9     
  Branches       2236     2236           
=========================================
+ Hits          20304    20314   +10     
  Misses         1532     1532           
+ Partials        701      700    -1     

☔ 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Gosling-dude added 2 commits December 25, 2025 00:38
@Gosling-dude
Remove child-sampler warnings from ParentBasedSampler
ef83131
@Gosling-dude
Add test for child TraceIdRatioBasedSampler warning
db30494
@Gosling-dude
Gosling-dude force-pushed the warn-child-traceidratio branch from 6e2eef7 to db30494 Compare December 24, 2025 19:33
Gosling-dude added 2 commits December 25, 2025 01:35
@Gosling-dude
Increase test coverage for ParentBasedSamplerBuilder warnings
64e09bc
@Gosling-dude
test: cover all ParentBasedSamplerBuilder warning branches
e944463
@Gosling-dude

Gosling-dude commented Dec 24, 2025

Copy link
Copy Markdown
Contributor Author

All required checks are passing.

This implements the spec-required compatibility warning for TraceIdRatioBasedSampler when used as a child sampler. Logging is limited to ParentBasedSamplerBuilder and does not affect sampling behavior.

Happy to adjust if there are any suggestions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jkwatson
jkwatson reviewed Dec 24, 2025
View reviewed changes
Comment thread sdk/trace/src/main/java/io/opentelemetry/sdk/trace/samplers/ParentBasedSamplerBuilder.java Outdated
Comment on lines +37 to +43
if (!warnedRemoteParentSampled && remoteParentSampled instanceof TraceIdRatioBasedSampler) {
warnedRemoteParentSampled = true;
logger.warning(
"TraceIdRatioBasedSampler is being used as a child sampler (remoteParentSampled). "
+ "This configuration is discouraged per the OpenTelemetry specification "
+ "and may lead to unexpected sampling behavior.");
}

@jkwatson jkwatson Dec 24, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is generally only going to be done once for a given builder instance. I don't think we need the extra checks to make sure it only gets logged once.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Gosling-dude reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@Gosling-dude Gosling-dude Dec 25, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

That makes sense - agreed.

I’ll remove the warned* guards and emit the warning unconditionally when a TraceIdRatioBasedSampler is set as a child sampler. That keeps the builder simpler and aligns with typical usage.

I’ll push a small follow-up update shortly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Gosling-dude Gosling-dude Dec 25, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It looks like one Windows CI job (windows-latest, 8) failed while the rest passed. This may be transient. would you mind re-running that job when convenient?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jkwatson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Gosling-dude
Simplify child sampler warning logic
efdcb79
jkwatson
jkwatson approved these changes Dec 27, 2025
View reviewed changes

@jkwatson jkwatson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Gosling-dude reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@jkwatson
jkwatson merged commit 7a46bc5 into open-telemetry:main Dec 27, 2025
@otelbot

otelbot Bot commented Dec 27, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution @Gosling-dude! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jkwatson jkwatson jkwatson approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Emit warnings when TraceIdRatioBased Sampler is used as child sampler

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Gosling-dude @jkwatson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.