Repository navigation
fix(apollo5): Handle beforeSpan callback failures - #6238
Merged
adinauer merged 3 commits intoOct 9, 2026
Merged
Conversation
Drop spans when the Apollo 5 beforeSpan callback throws while preserving the GraphQL response. Report sampled spans as callback errors so client reports and discard callbacks remain accurate. Co-Authored-By: Claude <noreply@anthropic.com>
📲 Install BuildsAndroid
|
lbloder
reviewed
Oct 9, 2026
| @@ -207,6 +210,13 @@ constructor( | |||
| } | |||
| } catch (e: Throwable) { | |||
| ExceptionUtils.rethrowIfFatal(e) | |||
Collaborator
There was a problem hiding this comment.
This would need to be backported to Apollo3 and 4, correct?
Member
Author
There was a problem hiding this comment.
That's already in place in this PR stack. Apollo 5 was missing because it was merged recently.
adinauer
marked this pull request as ready for review
October 9, 2026 09:04
adinauer
requested review from
0xadam-brown,
markushi,
romtsn and
runningcode
as code owners
October 9, 2026 09:04
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- Handle beforeSpan callback failures ([#6238](https://github.com/getsentry/sentry-java/pull/6238))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.
📜 Description
Handle exceptions from Apollo 5
beforeSpancallbacks without disrupting the GraphQL request. Failed sampled spans are dropped and recorded ascallback_error; unsampled spans are dropped without reporting a loss.💡 Motivation and Context
The Apollo 3 and Apollo 4 integrations already isolate this callback. Apollo 5 logged the exception but left the partially modified span sampled, so it could still be captured and client reports did not reflect the callback failure.
💚 How did you test it?
./gradlew spotlessApply apiDump./gradlew :sentry-apollo-5:test📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.