Skip to content

feat: expose v10 replay buffering state - #8864

Draft
denrase wants to merge 5 commits into
mainfrom
feat/hybrid-replay-buffering-state
Draft

denrase wants to merge 5 commits into
mainfrom
feat/hybrid-replay-buffering-state

Conversation

@denrase

@denrase denrase commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

📜 Description

  • In Sentry V10, read replayId from the active Session Replay integration so it is available in session and buffer modes.
  • Expose isBuffering through the Swift and Objective-C hybrid SDK APIs in V10.
  • Keep V9 scope-based replay ID behavior and API surface unchanged.
  • Synchronize replay identity and mode reads and document the V10 hybrid SDK upgrade requirements.

💡 Motivation and Context

Hybrid SDKs need the active replay ID to associate logs, metrics, and spans while Session Replay is buffering. Buffered associations must also include sentry._internal.replay_is_buffering = true, because the replay may never be captured and uploaded.

In V10, a non-nil replayId therefore no longer implies that a full-session replay is running or that a buffered replay was captured. Hybrid SDKs upgrading to V10 must consume isBuffering alongside replayId and must not write buffered IDs to scope. V9 remains unchanged.

Related Dart migration issue: getsentry/sentry-dart#3796

💚 How did you test it?

  • make format
  • make analyze
  • make generate-public-api
  • 130 targeted V9 Swift replay tests on iOS 26.5
  • 138 targeted V10 Swift replay tests on iOS 26.5
  • 15 targeted V9 Objective-C replay API tests on iOS 26.5
  • V10 Objective-C wrapper and API surface built during public API generation

📝 Checklist

  • 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.
  • If I added a new public API, I also added it to the SentryObjC wrapper.

#skip-changelog

Read replay IDs from the active integration so hybrid SDKs can
associate telemetry while Session Replay is buffering.

Expose the buffering mode separately so consumers can mark buffered
replay associations correctly. Document the behavior change for
hybrid SDK upgrades.
@github-actions

github-actions Bot commented Aug 25, 2026

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 c585174

@denrase
denrase requested a review from buenaflor August 25, 2026 09:07
@denrase

denrase commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@buenaflor Turns out we did not have the API on the cocoa side we need. We could also add this to v10 sentry instead, as this is a breaking change for hybrid SDKs.

@buenaflor

Copy link
Copy Markdown
Contributor

@denrase doing this in v10 is also fine for me

@denrase

denrase commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@philprime Would you agree that this also fits more in v10 cocoa, as it is a breaking change for hybrid SDKs?

Keep the v9 replay ID scope-based and expose buffering state only in v10. Move the changelog entry and public API snapshots to the v10 variants.
@denrase denrase changed the title feat: expose replay buffering state feat: expose v10 replay buffering state Aug 25, 2026
@denrase denrase added the run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request label Aug 25, 2026
@denrase denrase self-assigned this Aug 25, 2026
@denrase
denrase marked this pull request as ready for review August 25, 2026 14:24
@sentry

sentry Bot commented Aug 25, 2026

Copy link
Copy Markdown

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
SDK-Size io.sentry.sample.SDK-Size 9.26.0 (1) Release

⚙️ sentry-cocoa Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1233.50 ms 1259.84 ms 26.34 ms
Size 24.14 KiB 1.30 MiB 1.28 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
be4ef1e 1226.57 ms 1259.87 ms 33.30 ms
4f45d12 1222.45 ms 1260.36 ms 37.91 ms
b69e199 1210.45 ms 1251.13 ms 40.68 ms
49cc12d 1227.33 ms 1263.21 ms 35.89 ms
a29e132 1225.98 ms 1258.31 ms 32.34 ms
fd08fa6 1213.43 ms 1256.65 ms 43.22 ms
6b08499 1216.67 ms 1247.76 ms 31.08 ms
faafa93 1214.88 ms 1248.02 ms 33.14 ms
53773e2 1226.96 ms 1261.50 ms 34.54 ms
ed33915 1231.46 ms 1259.48 ms 28.02 ms

App size

Revision Plain With Sentry Diff
be4ef1e 24.14 KiB 1.23 MiB 1.21 MiB
4f45d12 24.14 KiB 1.29 MiB 1.27 MiB
b69e199 24.14 KiB 1.24 MiB 1.22 MiB
49cc12d 24.14 KiB 1.16 MiB 1.13 MiB
a29e132 24.14 KiB 1.18 MiB 1.15 MiB
fd08fa6 24.14 KiB 1.26 MiB 1.23 MiB
6b08499 24.14 KiB 1.15 MiB 1.13 MiB
faafa93 24.14 KiB 1.29 MiB 1.27 MiB
53773e2 24.14 KiB 1.23 MiB 1.21 MiB
ed33915 24.14 KiB 1.20 MiB 1.17 MiB

@NinjaLikesCheez NinjaLikesCheez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, couple comments nothing blocking

@@ -9,11 +9,15 @@ public struct SentryInternalReplayApi {

typealias Dependencies = HubProvider & ReplayIntegrationProviderProvider

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m: should HubProvider be guarded with !SDK_V10 too?

state.isFullSession = true
return state.sessionReplayId
}
guard let replayId = replayId else { return }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l:

Suggested change
guard let replayId = replayId else { return }
guard let replayId else { return }

Comment on lines +393 to +398
let replay = sessionReplayReference.withLock { replay in
defer { replay = nil }
return replay
}
replay?.pause()
removeBackgroundForegroundObservers()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason not to call pause() inside the lock? The pattern is fine, it just reads a little odd so I thought I'd ask as I'm not sure :)

@denrase
denrase marked this pull request as draft September 1, 2026 15:10
@github-actions github-actions Bot removed the approved label Sep 1, 2026
@denrase

denrase commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

Put this back to draft, as it most likely needs re-evaluation in light of new Start/Stop APIs. Linking PRs below for context.

getsentry/sentry-docs#19143
#8865
#8868
#8887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request v10 Change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants