sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

Prepare SDK for upcoming Session Replay API changes on Android

Open markushi opened this issue 9 months ago • 4 comments

:scroll: Description

As it may takes some time until the first frame is drawn, we're removing the replay configuration from the .start() call, instead the Android SDK expects onConfigurationChanged() to be called every time the top level widget size changes.

Example replay: https://sentry-sdks.sentry.io/replays/3f571c24990e4bb998b49eebef745313

The breaking changes were introduced in sentry-java 8.13.3

:green_heart: How did you test it?

:pencil: Checklist

  • [ ] I reviewed submitted code
  • [ ] 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
  • [ ] All tests passing
  • [ ] No breaking changes

:crystal_ball: Next steps

markushi avatar Jun 04 '25 10:06 markushi

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • [x] flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt
  • [x] flutter/lib/src/native/java/android_replay_recorder.dart
  • [x] flutter/lib/src/screenshot/recorder.dart

github-actions[bot] avatar Jun 04 '25 10:06 github-actions[bot]

Codecov Report

Attention: Patch coverage is 89.58333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 89.14%. Comparing base (4481076) to head (79502a8). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...r/lib/src/native/java/android_replay_recorder.dart 33.33% 2 Missing :warning:
flutter/lib/src/screenshot/recorder.dart 60.00% 2 Missing :warning:
...lutter/lib/src/native/java/sentry_native_java.dart 87.50% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2977      +/-   ##
==========================================
+ Coverage   87.91%   89.14%   +1.23%     
==========================================
  Files         287       97     -190     
  Lines        9766     3539    -6227     
==========================================
- Hits         8586     3155    -5431     
+ Misses       1180      384     -796     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 04 '25 10:06 codecov[bot]

iOS Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1247.29 ms 1263.49 ms 16.20 ms
Size 7.86 MiB 9.44 MiB 1.58 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b6c872078aac63633c6432d6b1b91fec76e3bc2f 1252.65 ms 1266.61 ms 13.96 ms
6f47800af6fe74fe32ee8790036aae7ef08992b7 1247.52 ms 1259.37 ms 11.85 ms
640ad0c12fa905c8b00b3d4cbfb9d85170e64197 1241.04 ms 1253.96 ms 12.92 ms
73a3c381d4f338b603107298bab28bbfcf3bcd47 1263.37 ms 1277.90 ms 14.53 ms
73dca7800ad996c956be74ed7e645bf59d748ba6 1246.65 ms 1265.42 ms 18.76 ms
6ba4675330d656aed3622e97460238914a92a032 1223.12 ms 1238.17 ms 15.04 ms
93b7728df85f069dc440ff438d31344ef4e67e7e 1247.23 ms 1264.87 ms 17.64 ms
2d34233f99975f583775504139378c5f4a2273b3 1258.19 ms 1268.92 ms 10.73 ms
ec7888805bfda6d2f739a632adbab10859e125bd 1251.37 ms 1269.40 ms 18.04 ms
dbd526b67bf077abff4d82238cafe6f9dab261ab 1244.78 ms 1259.02 ms 14.24 ms

App size

Revision Plain With Sentry Diff
b6c872078aac63633c6432d6b1b91fec76e3bc2f 7.86 MiB 9.44 MiB 1.58 MiB
6f47800af6fe74fe32ee8790036aae7ef08992b7 7.86 MiB 9.44 MiB 1.58 MiB
640ad0c12fa905c8b00b3d4cbfb9d85170e64197 7.86 MiB 9.44 MiB 1.58 MiB
73a3c381d4f338b603107298bab28bbfcf3bcd47 7.86 MiB 9.44 MiB 1.58 MiB
73dca7800ad996c956be74ed7e645bf59d748ba6 7.86 MiB 9.44 MiB 1.58 MiB
6ba4675330d656aed3622e97460238914a92a032 7.86 MiB 9.44 MiB 1.58 MiB
93b7728df85f069dc440ff438d31344ef4e67e7e 7.86 MiB 9.44 MiB 1.58 MiB
2d34233f99975f583775504139378c5f4a2273b3 7.86 MiB 9.44 MiB 1.58 MiB
ec7888805bfda6d2f739a632adbab10859e125bd 7.86 MiB 9.44 MiB 1.58 MiB
dbd526b67bf077abff4d82238cafe6f9dab261ab 7.86 MiB 9.44 MiB 1.58 MiB

Previous results on branch: markushi/feat/android-replay-api-changes

Startup times

Revision Plain With Sentry Diff
7267eb0645e74f8bbdfca9f6c6c99d0eef3650f5 1249.64 ms 1270.31 ms 20.67 ms
935def9ae99c85b756542628adf2cfbc0a4fb92c 1260.27 ms 1267.14 ms 6.87 ms
32ffe8450fb862b003e672c3c5714c7d4ce65915 1265.10 ms 1278.28 ms 13.18 ms

App size

Revision Plain With Sentry Diff
7267eb0645e74f8bbdfca9f6c6c99d0eef3650f5 7.86 MiB 9.44 MiB 1.58 MiB
935def9ae99c85b756542628adf2cfbc0a4fb92c 7.86 MiB 9.44 MiB 1.58 MiB
32ffe8450fb862b003e672c3c5714c7d4ce65915 7.86 MiB 9.44 MiB 1.58 MiB

github-actions[bot] avatar Jun 04 '25 11:06 github-actions[bot]

I will make another release before getting this PR in (less change of breaking something)

buenaflor avatar Jul 11 '25 09:07 buenaflor

Android Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 463.06 ms 541.42 ms 78.35 ms
Size 6.54 MiB 7.70 MiB 1.17 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
81f83eb84cd99cb5192d75040728c002f05fc616 471.40 ms 522.14 ms 50.74 ms
aeb02f2572addd17381aa3a674d091ec109b66a2 373.84 ms 437.00 ms 63.16 ms
6ba4675330d656aed3622e97460238914a92a032 499.80 ms 632.43 ms 132.63 ms
cc4e375809a67cbbb15d8fa3e535f674562057e8 426.15 ms 482.34 ms 56.19 ms
b6c872078aac63633c6432d6b1b91fec76e3bc2f 457.41 ms 519.04 ms 61.63 ms
73dca7800ad996c956be74ed7e645bf59d748ba6 476.53 ms 522.21 ms 45.68 ms
575ebaa02366f4632f0acc225c259f7196d64342 478.00 ms 585.76 ms 107.76 ms
827bf09b6dae7b36f0c609612bb64e8d1a5c52f4 475.40 ms 547.14 ms 71.74 ms
e2d675d11e0e71aa181238f00cd6f0160197f5f0 457.92 ms 529.17 ms 71.25 ms
0fb38008bd97c02efc419e61439f946be26a307f 465.64 ms 536.77 ms 71.13 ms

App size

Revision Plain With Sentry Diff
81f83eb84cd99cb5192d75040728c002f05fc616 6.54 MiB 7.69 MiB 1.15 MiB
aeb02f2572addd17381aa3a674d091ec109b66a2 6.54 MiB 7.69 MiB 1.15 MiB
6ba4675330d656aed3622e97460238914a92a032 6.54 MiB 7.53 MiB 1015.26 KiB
cc4e375809a67cbbb15d8fa3e535f674562057e8 6.54 MiB 7.69 MiB 1.15 MiB
b6c872078aac63633c6432d6b1b91fec76e3bc2f 6.54 MiB 7.69 MiB 1.15 MiB
73dca7800ad996c956be74ed7e645bf59d748ba6 6.54 MiB 7.69 MiB 1.15 MiB
575ebaa02366f4632f0acc225c259f7196d64342 6.54 MiB 7.69 MiB 1.15 MiB
827bf09b6dae7b36f0c609612bb64e8d1a5c52f4 6.54 MiB 7.53 MiB 1015.27 KiB
e2d675d11e0e71aa181238f00cd6f0160197f5f0 6.54 MiB 7.69 MiB 1.15 MiB
0fb38008bd97c02efc419e61439f946be26a307f 6.54 MiB 7.69 MiB 1.15 MiB

Previous results on branch: markushi/feat/android-replay-api-changes

Startup times

Revision Plain With Sentry Diff
935def9ae99c85b756542628adf2cfbc0a4fb92c 440.29 ms 479.25 ms 38.96 ms
7267eb0645e74f8bbdfca9f6c6c99d0eef3650f5 458.80 ms 535.78 ms 76.98 ms
32ffe8450fb862b003e672c3c5714c7d4ce65915 468.49 ms 534.65 ms 66.16 ms

App size

Revision Plain With Sentry Diff
935def9ae99c85b756542628adf2cfbc0a4fb92c 6.54 MiB 7.70 MiB 1.17 MiB
7267eb0645e74f8bbdfca9f6c6c99d0eef3650f5 6.54 MiB 7.70 MiB 1.17 MiB
32ffe8450fb862b003e672c3c5714c7d4ce65915 6.54 MiB 7.70 MiB 1.17 MiB

github-actions[bot] avatar Jul 11 '25 09:07 github-actions[bot]

Tested locally in release mode, works well

buenaflor avatar Jul 22 '25 09:07 buenaflor

bugbot run

buenaflor avatar Jul 22 '25 10:07 buenaflor

@sentry review

buenaflor avatar Jul 22 '25 10:07 buenaflor