Skip to content
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

feat(ttd): Measure time to display on screen focus #4665

Merged
merged 16 commits into from
Mar 25, 2025

Conversation

krystofwoldrich
Copy link
Member

@krystofwoldrich krystofwoldrich commented Mar 18, 2025

📢 Type of change

  • New feature
  • Enhancement

📜 Description

Previously, we did not record TTFD/TTID for already loaded pages. But this causes unexpected behavior where transactions are recorded without TTID/TTFD because the screen was previously visited.

This PR adds createTimeToInitialDisplay({useFocusEffect}) and createTimeToFullDisplay({useFocusEffect}) helpers which let users create components that trigger the measurements on each focus (display) of the screen.

const TimeToFullDisplay = Sentry.createTimeToFullDisplay({useFocusEffect});

💚 How did you test it?

sample app, added e2e tests

📝 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

…eady seen routes

- Introduced `enableTimeToInitialDisplayForPreloadedRoutes` option to the React Navigation integration.
- Updated logic to measure Time to Initial Display for routes that have already been seen.
- Added tests to verify functionality for preloaded routes in the tracing module.
Copy link
Contributor

github-actions bot commented Mar 18, 2025

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

Generated by 🚫 dangerJS against 239ce28

Copy link
Contributor

github-actions bot commented Mar 18, 2025

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 478.19 ms 485.57 ms 7.38 ms
Size 17.75 MiB 20.13 MiB 2.38 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7d161c0 413.02 ms 435.29 ms 22.26 ms
c4bd70f 438.35 ms 442.18 ms 3.84 ms
b8ff156 438.80 ms 454.14 ms 15.34 ms
8fe7c9d 437.52 ms 426.42 ms -11.10 ms
afe5fcb 322.46 ms 353.04 ms 30.58 ms
cdf2bdf 448.42 ms 443.42 ms -5.00 ms
abb7058 370.27 ms 389.58 ms 19.31 ms
ddc0552 472.92 ms 460.66 ms -12.26 ms
7bc4d75 488.76 ms 473.28 ms -15.48 ms
a5d86e1 465.06 ms 457.83 ms -7.23 ms

App size

Revision Plain With Sentry Diff
7d161c0 17.75 MiB 20.12 MiB 2.37 MiB
c4bd70f 17.75 MiB 20.12 MiB 2.37 MiB
b8ff156 17.74 MiB 20.09 MiB 2.35 MiB
8fe7c9d 17.75 MiB 20.11 MiB 2.36 MiB
afe5fcb 17.75 MiB 20.11 MiB 2.36 MiB
cdf2bdf 17.74 MiB 20.10 MiB 2.36 MiB
abb7058 17.73 MiB 19.83 MiB 2.10 MiB
ddc0552 17.74 MiB 20.09 MiB 2.35 MiB
7bc4d75 17.74 MiB 20.08 MiB 2.34 MiB
a5d86e1 17.74 MiB 20.08 MiB 2.34 MiB

Previous results on branch: kw-record-ttd-on-focus

Startup times

Revision Plain With Sentry Diff
6f08f4b 436.76 ms 435.30 ms -1.46 ms

App size

Revision Plain With Sentry Diff
6f08f4b 17.75 MiB 20.12 MiB 2.37 MiB

Copy link
Contributor

github-actions bot commented Mar 18, 2025

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 583.51 ms 614.51 ms 31.00 ms
Size 7.15 MiB 8.40 MiB 1.24 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d0bf494+dirty 253.73 ms 308.23 ms 54.49 ms
ad6c299+dirty 336.47 ms 362.89 ms 26.42 ms
6707be9+dirty 431.52 ms 461.14 ms 29.62 ms
fc150fe+dirty 409.55 ms 407.37 ms -2.18 ms
7d161c0+dirty 383.35 ms 398.73 ms 15.38 ms
e73d82f+dirty 377.67 ms 407.06 ms 29.39 ms
e22745e+dirty 415.50 ms 448.76 ms 33.26 ms
c81e67f+dirty 355.71 ms 364.96 ms 9.24 ms
1faf8e3+dirty 412.83 ms 470.49 ms 57.66 ms
9f0f6c8+dirty 365.53 ms 419.16 ms 53.63 ms

App size

Revision Plain With Sentry Diff
d0bf494+dirty 7.15 MiB 8.04 MiB 910.85 KiB
ad6c299+dirty 7.15 MiB 8.04 MiB 912.17 KiB
6707be9+dirty 7.15 MiB 8.38 MiB 1.23 MiB
fc150fe+dirty 7.15 MiB 8.38 MiB 1.23 MiB
7d161c0+dirty 7.15 MiB 8.39 MiB 1.23 MiB
e73d82f+dirty 7.15 MiB 8.34 MiB 1.19 MiB
e22745e+dirty 7.15 MiB 8.35 MiB 1.20 MiB
c81e67f+dirty 7.15 MiB 8.39 MiB 1.23 MiB
1faf8e3+dirty 7.15 MiB 8.35 MiB 1.20 MiB
9f0f6c8+dirty 7.15 MiB 8.37 MiB 1.22 MiB

Previous results on branch: kw-record-ttd-on-focus

Startup times

Revision Plain With Sentry Diff
6f08f4b+dirty 399.23 ms 404.66 ms 5.43 ms

App size

Revision Plain With Sentry Diff
6f08f4b+dirty 7.15 MiB 8.39 MiB 1.24 MiB

Copy link
Contributor

