Repository navigation
feat: DataCollection now configures the native Android SDK, and UserInfo the native Cocoa SDK - #5960
Open
jamescrosswell wants to merge 1 commit into
Open
jamescrosswell wants to merge 1 commit into
jamescrosswell wants to merge 1 commit into
Conversation
When an app calls ConfigureDataCollection, map the configured categories onto sentry-java's DataCollection, setting userInfo explicitly so Java doesn't default it to true. sentry-cocoa 9.x only ships dataCollection in SDK V10, so Cocoa gets the resolved UserInfo as sendDefaultPii, which is the only thing 9.x gates on it. Apps that don't opt in still forward only SendDefaultPii. Refs #5436 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5960 +/- ##
=======================================
Coverage 77.70% 77.70%
=======================================
Files 535 535
Lines 19731 19731
Branches 3934 3934
=======================================
Hits 15332 15332
Misses 3544 3544
Partials 855 855 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
@ric-oliv sentry-cocoa v10 hasn't been released yet. So I think we look at applying the .NET data collections to the cocoa ones whenever v10 is released and when we bump to that. |
This branch has not been deployed
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.
When an app calls
ConfigureDataCollection(...), the native SDKs now follow it too.DataCollection:UserInfo,Cookies,HttpHeaders.Request/.Response,UrlQueryParams(mode and terms),HttpBodies(each of the four body types), andGraphQL.Document/.Variables.UserInfogoes to Cocoa assendDefaultPii. sentry-cocoa 9.x has no data collection option to map onto (see the notes), and user info is the only thing 9.x gates onsendDefaultPii.Apps that never call
ConfigureDataCollectionsee no change. Both platforms forward onlySendDefaultPii, as before, and Java'sDataCollectionis left unset.Part of #5420 (Phase 2).
Closes #5436
Behaviour
SendDefaultPiiand Java'sDataCollection.isExplicitlyConfigured()staysfalse. Cocoa getsSendDefaultPii.ConfigureDataCollection(...)called: Android still forwardsSendDefaultPii, but Java's resolver ignores it for every category this sets. Cocoa getsUserInfoassendDefaultPii. So an app that opts in with the spec defaults andSendDefaultPii = falsenow getsuserInfo = truenatively too: both native SDKs infer the IP address for native events, and Cocoa adds the installation ID as the user ID on native logs and metrics.Notes for review
dataCollection, so there was nothing to bind. It arrived in 9.22.0 (feat: Add dataCollection option and types sentry-cocoa#8369) and went behind theSDK_V10compile flag in 9.23.0 (ref(data-collection)!: gate APIs to SDK V10 sentry-cocoa#8435). In 9.35.0 theSentryObjCDataCollection*headers,SentryObjCOptions.dataCollectionand the SwiftSentryDataCollectioncore are all inside#if SDK_V10.build-sentry-cocoa.shdoesn't define it, andnmfinds noDataCollectionsymbol in the framework we ship.patch-cocoa-bindings.csand the generated bindings are unchanged. DefiningSDK_V10would switch the whole Cocoa SDK to its next major.sendDefaultPiigates three things: IP inference (SentrySdkInfo) and the installation-ID user on logs (SentryClient) and on metrics (SentryMetricsIntegration). V10 replaces each of those reads withdataCollection.userInfo, so forwardingUserInfothere is what V10 would do.NSURLSessionfailed-request capture (on whenCaptureFailedRequestsis) applies its fixed header and URL sanitising, whateverCookies,HttpHeadersorUrlQueryParamssay. Binding the real types can follow once the Cocoa SDK we ship is V10.userInfois always set explicitly on Android. In sentry-java, setting anyDataCollectionfield makes an unsetuserInforesolve totrue. A test coversUserInfo = falsewithSendDefaultPii = true.filePathsresolves totrue. It gates file paths on spans fromSentryFileInputStream/SentryFileOutputStream.databaseQueryDataalso resolves totrue, and nothing in sentry-java 8.64.0 reads it. The mapping updates Java'sDataCollectionin place rather than replacing it, so values set throughAndroidManifest.xmlmetadata survive.DatabaseQueryDataisn't mapped from .NET, because ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data #5933 removes it.GenAIhas no Java or Cocoa counterpart. It only gatesSentry.Extensions.AI, which is managed code.DataCollectionwith every category off, and checks that the replay options haven't changed.SentrySdk.Init. Later changes toDataCollectionreach only the managed integrations.user.id/device.idisn't governed by data collection in sentry-java, so this doesn't change it.🤖 Generated with Claude Code