Skip to content

Conversation

@denrase
Copy link
Collaborator

@denrase denrase commented Oct 23, 2025

📜 Description

  • Add sentry.replay_id to logs if replay id is set on scope
  • Add sentry.replay_id and sentry._internal.replay_is_buffering if replay id is set on integration (buffer mode)

💡 Motivation and Context

I tried this with our sample app, but always got no session, and therefore not replayId, from the integration. Was expecting that we have a buffered session, but i'm probably not familiar with how this is implemented on iOS. I assumed the flow is similar to what we have on Android. NVM, this was on iOS 26 where it's disable. Works as expected on iOS < 26.

Closes #6133

💚 How did you test it?

Unit tests. Sample app.

📝 Checklist

You have to check all boxes before merging:

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against b6f9b9f

@denrase denrase changed the title Add sentry.replay_id to logs Add sentry.replay_id attribute to logs Oct 23, 2025
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.464%. Comparing base (781f560) to head (b6f9b9f).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6515       +/-   ##
=============================================
+ Coverage   85.234%   85.464%   +0.230%     
=============================================
  Files          451       451               
  Lines        27516     27539       +23     
  Branches     12048     12060       +12     
=============================================
+ Hits         23453     23536       +83     
+ Misses        4019      3958       -61     
- Partials        44        45        +1     
Files with missing lines Coverage Δ
SentryTestUtils/TestHub.swift 77.419% <100.000%> (+1.557%) ⬆️
Sources/Sentry/SentryHub.m 96.344% <100.000%> (+0.077%) ⬆️
Sources/Swift/Tools/SentryLogger.swift 99.264% <100.000%> (+0.077%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 781f560...b6f9b9f. Read the comment docs.

@denrase denrase marked this pull request as ready for review October 23, 2025 12:49
@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Replay Headers Cause Compilation Issues

The SentrySessionReplayIntegration headers are unconditionally imported in SentryPrivate.h. This causes compilation errors on platforms without replay support (e.g., watchOS, macOS without UIKit), as these headers contain code guarded by SENTRY_TARGET_REPLAY_SUPPORTED.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Test Crashes Due to Force-Unwrapping Nullable Property

Tests force-unwrap the sessionReplay property, which is now nullable. This creates a potential for test crashes if sessionReplay is nil, despite its nullable type declaration.

Fix in Cursor Fix in Web

@denrase
Copy link
Collaborator Author

denrase commented Oct 23, 2025

Having some trouble with accessing SentrySessionReplayIntegration in swift. Moved the files to SentryPrivate.h, like described in SWIFT.md, but now it is clashing with some build configurations and with SentryHybrid explicit module. Would appreciate some guidance here. 🙇

@philipphofmann
Copy link
Member

Having some trouble with accessing SentrySessionReplayIntegration in swift. Moved the files to SentryPrivate.h, like described in SWIFT.md, but now it is clashing with some build configurations and with SentryHybrid explicit module. Would appreciate some guidance here. 🙇

@noahsmartin is good candidate to answer this ⬆️

@denrase denrase requested a review from itaybre October 27, 2025 09:41
cursor[bot]

This comment was marked as outdated.

@denrase
Copy link
Collaborator Author

denrase commented Oct 27, 2025

I was unsuccessful in exposing SentrySessionReplayIntegration/SentrySessionReplay to the Swift SDK, so I opted to add a helper to SentryHub+Private to access the integrations replayId.

Copy link
Contributor

@itaybre itaybre left a comment

Choose a reason for hiding this comment

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

LGTM, once the build issue is fixed

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1223.71 ms 1270.53 ms 46.82 ms
Size 23.75 KiB 1.02 MiB 1016.83 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
ed85746 1231.79 ms 1248.55 ms 16.75 ms
78af7a9 1225.75 ms 1256.98 ms 31.23 ms
e18d392 1228.69 ms 1244.43 ms 15.73 ms
e8da57d 1203.77 ms 1234.85 ms 31.08 ms
c5bedc0 1203.83 ms 1236.17 ms 32.33 ms
52588a5 1226.24 ms 1257.22 ms 30.98 ms
b9ceffb 1222.57 ms 1247.96 ms 25.39 ms
caa7e70 1233.61 ms 1259.13 ms 25.52 ms
b5a7583 1238.22 ms 1263.94 ms 25.71 ms
5c5648e 1234.44 ms 1253.79 ms 19.35 ms

App size

Revision Plain With Sentry Diff
ed85746 23.75 KiB 920.83 KiB 897.08 KiB
78af7a9 23.75 KiB 990.00 KiB 966.26 KiB
e18d392 23.75 KiB 866.68 KiB 842.93 KiB
e8da57d 23.75 KiB 919.69 KiB 895.94 KiB
c5bedc0 23.75 KiB 920.63 KiB 896.89 KiB
52588a5 23.75 KiB 1.00 MiB 1005.07 KiB
b9ceffb 23.75 KiB 969.07 KiB 945.32 KiB
caa7e70 23.75 KiB 1004.68 KiB 980.94 KiB
b5a7583 23.75 KiB 913.44 KiB 889.68 KiB
5c5648e 23.75 KiB 879.60 KiB 855.86 KiB

Previous results on branch: denrase/replay-id

Startup times

Revision Plain With Sentry Diff
eb3e0ba 1219.57 ms 1261.17 ms 41.60 ms
ba51ef9 1231.84 ms 1263.23 ms 31.40 ms
03778da 1218.05 ms 1246.38 ms 28.34 ms
680b2c2 1221.80 ms 1247.71 ms 25.90 ms

App size

Revision Plain With Sentry Diff
eb3e0ba 23.75 KiB 1.02 MiB 1016.46 KiB
ba51ef9 23.75 KiB 1.02 MiB 1016.45 KiB
03778da 23.75 KiB 1.02 MiB 1016.46 KiB
680b2c2 23.75 KiB 1.00 MiB 1002.99 KiB

@denrase denrase merged commit 995b436 into main Oct 31, 2025
184 of 191 checks passed
@denrase denrase deleted the denrase/replay-id branch October 31, 2025 13:02
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.

Add sentry.replay_id attribute to ios logs

4 participants