Skip to content

Keep transactions out of BeforeSend handler on Apple - #1610

Merged
tustanivsky merged 2 commits into
mainfrom
fix/apple-transactions-before-send
Oct 2, 2026
Merged

tustanivsky merged 2 commits into
mainfrom
fix/apple-transactions-before-send

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

This PR stops the BeforeSend handler from receiving transactions on macOS and iOS.

The bundled sentry-cocoa build calls beforeSendWithHint for every event except feedback, transactions included. sentry-cocoa only skips transactions there in SDK_V10 builds. The plugin passed them on to the user's USentryBeforeSendHandler as regular events. A handler that returned nullptr to filter errors therefore also dropped transactions on Apple only. Other platforms never pass transactions to before_send.

Key changes

  • The beforeSendWithHint block returns transactions (event.type == "transaction") unchanged, before the crash check and the user handler.
  • The -tracing-capture integration tests (Desktop, Android, iOS) now set the sample CppBeforeSendHandler. A new check asserts that the captured transaction doesn't carry the tag that handler adds.

Related Items

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.
@tustanivsky
tustanivsky merged commit 6b7d844 into main Oct 2, 2026
62 checks passed
@tustanivsky
tustanivsky deleted the fix/apple-transactions-before-send branch October 2, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants