Skip to content

feat(replay): Populate trace_ids in mobile replay events - #6786

Merged
antonis merged 1 commit into
mainfrom
feat/replay-trace-ids
Sep 25, 2026
Merged

antonis merged 1 commit into
mainfrom
feat/replay-trace-ids

Conversation

@antonis

@antonis antonis commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

The mobileReplayIntegration now forwards the trace id of each sent event to the native Session Replay, so the current segment carries it under trace_ids. This makes React Native mobile replays discoverable when searching by trace id in Explore, matching web replay and the native SDKs.

Implementation is a thin forward across the JS↔native bridge:

  • JS — a new afterSendEvent step reads event.contexts.trace.trace_id and forwards it via a new NATIVE.registerReplayTraceId(traceId) seam. Only forwards while a replay is recording (guarded by the cached replay id); the collection logic lives in a small replay/replayTraceIds.ts module.
  • Bridge — additive registerReplayTraceId(traceId: string): void on the RNSentry TurboModule spec. Degrades to a no-op on older cached native binaries (typeof guard).
  • iOS — SentrySDK.internal.replay.registerTraceId(SentryId) via RNSentryInternal, converting the 32-char hex trace id to a SentryId (reusing the hyphenation helper shared with setCurrentScopePropagationContext).
  • Android — getReplayController().registerTraceId(new SentryId(traceId)).

💡 Motivation and Context

Fixes #6232

💚 How did you test it?

📝 Checklist

  • I added tests to verify 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.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

Forward the trace id of each sent event to the native Session Replay so
the current segment carries it under `trace_ids`, making replays
searchable by trace id in Explore. The native SDKs (Cocoa 9.29.1,
Java 8.58.0) own dedup, the 100-per-segment cap, and the no-op when no
replay is recording; the RN side is a thin forward across the bridge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(replay): Populate trace_ids in mobile replay events by antonis in #6786
  • chore(deps): update Cocoa SDK to v9.29.1 by github-actions in #6785
  • chore(deps): update Android SDK to v8.58.0 by github-actions in #6778
  • fix(build): Prevent update-android.sh from failing on SIGPIPE by antonis in #6777
  • chore(deps): update Wizard to v8.0.0 by github-actions in #6775

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Sep 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 b25fdd3

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Sep 25, 2026

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b25fdd3. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 478.78 ms 540.71 ms 61.94 ms
Size 50.56 MiB 56.51 MiB 5.95 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5789645+dirty 426.82 ms 495.42 ms 68.60 ms
fa21fca+dirty 453.80 ms 468.46 ms 14.66 ms
a216cb9+dirty 458.66 ms 531.47 ms 72.81 ms
0307fa4+dirty 454.16 ms 518.35 ms 64.18 ms
5569641+dirty 406.43 ms 428.51 ms 22.08 ms
6a3eb4c+dirty 430.90 ms 489.98 ms 59.08 ms
5fe1c6c+dirty 401.62 ms 445.28 ms 43.66 ms
a636fa4+dirty 486.70 ms 508.53 ms 21.83 ms
15d4514+dirty 406.77 ms 428.06 ms 21.29 ms
1e5d96d+dirty 519.43 ms 543.62 ms 24.19 ms

App size

Revision Plain With Sentry Diff
5789645+dirty 49.74 MiB 54.85 MiB 5.11 MiB
fa21fca+dirty 49.74 MiB 55.37 MiB 5.63 MiB
a216cb9+dirty 49.74 MiB 55.08 MiB 5.34 MiB
0307fa4+dirty 49.74 MiB 54.81 MiB 5.07 MiB
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB
6a3eb4c+dirty 49.74 MiB 55.44 MiB 5.70 MiB
5fe1c6c+dirty 43.75 MiB 48.14 MiB 4.39 MiB
a636fa4+dirty 49.74 MiB 55.36 MiB 5.62 MiB
15d4514+dirty 48.30 MiB 53.60 MiB 5.30 MiB
1e5d96d+dirty 49.74 MiB 54.81 MiB 5.07 MiB

@sentry

sentry Bot commented Sep 25, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.28.0 (108) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3827.18 ms 1209.38 ms -2617.79 ms
Size 5.15 MiB 6.92 MiB 1.77 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
64630e5+dirty 3842.70 ms 1218.11 ms -2624.60 ms
b0d3373+dirty 3831.75 ms 1227.29 ms -2604.46 ms
b04af96+dirty 3818.92 ms 1219.76 ms -2599.16 ms
3d31fcf+dirty 3838.09 ms 1223.46 ms -2614.63 ms
a0a3177+dirty 3844.73 ms 1225.23 ms -2619.51 ms
af33f3b+dirty 3849.98 ms 1236.45 ms -2613.53 ms
09a902f+dirty 3835.67 ms 1217.11 ms -2618.57 ms
5a316ea+dirty 3820.11 ms 1211.28 ms -2608.83 ms
acd838e+dirty 3849.78 ms 1230.00 ms -2619.78 ms
c2e182c+dirty 3848.40 ms 1211.79 ms -2636.61 ms

App size

