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

Move fragment auto span finish to onFragmentStarted #3424

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stefanosiano
Copy link
Member

📜 Description

moved fragment auto span finish to onFragmentStarted instead of onFragmentResumed to account for ViewPager2 behaviour

Other options considered, but failed:

  • getUserVisibleHint(): it's deprecated and returns true for all fragments
  • mMaxState: only accessible through reflection and returns the current max state achieved (in onFragmentStarted it will be STARTED, while in onFragmentResumed it will be RESUMED
  • isVisible: returns true for all fragments

💡 Motivation and Context

Fixes #3269

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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.

🔮 Next steps

@stefanosiano stefanosiano marked this pull request as ready for review May 15, 2024 15:16
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 399.94 ms 470.35 ms 70.41 ms
Size 1.70 MiB 2.28 MiB 592.08 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d6d2b2e 413.20 ms 486.76 ms 73.56 ms
baaf637 418.39 ms 496.86 ms 78.47 ms
bf82eb3 423.76 ms 506.45 ms 82.69 ms
5e04ee8 370.06 ms 442.52 ms 72.46 ms
c34791a 415.40 ms 498.22 ms 82.82 ms
baaf637 401.69 ms 428.12 ms 26.43 ms
99a51e2 405.11 ms 479.65 ms 74.54 ms
3d8bd2b 364.76 ms 469.98 ms 105.22 ms
4e29063 384.14 ms 447.74 ms 63.60 ms
2fad834 390.07 ms 470.80 ms 80.73 ms

App size

Revision Plain With Sentry Diff
d6d2b2e 1.72 MiB 2.27 MiB 555.05 KiB
baaf637 1.72 MiB 2.27 MiB 558.42 KiB
bf82eb3 1.70 MiB 2.28 MiB 587.99 KiB
5e04ee8 1.70 MiB 2.27 MiB 584.64 KiB
c34791a 1.70 MiB 2.28 MiB 587.88 KiB
baaf637 1.72 MiB 2.27 MiB 558.42 KiB
99a51e2 1.72 MiB 2.29 MiB 576.34 KiB
3d8bd2b 1.72 MiB 2.29 MiB 577.53 KiB
4e29063 1.72 MiB 2.29 MiB 578.38 KiB
2fad834 1.72 MiB 2.29 MiB 577.53 KiB

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.

SentryFragmentLifecycleCallbacks creates long running spans for ViewPager2
1 participant