Repository navigation
fix(integrations): [Callback Errors 9] Guard custom callbacks - #6167
Merged
adinauer merged 5 commits intoOct 8, 2026
Conversation
Skip Android screenshot and view hierarchy capture when their callbacks throw, while retaining the error event. Drop spans on beforeSpan failures in OkHttp, OpenFeign, GraphQL, Ktor, and Apollo without disrupting requests or replacing the original request error. Preserve normal callback results and existing catch types. Finish failed spans and retain request cleanup and breadcrumbs. Add regression coverage for callback failures, partial mutations, original request errors, asynchronous GraphQL results, and subsequent Android captures. Correct callback wiring in the Ktor and screenshot test fixtures. Verify 18 regression cases fail before the fix and pass afterward; all 454 tests in the affected suites pass, along with formatting and API checks. Refs #6081 Co-Authored-By: Claude <[email protected]>
📲 Install BuildsAndroid
|
This was referenced Sep 25, 2026
Link the Android capture and integration beforeSpan callback fixes to Callback Errors 9 (#6167). Co-Authored-By: Claude <[email protected]>
Merge #6166 forward into #6167 without rewriting stack history. Preserve integration callback guards alongside the updated sampler behavior. Validate the combined core and OpenTelemetry suites, formatting, and API checks. Refs #6167 Co-Authored-By: Claude <[email protected]>
Record callback_error/span when a throwing beforeSpan callback drops a sampled span in OkHttp, OpenFeign, GraphQL, Ktor, and Apollo. Use the pre-callback sampling decision so partial callback mutations do not hide losses, and leave unsampled spans and intentional null drops uncounted. Add regression coverage for discard notifications, sampling states, and intentional drops while preserving request and span completion behavior. Refs #6167 Co-Authored-By: Claude <[email protected]>
4 of 9 tasks
romtsn
approved these changes
Oct 6, 2026
romtsn
left a comment
Member
There was a problem hiding this comment.
My clanker found a couple of more callbacks, not sure if we want to factor them in?
- Spring SentryUserProvider.provideUser in SentryUserFilter
- TransactionNameProvider in SentryRequestHttpServletRequestProcessor
- SentryTracingFilter
- OnOversizedEventCallback
- BeforeEnvelopeCallback
- OnDiscardCallback
Propagate the latest main and preceding callback error changes through the stacked pull request. Co-Authored-By: Claude <[email protected]>
adinauer
marked this pull request as ready for review
October 8, 2026 10:53
adinauer
requested review from
0xadam-brown,
markushi and
runningcode
as code owners
October 8, 2026 10:53
adinauer
merged commit Oct 8, 2026
64c1c55
into
fix/callback-error-handling-profile-accounting
63 of 65 checks passed
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- [Callback Errors 9] Guard custom callbacks ([#6167](https://github.com/getsentry/sentry-java/pull/6167))If none of the above apply, you can opt out of this check by adding |
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
Guard the remaining custom capture and span callbacks covered by this change:
beforeSpanexceptions and drop the affected span without disrupting the request or replacing its original exception.Failed spans still finish, including OkHttp event-listener cleanup. Normal callback return values, intentional drops, and existing catch types remain unchanged. New guards catch
Exception; the broader catch-type sweep remains separate. No public API changes.💡 Motivation and Context
Custom filtering callbacks must not cause requests to fail or allow potentially partially processed telemetry to be sent. Android callbacks decide whether to capture an attachment, so their failure skips that capture rather than dropping the error event.
💚 How did you test it?
beforeSpancallback; the screenshot allow-capture test was setting the view-hierarchy callback../gradlew spotlessApply apiDumpandapiCheckpassed; no API files changed.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Profile/replay artifact cleanup and remaining scope/feedback callbacks are separate follow-ups. Existing
Throwablecallback-boundary handling remains deferred to the next major.