Skip to content

Add integration with Session Replay product for Apple platforms - #1468

Merged
tustanivsky merged 7 commits into
mainfrom
feat/session-replay-env-cocoa
Jul 8, 2026
Merged

Add integration with Session Replay product for Apple platforms#1468
tustanivsky merged 7 commits into
mainfrom
feat/session-replay-env-cocoa

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

This PR adds Session Replay product integration for platforms where sentry-cocoa is used (macOS and iOS). The gameplay recorded in the rolling buffer before a crash is now delivered to Sentry as a separate session replay envelope (discoverable in the Replays dashboard and associated with the crash) instead of only being attached to the event as an MP4 file. This closes the macOS limitation noted in #1445 and extends the integration to iOS.

Since sentry-cocoa sends crash reports on the next application launch, the replay envelope is assembled in-process within the onLastRunStatusDetermined callback: the plugin reads the recorded MP4 and its JSON metadata sidecar, builds the replay_event/replay_recording payloads, packs them together with the video into a msgpack payload (same wire format as sentry-cocoa's own SentryMsgPackSerializer and the sentry-native implementation), and hands the envelope to the SDK for sending via the internal envelope API.

Example replay captured on macOS.

Key Changes

  • Added AppleSentryReplayEnvelope which builds the replay_video envelope from the recorded clip, its metadata sidecar, and the crash event from the previous app run, and captures it through sentry-cocoa's envelope API.
  • The replay event is enriched from the crash event's scope (tags, contexts, release, environment, dist, user) and the matching trace id so it correlates with the crash's events/spans; the replay window is anchored to the crash timestamp.
  • GetLatestSessionReplay now resolves both the replay video and its metadata sidecar, succeeding only when the latest pair belongs to the same replay.
  • Replay files (MP4 + JSON sidecar) are cleaned up explicitly after processing on both crash and no-crash launches (previously the metadata sidecar was left behind).
  • The replay clip remains attached to the crash event as an MP4 attachment (rollout parity with the sentry-native platforms).

Testing

  • Extended integration test checks for replay envelope capturing to Apple platforms.

Documentation

Related items

@github-actions

github-actions Bot commented Jul 8, 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 468f19c

@tustanivsky
tustanivsky marked this pull request as ready for review July 8, 2026 07:39
Comment thread plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit aa413ff. Configure here.

Comment thread plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp
Comment thread plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp
tustanivsky added a commit to getsentry/sentry-docs that referenced this pull request Jul 8, 2026
This PR updates the Unreal SDK Session Replay documentation now that the
feature is fully integrated with the corresponding Sentry product.

Related items:
- getsentry/sentry-unreal#1445
- getsentry/sentry-unreal#1468
@tustanivsky
tustanivsky merged commit 3325b47 into main Jul 8, 2026
98 of 100 checks passed
@tustanivsky
tustanivsky deleted the feat/session-replay-env-cocoa branch July 8, 2026 12:40
billyvg added a commit to getsentry/sentry that referenced this pull request Jul 8, 2026
…19235)

## What

Adds `sentry.cocoa.unreal` to the `getPath()` switch in
`configureReplayCard.tsx`, routing it to the same `apple/guides/ios`
docs path as `sentry.cocoa`.

## Why

`sentry-unreal` (see
[sentry-unreal#1468](getsentry/sentry-unreal#1468))
embeds the Cocoa SDK to provide Session Replay on iOS builds of Unreal
Engine games. That embedded SDK reports its name as
`sentry.cocoa.unreal`. Because this name wasn't in the `getPath()`
switch:

- Every affected page load hit the `default` branch, firing
`Sentry.captureMessage('Unknown mobile platform in configure card:
sentry.cocoa.unreal')`
- All three Configure Replay dropdown items (General / Masking /
Identify Users) were disabled for those sessions

The underlying replay implementation is the standard Cocoa SDK, so
`apple/guides/ios` is the correct docs target.

## Changes

- `configureReplayCard.tsx`: add `case 'sentry.cocoa.unreal':` as a
fall-through to `case 'sentry.cocoa':` with an explanatory comment
- `configureReplayCard.spec.tsx`: new test file covering
`sentry.cocoa.unreal` → enabled menu items and no `captureMessage`, plus
regression coverage for unknown SDK names

## Verification

TypeScript compiler not available in sandbox; relied on manual review of
the one-line fall-through change. CI will cover type checks and the new
spec.

Fixes JAVASCRIPT-3ARC


<!-- junior-session-footer:start -->

--

[View Junior Session in
Sentry](https://sentry.sentry.io/explore/conversations/slack%3AC013P75SQUB%3A1783512585.309359/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
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.

2 participants