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

Check app start spans time and foreground state #3550

Merged
merged 10 commits into from
Jul 17, 2024

Conversation

stefanosiano
Copy link
Member

@stefanosiano stefanosiano commented Jul 4, 2024

📜 Description

App start now takes AppStartMetrics.appLaunchedInForeground variable in consideration when adding spans to the transaction. For some reason we were setting it, but never used it.
App starts longer than 1 minute are dropped (approach taken from Firebase)
Updated foreground app launch check, based on Firebase

💡 Motivation and Context

Should fix #3538 and #3329, implementing #3084

💚 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

…to add spans to the transaction

App starts longer than 1 minute are dropped (same as Firebase)
Copy link
Contributor

github-actions bot commented Jul 4, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 430.80 ms 494.08 ms 63.28 ms
Size 1.70 MiB 2.33 MiB 644.95 KiB

Previous results on branch: fix/app-start-foreground

Startup times

Revision Plain With Sentry Diff
e0d3b36 420.52 ms 521.90 ms 101.37 ms
e65564b 410.64 ms 481.40 ms 70.76 ms
99bdeb7 404.61 ms 476.26 ms 71.65 ms
09db9ad 433.32 ms 494.82 ms 61.50 ms
bcf684e 406.80 ms 477.94 ms 71.14 ms
331b61a 441.43 ms 494.88 ms 53.45 ms
2a3bf05 377.29 ms 459.94 ms 82.65 ms
715ec3c 544.45 ms 626.55 ms 82.10 ms

App size

Revision Plain With Sentry Diff
e0d3b36 1.70 MiB 2.33 MiB 644.95 KiB
e65564b 1.70 MiB 2.28 MiB 593.57 KiB
99bdeb7 1.70 MiB 2.28 MiB 593.89 KiB
09db9ad 1.70 MiB 2.28 MiB 594.01 KiB
bcf684e 1.70 MiB 2.28 MiB 594.07 KiB
331b61a 1.70 MiB 2.28 MiB 593.57 KiB
2a3bf05 1.70 MiB 2.28 MiB 593.69 KiB
715ec3c 1.70 MiB 2.28 MiB 593.89 KiB

added tests
@stefanosiano stefanosiano marked this pull request as ready for review July 4, 2024 15:44
Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

Nice! If left one comment about uptime vs. unix time that should be addressed, but apart from that LGTM!

added app launch foreground check to AppStartMetrics ctor
…yPerformanceProvider, other than AppStartMetrics.onApplicationCreate
@kahest
Copy link
Member

kahest commented Jul 11, 2024

@stefanosiano would be good to test if the scenario in #3567 is also fixed:

reproduce it if a push notification is received and the app is opened after some time(minutes or hours).

added foreground check to SentryAndroid.init
Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

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

LGTM!

# Conflicts:
#	CHANGELOG.md
#	sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt
…ate instead of class instantiation

AppStartMetrics callback is now registered only once
AppStartMetrics stops app start profiler if no activity is being created
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
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.

App startup measurements are incorrectly reported
4 participants