feat: Add dataCollection option and types#8369
Merged
Merged
Conversation
Add SentryDataCollection types under experimental options: - Options, KeyValueCollectionBehavior, HttpBodyType, HttpHeaderCollectionOptions, GraphQLCollectionOptions, DatabaseOptions - SentryObjC headers and SentryObjCCompat wrappers - Tests for Swift, ObjC, and ObjCCompat layers
Contributor
|
Member
Author
|
@sentry review |
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 316162b | 1222.17 ms | 1250.22 ms | 28.05 ms |
| ec88236 | 1219.04 ms | 1253.69 ms | 34.65 ms |
| 2b9ab0a | 1238.00 ms | 1270.06 ms | 32.06 ms |
| d4b3feb | 1228.86 ms | 1263.12 ms | 34.26 ms |
| 5a9c804 | 1220.29 ms | 1255.17 ms | 34.88 ms |
| c5a3e1c | 1226.65 ms | 1263.67 ms | 37.02 ms |
| 1936da3 | 1223.18 ms | 1253.96 ms | 30.78 ms |
| a48979e | 1244.58 ms | 1269.00 ms | 24.42 ms |
| 1504336 | 1235.10 ms | 1266.90 ms | 31.79 ms |
| 6b08499 | 1216.67 ms | 1247.76 ms | 31.08 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 316162b | 24.14 KiB | 1.18 MiB | 1.15 MiB |
| ec88236 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 2b9ab0a | 24.14 KiB | 1.16 MiB | 1.14 MiB |
| d4b3feb | 24.14 KiB | 1.17 MiB | 1.14 MiB |
| 5a9c804 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| c5a3e1c | 24.14 KiB | 1.23 MiB | 1.20 MiB |
| 1936da3 | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| a48979e | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 1504336 | 24.14 KiB | 1.19 MiB | 1.17 MiB |
| 6b08499 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
Previous results on branch: feat/datacollection-types-and-bridge
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ba36999 | 1233.60 ms | 1262.36 ms | 28.75 ms |
| 5380830 | 1229.60 ms | 1261.31 ms | 31.72 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ba36999 | 24.14 KiB | 1.23 MiB | 1.21 MiB |
| 5380830 | 24.14 KiB | 1.23 MiB | 1.21 MiB |
Introduce Accessor<T> to replace Box<T> in wrappers that need read-write access through a parent reference. This ensures options.experimental.dataCollection.userInfo = NO (and deeper nesting like .database.queryParams) propagates correctly instead of mutating an ephemeral copy.
Store standalone Accessor values directly instead of routing through Box. Use a writable key path initializer for class-backed properties and cover Accessor behavior with ObjCCompat unit tests.
NinjaLikesCheez
approved these changes
Jul 8, 2026
NinjaLikesCheez
left a comment
Member
There was a problem hiding this comment.
LGTM, one small naming comment that doesn't need to be addressed
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.
Summary
SentryDataCollectiontypes following the Data Collection Spec:Options,KeyValueCollectionBehavior,HttpBodyType,HttpHeaderCollectionOptions,GraphQLCollectionOptions,DatabaseOptionsdataCollectionunderoptions.experimental.dataCollectionso fields can be adjusted or removed before stabilizationAccessor<T>— a read-write counterpart toBox<T>— so that in-place mutations from Objective-C propagate correctly through nested struct wrappers (e.g.options.experimental.dataCollection.database.queryParams = NOwrites through to the parent instead of mutating an ephemeral copy)Box<T> vs Accessor<T>
Box<T>exists solely for ABI layout — it makes a resilient value type pointer-sized so the compiler can emit a static_OBJC_CLASS_$_symbol. It is immutable (let value) by design because it is used by wrappers that only need to read (e.g.SentryObjCKeyValueCollectionBehavior, which has no setters).Accessor<T>adds read-write closures for the mutation propagation problem. It wraps inBox<T>internally for standalone storage, so it also handles the ABI concern. Wrappers that need in-place mutation from ObjC (likeSentryObjCDataCollectionOptionsand its nested types) useAccessor<T>instead ofBox<T>.A future consolidation into just
Accessor<T>everywhere is possible — read-only wrappers would simply never call the setter — but for now the split preserves intent clarity:Box<T>= immutable,Accessor<T>= read-write.References #8242
Test plan
make build-iospassesmake build-xcframework-sentryobjc-static SDKS=iphonesimulator,macosxpassesmake test-macos— Swift, ObjC, and ObjCCompat data collection tests pass (43 ObjC tests including 4 in-place mutation propagation tests)make generate-public-apiregenerated and committed