Skip to content

feat(core): [Data Collection 2] Expose SentryOptions API#5761

Draft
adinauer wants to merge 1 commit into
feat/data-collection-foundationfrom
feat/data-collection-options
Draft

feat(core): [Data Collection 2] Expose SentryOptions API#5761
adinauer wants to merge 1 commit into
feat/data-collection-foundationfrom
feat/data-collection-options

Conversation

@adinauer

@adinauer adinauer commented Jul 14, 2026

Copy link
Copy Markdown
Member

PR Stack (Data Collection)


📜 Description

Expose the Data Collection configuration model through SentryOptions:

  • Add an always-present DataCollection instance initialized in the unconfigured state
  • Add public getDataCollection() and setDataCollection(...) accessors
  • Preserve explicit-empty semantics for customer-created DataCollection objects
  • Keep getter-only access unconfigured so the compatibility bridge can distinguish absence from opt-in

This PR only exposes and stores the configuration. It does not resolve effective policies or change runtime collection behavior.

💡 Motivation and Context

Customers need a non-null, mutable configuration object so individual data-collection categories can be configured without first constructing the namespace. At the same time, the SDK must distinguish users who did not configure Data Collection from users who explicitly supplied an empty object and opted into the specification defaults.

Refs #5666

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry:check
  • Added unit coverage for the unconfigured default, stable getter behavior, nested overrides, explicit-empty assignment, and replacing the default object.

📝 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.

🔮 Next steps

Add centralized policy resolution and the legacy sendDefaultPii compatibility bridge, then wire configuration sources and integrations in subsequent stack PRs.

#skip-changelog

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

Add an always-present DataCollection object to SentryOptions while preserving an unconfigured state for the legacy bridge. Expose public getter and setter APIs and cover explicit-empty and nested override behavior.

Refs #5666

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

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 a337d9e

@sentry

sentry Bot commented Jul 14, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 313.83 ms 365.16 ms 51.33 ms
Size 0 B 0 B 0 B

Baseline results on branch: feat/data-collection-foundation

Startup times

Revision Plain With Sentry Diff
c6eb158 302.35 ms 335.00 ms 32.65 ms
18d67ea 305.81 ms 362.25 ms 56.44 ms

App size

Revision Plain With Sentry Diff
c6eb158 0 B 0 B 0 B
18d67ea 0 B 0 B 0 B

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