github-actions bot commented Mar 18, 2025

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1243.58 ms 1249.19 ms 5.61 ms
Size 2.63 MiB 3.76 MiB 1.13 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e2b64fe+dirty 1232.22 ms 1255.20 ms 22.98 ms
a0b0298+dirty 1220.73 ms 1226.87 ms 6.14 ms
57448c5+dirty 1228.73 ms 1235.90 ms 7.16 ms
b1e8712+dirty 1256.02 ms 1265.14 ms 9.12 ms
0eacc98+dirty 1232.69 ms 1234.67 ms 1.97 ms
7bc4d75+dirty 1233.40 ms 1229.56 ms -3.83 ms
8b6825a+dirty 1209.50 ms 1207.22 ms -2.28 ms
cc8a6ca+dirty 1225.67 ms 1219.04 ms -6.63 ms
7f6950b+dirty 1235.53 ms 1227.30 ms -8.23 ms
db3192f+dirty 1214.63 ms 1214.60 ms -0.03 ms

App size

Revision Plain With Sentry Diff
e2b64fe+dirty 2.36 MiB 2.85 MiB 495.80 KiB
a0b0298+dirty 2.63 MiB 3.75 MiB 1.12 MiB
57448c5+dirty 2.36 MiB 3.10 MiB 752.34 KiB
b1e8712+dirty 2.36 MiB 2.84 MiB 488.84 KiB
0eacc98+dirty 2.63 MiB 3.69 MiB 1.05 MiB
7bc4d75+dirty 2.36 MiB 3.10 MiB 752.58 KiB
8b6825a+dirty 2.63 MiB 3.75 MiB 1.12 MiB
cc8a6ca+dirty 2.63 MiB 3.75 MiB 1.12 MiB
7f6950b+dirty 2.36 MiB 3.11 MiB 760.04 KiB
db3192f+dirty 2.63 MiB 3.76 MiB 1.13 MiB

Previous results on branch: kw-record-ttd-on-focus

Startup times

Revision Plain With Sentry Diff
6f08f4b+dirty 1211.91 ms 1218.62 ms 6.71 ms

App size

Revision Plain With Sentry Diff
6f08f4b+dirty 2.63 MiB 3.76 MiB 1.13 MiB

Copy link
Contributor

github-actions bot commented Mar 18, 2025

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1217.17 ms 1217.20 ms 0.04 ms
Size 3.19 MiB 4.33 MiB 1.14 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e2b64fe+dirty 1285.78 ms 1297.56 ms 11.78 ms
a0b0298+dirty 1227.71 ms 1234.12 ms 6.41 ms
57448c5+dirty 1244.65 ms 1249.20 ms 4.55 ms
b1e8712+dirty 1284.11 ms 1297.82 ms 13.71 ms
0eacc98+dirty 1223.85 ms 1233.12 ms 9.27 ms
7bc4d75+dirty 1222.13 ms 1216.39 ms -5.74 ms
8b6825a+dirty 1210.41 ms 1199.10 ms -11.31 ms
cc8a6ca+dirty 1238.31 ms 1242.00 ms 3.69 ms
7f6950b+dirty 1250.94 ms 1252.92 ms 1.98 ms
db3192f+dirty 1221.33 ms 1217.61 ms -3.71 ms

App size

Revision Plain With Sentry Diff
e2b64fe+dirty 2.92 MiB 3.41 MiB 499.97 KiB
a0b0298+dirty 3.19 MiB 4.32 MiB 1.13 MiB
57448c5+dirty 2.92 MiB 3.66 MiB 756.65 KiB
b1e8712+dirty 2.92 MiB 3.40 MiB 494.15 KiB
0eacc98+dirty 3.19 MiB 4.25 MiB 1.07 MiB
7bc4d75+dirty 2.92 MiB 3.66 MiB 757.15 KiB
8b6825a+dirty 3.19 MiB 4.32 MiB 1.13 MiB
cc8a6ca+dirty 3.19 MiB 4.32 MiB 1.13 MiB
7f6950b+dirty 2.92 MiB 3.67 MiB 772.53 KiB
db3192f+dirty 3.19 MiB 4.33 MiB 1.14 MiB

Previous results on branch: kw-record-ttd-on-focus

Startup times

Revision Plain With Sentry Diff
6f08f4b+dirty 1210.31 ms 1210.98 ms 0.67 ms

App size

Revision Plain With Sentry Diff
6f08f4b+dirty 3.19 MiB 4.33 MiB 1.14 MiB

@krystofwoldrich krystofwoldrich force-pushed the kw-record-ttd-on-focus branch from ceedad9 to a33f929 Compare March 19, 2025 12:38
@krystofwoldrich krystofwoldrich changed the title feat(ttd): Add `createTimeTo[Full|Initial]Display({useFocusEffect}) to allow record full display on screen focus feat(ttd): Measure time to display on screen focus Mar 21, 2025
@krystofwoldrich krystofwoldrich marked this pull request as ready for review March 24, 2025 08:57
Base automatically changed from kw/fix-ttfd-before-auto-ttid-equal-duration to main March 24, 2025 10:27
Copy link
Collaborator

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

LGTM 🚀
Thank you for the extensive tests 🙇

@krystofwoldrich krystofwoldrich merged commit 73fc872 into main Mar 25, 2025
71 of 72 checks passed
@krystofwoldrich krystofwoldrich deleted the kw-record-ttd-on-focus branch March 25, 2025 11:36
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.

2 participants