Skip to content

feat(replay): [Data Collection 16] Inherit network collection policy#5832

Draft
adinauer wants to merge 1 commit into
fix/data-collection-device-info-optionsfrom
feat/data-collection-session-replay-network-options
Draft

feat(replay): [Data Collection 16] Inherit network collection policy#5832
adinauer wants to merge 1 commit into
fix/data-collection-device-info-optionsfrom
feat/data-collection-session-replay-network-options

Conversation

@adinauer

@adinauer adinauer commented Jul 24, 2026

Copy link
Copy Markdown
Member

PR Stack (Data Collection)


📜 Description

Make Session Replay network body and header options nullable overrides that can inherit the global Data Collection policy.

Explicit Replay options remain authoritative. When a Replay option is unset and Data Collection is configured, request and response headers inherit their matching httpHeaders behavior, while bodies inherit the matching outgoing-request and incoming-response body settings. If Data Collection is absent, Replay preserves its historical defaults: body capture enabled and the Content-Type, Content-Length, and Accept header allow-list.

Add KeyValueCollectionBehavior Replay APIs for header policies while retaining deprecated list-based APIs for compatibility. Apply effective policies to OkHttp Replay network details and preserve the existing RRWeb options payload shape.

Android manifest options now preserve nullable inheritance when metadata is absent and continue to take precedence when explicitly configured.

💡 Motivation and Context

Session Replay previously maintained independent network defaults, so opting into Data Collection did not consistently control network content included in recordings. Nullable Replay overrides provide an explicit precedence model without breaking the existing primitive and list-based Java APIs.

The Replay URL allow and deny lists remain independent eligibility controls. Data Collection only determines which content an eligible request may serialize.

Refs #5666

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry:apiCheck :sentry:test --tests='io.sentry.SentryReplayOptionsTest' --tests='io.sentry.util.network.NetworkDetailCaptureUtilsTest' --tests='io.sentry.rrweb.RRWebOptionsEventSerializationTest' :sentry-okhttp:test --tests='io.sentry.okhttp.SentryOkHttpInterceptorTest' :sentry-android-core:testDebugUnitTest --tests='io.sentry.android.core.ManifestMetadataReaderTest'
  • 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

Coordinate richer RRWeb options metadata if Sentry needs to distinguish directional body policies and non-allow-list header behaviors.

#skip-changelog

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

Let nullable Session Replay network options inherit matching Data Collection settings while preserving historical Replay defaults when Data Collection is absent. Keep explicit Replay options authoritative and apply the effective policies to OkHttp network details.

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 f83d56c

optionsPayload.put("networkRequestHeaders", replayOptions.getNetworkRequestHeaders());
optionsPayload.put("networkResponseHeaders", replayOptions.getNetworkResponseHeaders());
optionsPayload.put("networkCaptureBodies", replayOptions.isNetworkCaptureBodies());
final @NotNull KeyValueCollectionBehavior requestHeaders =

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class needs some discussion, can we somehow send whether OFF / DENY or ALLOW was used?

@sentry

sentry Bot commented Jul 24, 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 358.20 ms 437.48 ms 79.28 ms
Size 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