chore: Add SDK features for beforeSend callbacks#3608
Draft
chore: Add SDK features for beforeSend callbacks#3608
Conversation
Register configured beforeSend callbacks as SDK features at SentryClient construction time. This lets us track which beforeSend APIs users have configured (beforeSendEvent, beforeSendTransaction, beforeSendFeedback, beforeSendLog, beforeSendMetric) without caring about invocation frequency. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3608 +/- ##
==========================================
+ Coverage 86.83% 86.96% +0.12%
==========================================
Files 320 320
Lines 10789 10799 +10
==========================================
+ Hits 9369 9391 +22
+ Misses 1420 1408 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Sentry Build Distribution
|
Contributor
Android Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f3771ea | 379.02 ms | 363.91 ms | -15.11 ms |
| 101a9c7 | 375.81 ms | 363.42 ms | -12.39 ms |
| 0fb3800 | 465.64 ms | 536.77 ms | 71.13 ms |
| 393f8ec | 360.07 ms | 362.70 ms | 2.64 ms |
| a10aff4 | 488.19 ms | 515.02 ms | 26.83 ms |
| fec56a1 | 370.66 ms | 369.28 ms | -1.38 ms |
| 944b773 | 470.54 ms | 480.18 ms | 9.64 ms |
| 53356d8 | 394.48 ms | 400.70 ms | 6.22 ms |
| 1777727 | 438.67 ms | 447.11 ms | 8.44 ms |
| 6e7d494 | 397.35 ms | 378.91 ms | -18.43 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f3771ea | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 101a9c7 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 0fb3800 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 393f8ec | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| a10aff4 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| fec56a1 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 944b773 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 53356d8 | 14.09 MiB | 15.28 MiB | 1.19 MiB |
| 1777727 | 14.30 MiB | 15.49 MiB | 1.19 MiB |
| 6e7d494 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
Previous results on branch: chore/add-sdk-to-feature-for-beforesend
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| cf5c86e | 431.48 ms | 436.42 ms | 4.94 ms |
| 6d251b8 | 393.08 ms | 388.85 ms | -4.23 ms |
| 818b360 | 436.56 ms | 436.38 ms | -0.18 ms |
| 1f6d08f | 402.14 ms | 408.65 ms | 6.50 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| cf5c86e | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 6d251b8 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 818b360 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 1f6d08f | 14.31 MiB | 15.49 MiB | 1.19 MiB |
Contributor
iOS Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7cfbbd6 | 1270.63 ms | 1285.36 ms | 14.72 ms |
| e2d675d | 1238.48 ms | 1242.76 ms | 4.28 ms |
| e0c8591 | 1259.85 ms | 1257.31 ms | -2.54 ms |
| 1ce780b | 1252.49 ms | 1256.17 ms | 3.68 ms |
| d0aa4b6 | 1268.23 ms | 1268.39 ms | 0.15 ms |
| 3801d52 | 1267.76 ms | 1266.10 ms | -1.65 ms |
| c97f488 | 1247.40 ms | 1252.13 ms | 4.73 ms |
| fd88186 | 1255.06 ms | 1252.76 ms | -2.30 ms |
| aeb02f2 | 1244.29 ms | 1256.55 ms | 12.26 ms |
| c26ed0a | 1244.11 ms | 1263.85 ms | 19.75 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7cfbbd6 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| e2d675d | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| e0c8591 | 5.53 MiB | 5.96 MiB | 444.86 KiB |
| 1ce780b | 5.66 MiB | 6.10 MiB | 451.58 KiB |
| d0aa4b6 | 5.53 MiB | 6.02 MiB | 502.04 KiB |
| 3801d52 | 5.73 MiB | 6.17 MiB | 455.54 KiB |
| c97f488 | 5.73 MiB | 6.17 MiB | 455.48 KiB |
| fd88186 | 5.53 MiB | 6.00 MiB | 479.94 KiB |
| aeb02f2 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| c26ed0a | 5.53 MiB | 5.97 MiB | 453.76 KiB |
Previous results on branch: chore/add-sdk-to-feature-for-beforesend
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6d251b8 | 1245.80 ms | 1250.63 ms | 4.83 ms |
| 818b360 | 1237.47 ms | 1245.49 ms | 8.02 ms |
| cf5c86e | 1227.80 ms | 1240.52 ms | 12.72 ms |
| 1f6d08f | 1257.94 ms | 1263.27 ms | 5.33 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6d251b8 | 5.73 MiB | 6.17 MiB | 455.50 KiB |
| 818b360 | 5.73 MiB | 6.17 MiB | 455.50 KiB |
| cf5c86e | 5.73 MiB | 6.17 MiB | 455.50 KiB |
| 1f6d08f | 5.73 MiB | 6.17 MiB | 455.50 KiB |
…ants Move inline feature string literals to a dedicated SentryFeatures class in constants.dart for reuse as more features are added. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Already provided by the sentry.dart barrel export. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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
Register configured
beforeSendcallbacks as SDK features atSentryClientconstruction time. When a user configures any of the beforeSend callbacks, the corresponding feature string is added viasdk.addFeature():beforeSend→beforeSendEventbeforeSendTransaction→beforeSendTransactionbeforeSendFeedback→beforeSendFeedbackbeforeSendLog→beforeSendLogbeforeSendMetric→beforeSendMetricSince
addFeaturededuplicates, re-creating the client is safe.💡 Motivation and Context
This lets us track which beforeSend APIs users have configured as SDK metadata, without needing to know how often the callbacks are actually invoked.
💚 How did you test it?
Added 6 unit tests in
sentry_client_test.dartcovering:📝 Checklist
sendDefaultPiiis enabled🔮 Next steps
#skip-changelog