-
-
Notifications
You must be signed in to change notification settings - Fork 465
Warm start detection #3937
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
Warm start detection #3937
Conversation
- creates `onCreate` and `onStart` TimeSpans - set app start type to warm in AppStartMetrics when needed AppStartMetrics has now a method to restart appStartSpan and reset its uptime_ms PerformanceAndroidEventProcessor now attaches activity start spans to warm starts, too SentryPerformanceProvider doesn't create spans anymore TimeSpan.setStartUnixTimeMs now shifts other timestamps accordingly
…t app start timestamp reverted TimeSpan.setStartUnixTimeMs to @testonly method
Performance metrics 🚀
|
…ld start was invalid (app was started in background, like via BroadcastReceiver)
romtsn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'm a bit rusty in this part of the codebase already, would love @markushi to take a look
markushi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Nice job! Since SentryPerformanceProvider doesn't create any spans anymore it's worth mentioning that the app start spans will only be created if the SDK gets initialized before the first activity is launched. Maybe it's worth adding this to our changelog?
sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java
Outdated
Show resolved
Hide resolved
| final @Nullable ISpan ttfdSpan = ttfdSpanMap.get(activity); | ||
| final View rootView = activity.findViewById(android.R.id.content); | ||
| if (rootView != null) { | ||
| if (activity.getWindow() != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this check? Since we have a reference to the activity, we could always call irstDrawDoneListener.registerForNextDraw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a safety guard: if the window is null (i'm not sure it ever happens), the FirstDrawDoneListener.registerForNextDraw returns early, and the ttid is never stopped.
In this case i just post the ttid finish on the main thread, as it should be good enough
i think this was the case before, too, as the cold start span was created by the |
# Conflicts: # CHANGELOG.md
📜 Description
onCreateandonStartTimeSpansConfirm warm starts are registered for background starts (BroadcastReceiver)
Cold start:




Open second Activity:
Reopen first Activity without closing app:
Open first Activity after close app with
Don't keep activitydeveloper option enabled:💡 Motivation and Context
Fixes #3896
Relates and possibly fixes #3899
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
In a followup PR:
SentryPerformanceProviderActivityLifecycleIntegrationinstead of adding them toAppStartMetricsand let thePerformanceAndroidEventProcessoradd them to the transactionsetStartUnixTimeMsas it is a testOnly method. This means care, as the method is exposed to hybrid sdks