feat(android): [Data Collection 22] Add manifest configuration - #6038
Conversation
Parse flattened Data Collection metadata while preserving existing option values for fields omitted from the manifest. Expose internal configuration-state helpers across SDK modules so Android can distinguish absent metadata from explicit settings.\n\nRefs #5666\nCo-Authored-By: Claude <noreply@anthropic.com>
Semver Impact of This PR🟡 Minor (new features) 📋 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. |
|
📲 Install BuildsAndroid
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d3db9cd | 322.28 ms | 378.68 ms | 56.40 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d3db9cd | 0 B | 0 B | 0 B |
Previous results on branch: feat/data-collection-android-manifest
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 1348cdc | 299.44 ms | 362.44 ms | 63.00 ms |
| 3dd638d | 297.55 ms | 374.40 ms | 76.85 ms |
| 13cc829 | 359.30 ms | 425.77 ms | 66.47 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 1348cdc | 0 B | 0 B | 0 B |
| 3dd638d | 0 B | 0 B | 0 B |
| 13cc829 | 0 B | 0 B | 0 B |
…ollection-android-manifest
Merge the conflict-resolved cookie policy through the remaining stacked branches. Co-Authored-By: Claude <noreply@anthropic.com>
runningcode
left a comment
There was a problem hiding this comment.
hey sorry to block, but i think we need to rebase (see my note) before we can proceed with the review.
|
|
||
| public final class io/sentry/DataCollection { | ||
| public fun <init> ()V | ||
| public fun <init> (Z)V |
There was a problem hiding this comment.
weird, there's only one constructor. this makes it seem like there are two
There was a problem hiding this comment.
there are two ctors, so this seems correct:
public DataCollection() {
this(true);
}
@ApiStatus.Internal
public DataCollection(final boolean forceDataCollection) {
this.forceDataCollection = forceDataCollection;
}
There was a problem hiding this comment.
Second one has been made public now.
Merge the latest changes from the preceding Data Collection branch. Co-Authored-By: Claude <noreply@anthropic.com>
Merge the fallback behavior isolation fix from the preceding Data Collection branch. Co-Authored-By: Claude <noreply@anthropic.com>
Merge the latest changes from the preceding Data Collection branch and support both manifest metadata representations in Data Collection parsing. 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>
Propagate the OpenTelemetry span-description revert from the preceding stack branch. Co-Authored-By: Claude <noreply@anthropic.com>
| } | ||
|
|
||
| private static @Nullable DataCollection readDataCollection( | ||
| final @NotNull Object metadata, |
There was a problem hiding this comment.
perfect, this is now an Object. this should work together with the optimizations that Roman made.
Bring the latest base branch fixes into this stacked branch. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0b2763d. Configure here.
| final @NotNull Set<HttpBodyType> result = EnumSet.noneOf(HttpBodyType.class); | ||
| for (final String bodyType : bodyTypes) { | ||
| result.add(HttpBodyType.valueOf(bodyType.toUpperCase(Locale.ROOT))); | ||
| } |
There was a problem hiding this comment.
Untrimmed list values break parsing
Medium Severity
readHttpBodyTypes and readKeyValueCollectionBehavior pass readList items straight into valueOf and setTerms without trimming. A normal comma-separated manifest value with spaces fails enum parsing, the outer applyMetadata catch swallows it, and every Data Collection setting is left unapplied.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0b2763d. Configure here.


PR Stack (Data Collection)
📜 Description
Parse flattened Data Collection settings from Android manifest metadata.
Support user information, HTTP body directions, cookies, request and response headers, URL query parameters, GraphQL document and variables, and database query data. Apply only metadata fields that are present, preserving existing programmatic configuration and the unconfigured legacy state when the namespace is absent. Partial key-value settings preserve the existing mode or terms that were not specified.
Expose the internal
DataCollectionconstructor and explicit-configuration check so Android can parse metadata into an unconfigured temporary object before merging it transactionally.💡 Motivation and Context
Android applications commonly configure the SDK through
AndroidManifest.xml. Data Collection needs equivalent manifest support without replacing settings supplied through other configuration layers or accidentally opting legacy applications into the new defaults.Refs #5666
💚 How did you test it?
./gradlew :sentry:test --tests '*DataCollectionTest'./gradlew :sentry-android-core:testDebugUnitTest --tests '*ManifestMetadataReaderTest'./gradlew :sentry-android-core:check./gradlew spotlessApply apiDumpgit diff --check📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Add Spring Boot binding coverage and Data Collection configuration documentation in follow-up PRs.
#skip-changelog