Keep transactions out of BeforeSend handler on Apple - #1610
Merged
Merged
Conversation
sentry-cocoa passes transactions to beforeSend in non-V10 builds, so the user's BeforeSend handler received them on macOS/iOS and could drop them, unlike on other platforms. Return transactions unchanged before running the crash check and the handler. The tracing integration tests now configure the sample BeforeSend handler and check that the transaction doesn't carry its tag.
jpnurmi
approved these changes
Oct 2, 2026
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.
This PR stops the
BeforeSendhandler from receiving transactions on macOS and iOS.The bundled sentry-cocoa build calls
beforeSendWithHintfor every event except feedback, transactions included. sentry-cocoa only skips transactions there inSDK_V10builds. The plugin passed them on to the user'sUSentryBeforeSendHandleras regular events. A handler that returnednullptrto filter errors therefore also dropped transactions on Apple only. Other platforms never pass transactions tobefore_send.Key changes
beforeSendWithHintblock returns transactions (event.type == "transaction") unchanged, before the crash check and the user handler.-tracing-captureintegration tests (Desktop, Android, iOS) now set the sampleCppBeforeSendHandler. A new check asserts that the captured transaction doesn't carry the tag that handler adds.Related Items