Revision Plain With Sentry Diff
64630e5+dirty 4.98 MiB 6.46 MiB 1.49 MiB
b0d3373+dirty 5.15 MiB 6.68 MiB 1.53 MiB
b04af96+dirty 4.98 MiB 6.54 MiB 1.56 MiB
3d31fcf+dirty 4.98 MiB 6.56 MiB 1.58 MiB
a0a3177+dirty 4.98 MiB 6.55 MiB 1.58 MiB
af33f3b+dirty 4.98 MiB 6.51 MiB 1.54 MiB
09a902f+dirty 4.98 MiB 6.46 MiB 1.49 MiB
5a316ea+dirty 4.98 MiB 6.51 MiB 1.53 MiB
acd838e+dirty 5.15 MiB 6.70 MiB 1.55 MiB
c2e182c+dirty 4.98 MiB 6.50 MiB 1.52 MiB

@github-actions

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 480.17 ms 513.91 ms 33.74 ms
Size 50.56 MiB 56.51 MiB 5.95 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
bf168a4+dirty 430.60 ms 459.31 ms 28.71 ms
0bd8916+dirty 400.15 ms 442.72 ms 42.57 ms
a2585ce+dirty 414.04 ms 456.83 ms 42.79 ms
9c84b9a+dirty 429.26 ms 448.90 ms 19.64 ms
bc0d8cf+dirty 407.66 ms 461.35 ms 53.69 ms
a736b76+dirty 405.78 ms 458.74 ms 52.96 ms
1122a96+dirty 510.16 ms 542.00 ms 31.84 ms
267d3ed+dirty 424.69 ms 483.70 ms 59.01 ms
6177334+dirty 404.80 ms 456.74 ms 51.94 ms
7887847+dirty 420.47 ms 460.55 ms 40.08 ms

App size

Revision Plain With Sentry Diff
bf168a4+dirty 49.74 MiB 55.09 MiB 5.35 MiB
0bd8916+dirty 48.30 MiB 53.57 MiB 5.26 MiB
a2585ce+dirty 49.74 MiB 55.36 MiB 5.61 MiB
9c84b9a+dirty 49.74 MiB 55.36 MiB 5.62 MiB
bc0d8cf+dirty 48.30 MiB 53.48 MiB 5.18 MiB
a736b76+dirty 48.30 MiB 53.48 MiB 5.18 MiB
1122a96+dirty 48.30 MiB 53.54 MiB 5.24 MiB
267d3ed+dirty 48.30 MiB 53.58 MiB 5.28 MiB
6177334+dirty 48.30 MiB 53.54 MiB 5.23 MiB
7887847+dirty 49.74 MiB 54.81 MiB 5.07 MiB

@github-actions

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3841.00 ms 1228.87 ms -2612.13 ms
Size 5.15 MiB 6.92 MiB 1.77 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
64630e5+dirty 3845.49 ms 1215.19 ms -2630.30 ms
b0d3373+dirty 3842.49 ms 1218.49 ms -2624.00 ms
b04af96+dirty 3830.54 ms 1206.11 ms -2624.44 ms
f9c1ed4+dirty 3842.09 ms 1220.70 ms -2621.40 ms
09a902f+dirty 3847.65 ms 1221.31 ms -2626.34 ms
44abcc2+dirty 3841.42 ms 1214.77 ms -2626.65 ms
acd838e+dirty 3835.94 ms 1215.87 ms -2620.07 ms
bfba737+dirty 3834.18 ms 1222.80 ms -2611.38 ms
ce7b368+dirty 3851.41 ms 1222.37 ms -2629.04 ms
4e0ba9c+dirty 3856.39 ms 1234.44 ms -2621.95 ms

App size

Revision Plain With Sentry Diff
64630e5+dirty 4.98 MiB 6.46 MiB 1.49 MiB
b0d3373+dirty 5.15 MiB 6.68 MiB 1.53 MiB
b04af96+dirty 4.98 MiB 6.54 MiB 1.56 MiB
f9c1ed4+dirty 4.98 MiB 6.50 MiB 1.53 MiB
09a902f+dirty 4.98 MiB 6.46 MiB 1.49 MiB
44abcc2+dirty 4.98 MiB 6.55 MiB 1.57 MiB
acd838e+dirty 5.15 MiB 6.70 MiB 1.55 MiB
bfba737+dirty 4.98 MiB 6.51 MiB 1.53 MiB
ce7b368+dirty 4.98 MiB 6.51 MiB 1.53 MiB
4e0ba9c+dirty 5.15 MiB 6.67 MiB 1.51 MiB

@antonis
antonis marked this pull request as ready for review September 25, 2026 09:18

@alwx alwx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

@antonis
antonis merged commit 570d7be into main Sep 25, 2026
141 of 147 checks passed
@antonis
antonis deleted the feat/replay-trace-ids branch September 25, 2026 10:57
alwx added a commit that referenced this pull request Sep 28, 2026
#6786 added registerReplayTraceId on main while this branch was moving the
.mm callers off the Swift module. git merged both cleanly, but the result
calls RNSentryInternal directly from RNSentry.mm, which no longer imports
the generated Swift header -- breaking every iOS build, CocoaPods included.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Populate trace_ids in mobile replay events to enable searching replays by trace ID

2 participants