Skip to content

feat: Add dataCollection option and types#8369

Merged
philprime merged 6 commits into
mainfrom
feat/datacollection-types-and-bridge
Jul 9, 2026
Merged

feat: Add dataCollection option and types#8369
philprime merged 6 commits into
mainfrom
feat/datacollection-types-and-bridge

Conversation

@philprime

@philprime philprime commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds SentryDataCollection types following the Data Collection Spec: Options, KeyValueCollectionBehavior, HttpBodyType, HttpHeaderCollectionOptions, GraphQLCollectionOptions, DatabaseOptions
  • Places dataCollection under options.experimental.dataCollection so fields can be adjusted or removed before stabilization
  • Adds SentryObjC headers and SentryObjCCompat Swift wrappers for the full type surface
  • Introduces Accessor<T> — a read-write counterpart to Box<T> — so that in-place mutations from Objective-C propagate correctly through nested struct wrappers (e.g. options.experimental.dataCollection.database.queryParams = NO writes through to the parent instead of mutating an ephemeral copy)
  • Tests across Swift, ObjC, and ObjCCompat layers

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 in Box<T> internally for standalone storage, so it also handles the ABI concern. Wrappers that need in-place mutation from ObjC (like SentryObjCDataCollectionOptions and its nested types) use Accessor<T> instead of Box<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-ios passes
  • make build-xcframework-sentryobjc-static SDKS=iphonesimulator,macosx passes
  • make test-macos — Swift, ObjC, and ObjCCompat data collection tests pass (43 ObjC tests including 4 in-place mutation propagation tests)
  • make generate-public-api regenerated and committed

philprime added 2 commits July 7, 2026 17:04
Add SentryDataCollection types under experimental options:
- Options, KeyValueCollectionBehavior, HttpBodyType,
  HttpHeaderCollectionOptions, GraphQLCollectionOptions,
  DatabaseOptions
- SentryObjC headers and SentryObjCCompat wrappers
- Tests for Swift, ObjC, and ObjCCompat layers
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 38afe43

@philprime

Copy link
Copy Markdown
Member Author

@sentry review

@philprime philprime added the ready-to-merge Use this label to trigger all PR workflows label Jul 7, 2026
Comment thread Sources/SentryObjCCompat/SentryObjCExperimentalOptions.swift
@sentry

sentry Bot commented Jul 7, 2026

Copy link
Copy Markdown

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
SDK-Size io.sentry.sample.SDK-Size 9.20.0 (1) Release

⚙️ sentry-cocoa Build Distribution Settings

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1223.09 ms 1254.67 ms 31.58 ms
Size 24.14 KiB 1.23 MiB 1.21 MiB

Baseline results on branch: main

Startup times

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

philprime added 2 commits July 7, 2026 17:57
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.
@philprime philprime marked this pull request as ready for review July 8, 2026 07:53

@NinjaLikesCheez NinjaLikesCheez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one small naming comment that doesn't need to be addressed

Comment thread Sources/SentryObjCCompat/Utils/Accessor.swift
@philprime philprime self-assigned this Jul 8, 2026
@github-actions github-actions Bot removed the approved label Jul 8, 2026
@philprime philprime enabled auto-merge (squash) July 9, 2026 07:49
@philprime philprime merged commit be4ef1e into main Jul 9, 2026
301 of 304 checks passed
@philprime philprime deleted the feat/datacollection-types-and-bridge branch July 9, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants