Skip to content

Conversation

@krystofwoldrich
Copy link
Contributor

@krystofwoldrich krystofwoldrich commented Mar 10, 2025

📢 Type of change

  • Bugfix
  • Enhancement
  • Refactoring

📜 Description

Example of warm start after reopening the application with Don't keep activities enabled.

Screenshot 2025-03-10 at 17 36 01

💡 Motivation and Context

Android SDK reports warm start when the main application activity is destroyed and later created again.

These warm starts were not reported by the RN SDK, because reporting app starts was restricted to only once per the process lifetime.

This PR allows to report warm app starts on activity recreation. The re-creating of the activity is tracked by the call of runApplication in the JS layer.

Requires https://github.com/getsentry/sentry-react-native/releases/tag/6.9.1 to be merged to main for cold start to be working

💚 How did you test it?

unit tests, sample app

📝 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
  • No breaking changes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2025

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

Generated by 🚫 dangerJS against ea6e464

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2025

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 417.53 ms 430.74 ms 13.21 ms
Size 17.75 MiB 20.12 MiB 2.37 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3261206 476.43 ms 465.96 ms -10.48 ms
5571a20 410.55 ms 441.06 ms 30.51 ms
255d28b 424.09 ms 441.96 ms 17.87 ms
1faf8e3 449.18 ms 432.08 ms -17.10 ms
690220d 468.28 ms 480.06 ms 11.78 ms
57448c5 443.47 ms 440.20 ms -3.26 ms
6e8584e 447.10 ms 474.71 ms 27.61 ms
5446992 403.40 ms 426.70 ms 23.30 ms
b7eb05d 435.98 ms 466.19 ms 30.21 ms
e5bc97b 438.96 ms 437.39 ms -1.57 ms

App size

Revision Plain With Sentry Diff
3261206 17.75 MiB 20.11 MiB 2.37 MiB
5571a20 17.73 MiB 19.93 MiB 2.19 MiB
255d28b 17.75 MiB 20.12 MiB 2.37 MiB
1faf8e3 17.74 MiB 20.08 MiB 2.34 MiB
690220d 17.74 MiB 20.08 MiB 2.35 MiB
57448c5 17.74 MiB 20.08 MiB 2.34 MiB
6e8584e 17.73 MiB 19.86 MiB 2.12 MiB
5446992 17.73 MiB 19.85 MiB 2.12 MiB
b7eb05d 17.75 MiB 20.12 MiB 2.37 MiB
e5bc97b 17.74 MiB 20.08 MiB 2.34 MiB

Previous results on branch: kw/add-warm-start-on-activity-recreate

Startup times

Revision Plain With Sentry Diff
c54a7ab 414.92 ms 432.32 ms 17.40 ms
3bbaf12 395.69 ms 418.62 ms 22.93 ms
5c20775 434.91 ms 468.49 ms 33.58 ms

App size

Revision Plain With Sentry Diff
c54a7ab 17.75 MiB 20.12 MiB 2.37 MiB
3bbaf12 17.75 MiB 20.12 MiB 2.37 MiB
5c20775 17.75 MiB 20.12 MiB 2.37 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2025

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 423.60 ms 425.90 ms 2.30 ms
Size 7.15 MiB 8.39 MiB 1.23 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
21a0abb+dirty 383.90 ms 442.02 ms 58.12 ms
e46354e+dirty 389.74 ms 376.18 ms -13.56 ms
34aba08+dirty 331.79 ms 376.69 ms 44.91 ms
8fe7c9d+dirty 363.91 ms 429.93 ms 66.03 ms
153419c+dirty 393.06 ms 434.72 ms 41.66 ms
c81e67f+dirty 355.71 ms 364.96 ms 9.24 ms
a18210a+dirty 406.49 ms 453.94 ms 47.45 ms
6707be9+dirty 431.52 ms 461.14 ms 29.62 ms
f06c879+dirty 361.27 ms 407.88 ms 46.61 ms
cdf2f33+dirty 371.23 ms 406.10 ms 34.88 ms

App size

Revision Plain With Sentry Diff
21a0abb+dirty 7.15 MiB 8.38 MiB 1.23 MiB
e46354e+dirty 7.15 MiB 8.39 MiB 1.23 MiB
34aba08+dirty 7.15 MiB 8.07 MiB 946.13 KiB
8fe7c9d+dirty 7.15 MiB 8.38 MiB 1.23 MiB
153419c+dirty 7.15 MiB 8.38 MiB 1.23 MiB
c81e67f+dirty 7.15 MiB 8.39 MiB 1.23 MiB
a18210a+dirty 7.15 MiB 8.38 MiB 1.23 MiB
6707be9+dirty 7.15 MiB 8.38 MiB 1.23 MiB
f06c879+dirty 7.15 MiB 8.12 MiB 997.78 KiB
cdf2f33+dirty 7.15 MiB 8.35 MiB 1.20 MiB

Previous results on branch: kw/add-warm-start-on-activity-recreate

Startup times

Revision Plain With Sentry Diff
c54a7ab+dirty 354.86 ms 366.77 ms 11.91 ms
3bbaf12+dirty 364.54 ms 402.00 ms 37.46 ms
5c20775+dirty 347.49 ms 347.45 ms -0.04 ms

App size

Revision Plain With Sentry Diff
c54a7ab+dirty 7.15 MiB 8.39 MiB 1.23 MiB
3bbaf12+dirty 7.15 MiB 8.39 MiB 1.23 MiB
5c20775+dirty 7.15 MiB 8.39 MiB 1.23 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2025

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1225.78 ms 1224.42 ms -1.36 ms
Size 2.63 MiB 3.75 MiB 1.12 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
ac41368+dirty 1226.65 ms 1237.90 ms 11.24 ms
457e29f+dirty 1253.94 ms 1269.18 ms 15.24 ms
ae2f6bc+dirty 1226.13 ms 1227.71 ms 1.58 ms
4a6664f+dirty 1209.49 ms 1208.63 ms -0.86 ms
4ed9c54+dirty 1215.39 ms 1224.66 ms 9.27 ms
94fc925+dirty 1231.12 ms 1223.85 ms -7.27 ms
d197b5c+dirty 1217.61 ms 1242.66 ms 25.05 ms
86818c7+dirty 1228.06 ms 1226.42 ms -1.64 ms
60ad48c+dirty 1214.22 ms 1227.41 ms 13.19 ms
b1e8712+dirty 1256.02 ms 1265.14 ms 9.12 ms

App size

Revision Plain With Sentry Diff
ac41368+dirty 2.36 MiB 3.14 MiB 793.46 KiB
457e29f+dirty 2.36 MiB 2.87 MiB 520.67 KiB
ae2f6bc+dirty 2.63 MiB 3.70 MiB 1.06 MiB
4a6664f+dirty 2.36 MiB 3.04 MiB 696.39 KiB
4ed9c54+dirty 2.63 MiB 3.75 MiB 1.12 MiB
94fc925+dirty 2.63 MiB 3.69 MiB 1.05 MiB
d197b5c+dirty 2.36 MiB 2.82 MiB 462.86 KiB
86818c7+dirty 2.63 MiB 3.75 MiB 1.12 MiB
60ad48c+dirty 2.63 MiB 3.75 MiB 1.12 MiB
b1e8712+dirty 2.36 MiB 2.84 MiB 488.84 KiB

Previous results on branch: kw/add-warm-start-on-activity-recreate

Startup times

Revision Plain With Sentry Diff
5c20775+dirty 1224.87 ms 1235.20 ms 10.33 ms
c54a7ab+dirty 1230.71 ms 1232.42 ms 1.71 ms
3bbaf12+dirty 1230.59 ms 1230.91 ms 0.32 ms

App size

Revision Plain With Sentry Diff
5c20775+dirty 2.63 MiB 3.75 MiB 1.12 MiB
c54a7ab+dirty 2.63 MiB 3.75 MiB 1.12 MiB
3bbaf12+dirty 2.63 MiB 3.75 MiB 1.12 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2025

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1233.67 ms 1241.32 ms 7.65 ms
Size 3.19 MiB 4.32 MiB 1.13 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
ac41368+dirty 1226.69 ms 1229.96 ms 3.27 ms
457e29f+dirty 1256.71 ms 1258.50 ms 1.79 ms
ae2f6bc+dirty 1220.82 ms 1217.93 ms -2.88 ms
4a6664f+dirty 1218.77 ms 1221.07 ms 2.30 ms
4ed9c54+dirty 1219.96 ms 1230.49 ms 10.53 ms
94fc925+dirty 1231.04 ms 1231.60 ms 0.55 ms
d197b5c+dirty 1234.80 ms 1249.20 ms 14.40 ms
86818c7+dirty 1239.80 ms 1239.82 ms 0.01 ms
60ad48c+dirty 1225.79 ms 1233.51 ms 7.72 ms
b1e8712+dirty 1284.11 ms 1297.82 ms 13.71 ms

App size

Revision Plain With Sentry Diff
ac41368+dirty 2.92 MiB 3.69 MiB 794.29 KiB
457e29f+dirty 2.92 MiB 3.43 MiB 524.75 KiB
ae2f6bc+dirty 3.19 MiB 4.26 MiB 1.08 MiB
4a6664f+dirty 2.92 MiB 3.60 MiB 702.09 KiB
4ed9c54+dirty 3.19 MiB 4.32 MiB 1.13 MiB
94fc925+dirty 3.19 MiB 4.25 MiB 1.07 MiB
d197b5c+dirty 2.92 MiB 3.37 MiB 464.41 KiB
86818c7+dirty 3.19 MiB 4.32 MiB 1.13 MiB
60ad48c+dirty 3.19 MiB 4.32 MiB 1.13 MiB
b1e8712+dirty 2.92 MiB 3.40 MiB 494.15 KiB

Previous results on branch: kw/add-warm-start-on-activity-recreate

Startup times

Revision Plain With Sentry Diff
5c20775+dirty 1215.73 ms 1214.23 ms -1.51 ms
c54a7ab+dirty 1219.65 ms 1224.24 ms 4.59 ms
3bbaf12+dirty 1229.02 ms 1241.66 ms 12.64 ms

App size

Revision Plain With Sentry Diff
5c20775+dirty 3.19 MiB 4.32 MiB 1.13 MiB
c54a7ab+dirty 3.19 MiB 4.32 MiB 1.13 MiB
3bbaf12+dirty 3.19 MiB 4.32 MiB 1.13 MiB

@krystofwoldrich krystofwoldrich marked this pull request as ready for review March 11, 2025 16:52
@krystofwoldrich
Copy link
Contributor Author

After #4646 is merged, both the cold and warm starts will be reported.

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

The code changes LGTM and the app worked as expected for me 🎸
Thank you for the extensive test cases 🙇

cold
warm

@krystofwoldrich krystofwoldrich merged commit 539c9bd into main Mar 13, 2025
72 checks passed
@krystofwoldrich krystofwoldrich deleted the kw/add-warm-start-on-activity-recreate branch March 13, 2025 10:14
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.

3 participants