fix(spring): [Data Collection 18] Bind key-value policies - #5834
fix(spring): [Data Collection 18] Bind key-value policies#5834adinauer wants to merge 27 commits into
Conversation
Generate the default Android installation ID after programmatic configuration and only when the resolved user information policy allows it. Preserve custom distinct IDs and keep legacy behavior when Data Collection is absent. Refs #5666 Co-Authored-By: Claude <noreply@anthropic.com>
Make KeyValueCollectionBehavior JavaBean-bindable so Spring Boot properties correctly configure cookie, header, and query policies. Cover binding across all supported Spring Boot generations. Co-Authored-By: Claude <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 369f0bb | 316.96 ms | 356.40 ms | 39.44 ms |
| 543680b | 325.17 ms | 471.02 ms | 145.85 ms |
| 1d4f70d | 365.04 ms | 441.86 ms | 76.81 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 369f0bb | 0 B | 0 B | 0 B |
| 543680b | 0 B | 0 B | 0 B |
| 1d4f70d | 0 B | 0 B | 0 B |
Previous results on branch: fix/data-collection-spring-binding
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6f6d5e3 | 307.56 ms | 352.77 ms | 45.21 ms |
| 62f0348 | 366.32 ms | 435.63 ms | 69.31 ms |
| a02f4d4 | 307.58 ms | 353.86 ms | 46.28 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6f6d5e3 | 0 B | 0 B | 0 B |
| 62f0348 | 0 B | 0 B | 0 B |
| a02f4d4 | 0 B | 0 B | 0 B |
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
Use the canonical URL query parameter property name in Spring Boot 2, 3, and 4 binding coverage. Refs #5666 Co-Authored-By: Claude <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
…to fix/data-collection-android-installation-id
…ata-collection-spring-binding
…to fix/data-collection-android-installation-id
This reverts commit b27d61d.\n\nKeep generated installation IDs independent of the userInfo policy. Restore\ndefault generation before programmatic configuration so applications can\ncontinue clearing the distinct ID in the configuration callback.\n\nRefs #5666\n\nCo-Authored-By: Claude <noreply@anthropic.com>
…ata-collection-spring-binding
Merge the conflict-resolved cookie policy through the remaining stacked branches. Co-Authored-By: Claude <noreply@anthropic.com>
| return mode; | ||
| } | ||
|
|
||
| public void setMode(final @NotNull Mode mode) { |
There was a problem hiding this comment.
Up until this PR, KeyValueCollectionBehavior was immutable. This is important because DataCollectionResolver holds two static final KeyValueCollectionBehaviors.
This means that users can modify the static singleton which is not a good idea.
I think we should rather keep this class immutable to prevent issues.
There was a problem hiding this comment.
Ah good catch!
Unfortunately this isn't easily possible for Spring Boot property binding. I will simply inline the static fields to call the factory methods directly.
Merge the latest changes from the preceding Data Collection branch. Co-Authored-By: Claude <noreply@anthropic.com>
Create key-value fallback behaviors for each resolver lookup so mutations cannot leak across cookie, query parameter, and header policies. Refs #5666 Co-Authored-By: Claude <noreply@anthropic.com>
Merge the latest changes from the preceding Data Collection branch. Co-Authored-By: Claude <noreply@anthropic.com>
Propagate the corrected OkHttp Set-Cookie fixture through the Data Collection PR stack. Co-Authored-By: Claude <noreply@anthropic.com>
PR Stack (Data Collection)
📜 Description
Make
KeyValueCollectionBehaviorJavaBean-bindable so Spring Boot can configure Data Collection policies for cookies, URL query parameters, and request/response headers.Add a public no-argument constructor with the default deny-list behavior and setters for
modeandterms. The existingoff,denyList, andallowListfactories remain available, and terms continue to be defensively copied into an immutable list.💡 Motivation and Context
Spring Boot could bind scalar Data Collection fields but silently ignored nested key-value policies because
KeyValueCollectionBehavioronly exposed private construction and immutable fields. A scalar property could therefore make the namespace explicit while the requested cookie, query, or header restriction was not applied.Refs #5666
💚 How did you test it?
./gradlew :sentry:test --tests io.sentry.KeyValueCollectionBehaviorTest :sentry-spring-boot:test --tests 'io.sentry.spring.boot.SentryAutoConfigurationTest.data collection key value properties are applied to SentryOptions' :sentry-spring-boot-jakarta:test --tests 'io.sentry.spring.boot.jakarta.SentryAutoConfigurationTest.data collection key value properties are applied to SentryOptions' :sentry-spring-boot-4:test --tests 'io.sentry.spring.boot4.SentryAutoConfigurationTest.data collection key value properties are applied to SentryOptions'./gradlew spotlessApply apiDumpgit diff --check📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Add the remaining external and Android manifest Data Collection configuration paths.
#skip-changelog