Conversation
Inherit the parent sampling decision when tracesSampler throws. Without a parent decision, leave the trace unsampled instead of applying the static tracesSampleRate, which can override the failed sampling policy. Keep normal null-result fallback, profiling callbacks, and catch types unchanged. Cover parent inheritance, backfilling, and static-rate bypass. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Sep 24, 2026
📲 Install BuildsAndroid
|
This was referenced Sep 24, 2026
Replace parent-decision fallback after tracesSampler errors with an unsampled decision and callback_error reports for the transaction and root span. Preserve deliberate null-result fallback and existing catches. Report callback errors directly in the sampler and retain existing sample_rate and backpressure accounting, accepting duplicate loss reports instead of adding discard-reason propagation. Cover core and OpenTelemetry paths with regression tests and update the changelog. Refs #6163 Co-Authored-By: Claude <noreply@anthropic.com>
adinauer
commented
Sep 25, 2026
| options | ||
| .getLogger() | ||
| .log(SentryLevel.ERROR, "Error in the 'TracesSamplerCallback' callback.", t); | ||
| options |
Member
Author
There was a problem hiding this comment.
This causes double reporting for transactions and spans with reason callback_error and again with sample_rate or backpressure. We discussed internally and are accepting this for now as the alternative would be more complexity.
If we reconsider, we can add a DiscardReason to TracesSamplingDecision. It also needs to be transported into our io.sentry.opentelemetry.SentrySampler.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Stack (Callback Errors)
📜 Description
When
tracesSamplerthrows, return an unsampled, unprofiled decision and immediately recordcallback_errorfor the transaction and root span. Do not inherit the parent sampling decision or fall back totracesSampleRate.A callback returning
nullstill follows the existing parent/static-rate fallback. Explicit sampling decisions still bypass the callback. Error logging, catch types, andprofilesSamplerbehavior are unchanged.Keep existing downstream
sample_rate/backpressureloss reporting. Duplicate reporting is accepted: the same transaction/root span can be counted under bothcallback_errorand the normal sampling reason. No discard-reason state or OpenTelemetry attribute propagation is added.💡 Motivation and Context
Parent inheritance or a static rate after a sampler failure can send traces that the failed callback intended to exclude. Fail closed on callback errors while preserving deliberate
nullfallback. Report callback errors directly at the failure boundary rather than adding cross-cutting state to suppress duplicate reports.💚 How did you test it?
./gradlew spotlessApply apiDump:sentry:testand:sentry-opentelemetry:sentry-opentelemetry-core:testsuites — 3,802 tests passed on this branch.nullfallback, explicit decisions, and recovery on subsequent calls.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Handle
profilesSamplerfailure semantics separately in #6164. The broader callback-boundary catch-type changes remain deferred to the next major.