Skip to content

fix(core): [Data Collection 27] Make opt-in explicit - #6122

Open
adinauer wants to merge 2 commits into
feat/data-collectionfrom
fix/data-collection-explicit-opt-in
Open

adinauer wants to merge 2 commits into
feat/data-collectionfrom
fix/data-collection-explicit-opt-in

Conversation

@adinauer

@adinauer adinauer commented Sep 16, 2026

Copy link
Copy Markdown
Member

PR Stack (Data Collection)


📜 Description

Make an empty DataCollection neutral and add forceDataCollection() as the explicit way to opt into the documented Data Collection defaults without configuring an individual option.

Remove the internal boolean constructor and update SDK-owned configuration objects to use the neutral no-argument constructor. Keep SentryOptions.setDataCollection(...), but document that replacing the object discards options already configured on that instance.

💡 Motivation and Context

Constructing and assigning an empty DataCollection previously activated the new defaults while replacing values already loaded from external configuration or Android manifest metadata. Calling options.getDataCollection().forceDataCollection() now activates those defaults on the existing object, preserving configuration from other sources.

Refs #5666

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • Focused DataCollectionTest, DataCollectionResolverTest, SentryOptionsTest, and ExternalOptionsTest runs
  • ./gradlew :sentry-android-core:testReleaseUnitTest --tests 'io.sentry.android.core.ManifestMetadataReaderTest'
  • ./gradlew :sentry:apiCheck
  • git diff --check

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Complete final review of the Data Collection collection PR.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

Stop treating DataCollection construction as an implicit opt-in. Add an explicit forceDataCollection method so callers can select the new defaults without replacing manifest or external configuration.

Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Sep 16, 2026
@sentry

sentry Bot commented Sep 16, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.56.0 (1) release

⚙️ sentry-android Build Distribution Settings

@adinauer
adinauer marked this pull request as ready for review September 16, 2026 13:41
@adinauer
adinauer requested a review from romtsn as a code owner September 16, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant