-
-
Notifications
You must be signed in to change notification settings - Fork 354
fix(session-replay): Leave captureReplay logic to the native implementation #5243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@romtsn I took the liberty of adding you as a reviewer on this one since you might have more context on how things work on the native side or a suggestion for a better approach 🙏 |
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c7f264b | 434.98 ms | 452.96 ms | 17.98 ms |
| bfe454a+dirty | 573.44 ms | 579.46 ms | 6.02 ms |
| 534ba8c | 484.00 ms | 499.93 ms | 15.93 ms |
| 0b64753+dirty | 448.67 ms | 474.61 ms | 25.94 ms |
| 64cd15c | 439.02 ms | 427.63 ms | -11.39 ms |
| 459a438+dirty | 417.09 ms | 406.52 ms | -10.57 ms |
| d751a5d+dirty | 434.24 ms | 486.08 ms | 51.84 ms |
| 955f2eb+dirty | 422.74 ms | 410.19 ms | -12.55 ms |
| 8d89cc9+dirty | 537.83 ms | 536.02 ms | -1.81 ms |
| a0b15d6 | 423.06 ms | 437.77 ms | 14.71 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c7f264b | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| bfe454a+dirty | 17.75 MiB | 19.69 MiB | 1.94 MiB |
| 534ba8c | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 0b64753+dirty | 17.75 MiB | 19.70 MiB | 1.95 MiB |
| 64cd15c | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 459a438+dirty | 17.75 MiB | 19.70 MiB | 1.95 MiB |
| d751a5d+dirty | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| 955f2eb+dirty | 17.75 MiB | 19.70 MiB | 1.95 MiB |
| 8d89cc9+dirty | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| a0b15d6 | 17.75 MiB | 20.15 MiB | 2.41 MiB |
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c1573b3+dirty | 355.65 ms | 448.82 ms | 93.17 ms |
| 818a608+dirty | 350.29 ms | 397.38 ms | 47.09 ms |
| d916aa3+dirty | 411.72 ms | 451.76 ms | 40.03 ms |
| a0b15d6+dirty | 414.33 ms | 448.85 ms | 34.52 ms |
| bfe454a+dirty | 372.42 ms | 424.52 ms | 52.10 ms |
| af9331b+dirty | 374.42 ms | 425.68 ms | 51.26 ms |
| 0b64753+dirty | 358.55 ms | 429.16 ms | 70.61 ms |
| c9e95bd+dirty | 339.32 ms | 401.24 ms | 61.92 ms |
| 459a438+dirty | 359.50 ms | 390.53 ms | 31.03 ms |
| d751a5d+dirty | 341.61 ms | 403.06 ms | 61.45 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c1573b3+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| 818a608+dirty | 7.15 MiB | 8.41 MiB | 1.26 MiB |
| d916aa3+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| a0b15d6+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| bfe454a+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| af9331b+dirty | 7.15 MiB | 8.41 MiB | 1.26 MiB |
| 0b64753+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| c9e95bd+dirty | 7.15 MiB | 8.41 MiB | 1.26 MiB |
| 459a438+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| d751a5d+dirty | 7.15 MiB | 8.41 MiB | 1.26 MiB |
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7be1f99+dirty | 1222.43 ms | 1217.15 ms | -5.28 ms |
| eb07ba3+dirty | 1214.49 ms | 1221.59 ms | 7.10 ms |
| 5c16cdc+dirty | 1235.67 ms | 1241.18 ms | 5.51 ms |
| 69602ce+dirty | 1230.59 ms | 1230.84 ms | 0.24 ms |
| 8a4ce6f+dirty | 1232.80 ms | 1223.80 ms | -9.00 ms |
| 95aaf8a+dirty | 1206.83 ms | 1213.65 ms | 6.81 ms |
| 98f632c+dirty | 1221.38 ms | 1229.26 ms | 7.88 ms |
| 3e0a5f9+dirty | 1233.65 ms | 1239.10 ms | 5.45 ms |
| ba75c7c+dirty | 1236.14 ms | 1240.69 ms | 4.55 ms |
| 276d348+dirty | 1222.10 ms | 1229.02 ms | 6.92 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7be1f99+dirty | 3.19 MiB | 4.38 MiB | 1.19 MiB |
| eb07ba3+dirty | 3.19 MiB | 4.38 MiB | 1.19 MiB |
| 5c16cdc+dirty | 3.19 MiB | 4.53 MiB | 1.34 MiB |
| 69602ce+dirty | 3.19 MiB | 4.48 MiB | 1.29 MiB |
| 8a4ce6f+dirty | 3.19 MiB | 4.53 MiB | 1.34 MiB |
| 95aaf8a+dirty | 3.19 MiB | 4.44 MiB | 1.25 MiB |
| 98f632c+dirty | 3.19 MiB | 4.38 MiB | 1.19 MiB |
| 3e0a5f9+dirty | 3.19 MiB | 4.38 MiB | 1.19 MiB |
| ba75c7c+dirty | 3.19 MiB | 4.38 MiB | 1.19 MiB |
| 276d348+dirty | 3.19 MiB | 4.54 MiB | 1.36 MiB |
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7be1f99+dirty | 1226.69 ms | 1217.76 ms | -8.93 ms |
| eb07ba3+dirty | 1222.46 ms | 1220.37 ms | -2.08 ms |
| 5c16cdc+dirty | 1209.32 ms | 1210.67 ms | 1.35 ms |
| 69602ce+dirty | 1235.65 ms | 1230.82 ms | -4.83 ms |
| 8a4ce6f+dirty | 1221.31 ms | 1219.84 ms | -1.47 ms |
| 95aaf8a+dirty | 1234.78 ms | 1241.94 ms | 7.16 ms |
| 98f632c+dirty | 1236.40 ms | 1241.62 ms | 5.22 ms |
| 3e0a5f9+dirty | 1226.94 ms | 1230.02 ms | 3.08 ms |
| ba75c7c+dirty | 1235.86 ms | 1226.45 ms | -9.41 ms |
| 276d348+dirty | 1224.22 ms | 1227.38 ms | 3.16 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7be1f99+dirty | 2.63 MiB | 3.81 MiB | 1.18 MiB |
| eb07ba3+dirty | 2.63 MiB | 3.81 MiB | 1.18 MiB |
| 5c16cdc+dirty | 2.63 MiB | 3.96 MiB | 1.33 MiB |
| 69602ce+dirty | 2.63 MiB | 3.91 MiB | 1.28 MiB |
| 8a4ce6f+dirty | 2.63 MiB | 3.96 MiB | 1.33 MiB |
| 95aaf8a+dirty | 2.63 MiB | 3.87 MiB | 1.24 MiB |
| 98f632c+dirty | 2.63 MiB | 3.81 MiB | 1.18 MiB |
| 3e0a5f9+dirty | 2.63 MiB | 3.81 MiB | 1.18 MiB |
| ba75c7c+dirty | 2.63 MiB | 3.81 MiB | 1.18 MiB |
| 276d348+dirty | 2.63 MiB | 3.98 MiB | 1.34 MiB |
lucas-zimerman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
|
||
| const recordingReplayId = NATIVE.getCurrentReplayId(); | ||
| if (recordingReplayId) { | ||
| if (!hardCrash && recordingReplayId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice find! I'm actually not even sure if we need this if altogether.. When I look at the native implementations, it seems that they take care of not doing anything if the replay is running in session mode (=replay_id is on the scope).
Perhaps we should just rely on the native SDKs handling that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only important thing we have to make sure is that isHardCrash actually returns true when the program is about to terminate - this is needed on Android so we don't try to send anything and potentially lose segments due to the termination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback @romtsn 🙇
Perhaps we should just rely on the native SDKs handling that here?
Good point 👍 I've removed the unneeded RN logic with c467718. Only kept the if statements to keep the logging consistent with the previous versions. As expected I didn't notice any change in behavior with this change.
the only important thing we have to make sure is that isHardCrash actually returns true when the program is about to terminate
The function uses a bit of a heuristic approach but it worked as expected in my tests and it seems to have served us well till now.
romtsn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
📢 Type of change
📜 Description
Leaves captureReplay logic to the native implementation
💡 Motivation and Context
Fixes #5074
When
replaysSessionSampleRate: 0.0, and with the steps below, I always got no recording attached to the event though I should have given thatreplaysOnErrorSampleRate: 1.0. I wasn't able to associate this behavior with thereactNavigationIntegrationas the above issue states but the fix seems to make the the SR recording more reliable.💚 How did you test it?
replaysSessionSampleRate: 0.0in the sample app. LeavereplaysOnErrorSampleRate: 1.0Uncaught Thrown Error📝 Checklist
sendDefaultPIIis enabled🔮 Next steps