feat: add Hints API for beforeSend callbacks - #8942
Merged
Merged
Conversation
Contributor
|
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| fc4e913 | 1231.79 ms | 1267.89 ms | 36.11 ms |
| 6f28fd8 | 1229.98 ms | 1271.73 ms | 41.75 ms |
| a7c42d9 | 1217.25 ms | 1253.98 ms | 36.73 ms |
| 230cc86 | 1225.33 ms | 1258.67 ms | 33.34 ms |
| 5556249 | 1208.87 ms | 1246.60 ms | 37.72 ms |
| 8ed81c1 | 1227.47 ms | 1249.24 ms | 21.77 ms |
| 92fada5 | 1217.60 ms | 1252.89 ms | 35.30 ms |
| 6d9f89d | 1226.37 ms | 1260.94 ms | 34.57 ms |
| 318f8af | 1213.09 ms | 1246.21 ms | 33.13 ms |
| 01ffe09 | 1208.52 ms | 1240.94 ms | 32.42 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| fc4e913 | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 6f28fd8 | 24.14 KiB | 1.30 MiB | 1.28 MiB |
| a7c42d9 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 230cc86 | 24.14 KiB | 1.25 MiB | 1.23 MiB |
| 5556249 | 24.14 KiB | 1.29 MiB | 1.27 MiB |
| 8ed81c1 | 24.14 KiB | 1.23 MiB | 1.21 MiB |
| 92fada5 | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 6d9f89d | 24.14 KiB | 1.26 MiB | 1.23 MiB |
| 318f8af | 24.14 KiB | 1.30 MiB | 1.28 MiB |
| 01ffe09 | 24.14 KiB | 1.29 MiB | 1.27 MiB |
Add a Hint class that provides metadata about the origin of an event (original error/exception, attachments, key-value data) flowing alongside events through the capture pipeline. New beforeSendWithHint and beforeBreadcrumbWithHint callbacks take precedence over their existing counterparts. The WithHint variants are deprecated and will be removed in v10 when the hint parameter is added to beforeSend/beforeBreadcrumb directly.
itaybre
force-pushed
the
feat/hints-api
branch
from
September 3, 2026 20:16
6ce73f0 to
dd59e88
Compare
philprime
reviewed
Sep 4, 2026
philprime
left a comment
Member
There was a problem hiding this comment.
Left some early review comments to consider
5 tasks
Guard Hint state with SentryMutex instead of NSLock, and deprecate the WithHint callback setters via @available and DEPRECATED_MSG_ATTRIBUTE, since the hint parameter moves into beforeSend/beforeBreadcrumb in the next major version. Pre-populate hint.attachments with the scope attachments before beforeSendWithHint runs and treat the hint list as authoritative afterwards, so the callback can remove attachments as well as add them. Add concurrency tests for Hint and attachment add/remove coverage for the client.
itaybre
marked this pull request as ready for review
September 5, 2026 01:04
itaybre
requested review from
a team,
NinjaLikesCheez and
noahsmartin
as code owners
September 5, 2026 01:04
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6a2b13b. Configure here.
NinjaLikesCheez
approved these changes
Sep 7, 2026
NinjaLikesCheez
left a comment
Member
There was a problem hiding this comment.
LGTM without superseding Phil's comment :)
Remove misplaced comment and fix nil-check style for consistency with the rest of the file.
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.

Add a Hints API that gives
beforeSendandbeforeBreadcrumbcallbacks access to the raw source material of an event: the originalNSErrororNSExceptionthat triggered the capture, the attachments that will be sent with the event, and generic key-value storage. The newHintclass (SentryHintin ObjC) is threaded through the entire capture pipeline inSentryClientandSentryHub, and is exposed through the newbeforeSendWithHintandbeforeBreadcrumbWithHintcallbacks, which take precedence overbeforeSend/beforeBreadcrumbwhen both are set. The ObjC wrapper surface gets a matchingSentryObjCHinttype and callback properties.Attachments can be added and removed
Before
beforeSendWithHintruns, the SDK pre-populateshint.attachmentswith the attachments that will be sent with the event (the scope's attachments, filtered for fatal events). The list left in the hint when the callback returns is what the SDK sends, so the callback can add and remove attachments, as proposed in #1460.The WithHint callbacks ship deprecated
They are transitional API: in v10 the hint parameter will be added to
beforeSend/beforeBreadcrumbdirectly and theWithHintvariants will be removed. The deprecation is on the setters only (via@availableandDEPRECATED_MSG_ATTRIBUTE), so adopters get the warning while the SDK's internal reads stay clean.Hintguards its state withSentryMutex, so it is safe to read and write from any queue.Refs #1460