-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Fix Ensure app start type is set, even when ActivityLifecycleIntegration is not running #4216
base: 7.x.x
Are you sure you want to change the base?
Fix Ensure app start type is set, even when ActivityLifecycleIntegration is not running #4216
Conversation
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
ab6e139 | 393.55 ms | 447.32 ms | 53.77 ms |
904a89c | 322.18 ms | 410.63 ms | 88.45 ms |
45c7ce0 | 358.77 ms | 391.41 ms | 32.64 ms |
71b4c74 | 374.74 ms | 407.65 ms | 32.91 ms |
48f18b6 | 373.96 ms | 402.54 ms | 28.58 ms |
43531dd | 428.61 ms | 465.58 ms | 36.97 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
ab6e139 | 1.70 MiB | 2.36 MiB | 671.71 KiB |
904a89c | 1.70 MiB | 2.36 MiB | 671.74 KiB |
45c7ce0 | 1.70 MiB | 2.36 MiB | 672.38 KiB |
71b4c74 | 1.70 MiB | 2.36 MiB | 671.82 KiB |
48f18b6 | 1.70 MiB | 2.36 MiB | 672.40 KiB |
43531dd | 1.70 MiB | 2.36 MiB | 672.39 KiB |
sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java
Outdated
Show resolved
Hide resolved
|
||
/** | ||
* @param hasBundle true if the activity onCreate had a non-null bundle | ||
* @param lastKnownStart in case the app start is too long, resets the app start timestamp to this | ||
* value | ||
*/ | ||
public void updateAppStartType(final boolean hasBundle, final long lastKnownStart) { |
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.
/** | |
* @param hasBundle true if the activity onCreate had a non-null bundle | |
* @param lastKnownStart in case the app start is too long, resets the app start timestamp to this | |
* value | |
*/ | |
public void updateAppStartType(final boolean hasBundle, final long lastKnownStart) { | |
/** | |
* @param hasBundle true if the activity onCreate had a non-null bundle | |
* @param startUptimeMillis in case the app start is too long, resets the app start timestamp to this | |
* value, retrieved via System.uptimeMillis() | |
*/ | |
public void updateAppStartType(final boolean hasBundle, final long startUptimeMillis) { |
Just make it clear we want a time from System.uptimeMillis()
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.
Good!
Can you also add the activity configuration check in the ActivityLifecycleIntegration
, so that rotating the device doesn't count as warm start?
sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt
Outdated
Show resolved
Hide resolved
* changed RateLimiterTest `close cancels the timer` to use reflection
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.
there are a few things to adjust
sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java
Show resolved
Hide resolved
app.unregisterActivityLifecycleCallbacks(activityCallback); | ||
} | ||
} | ||
appStartMetrics.registerLifecycleCallbacks(app); |
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.
this is a behavioural change, as we were not doing it on API < 24, while now we would. I'd keep the previous check that returns early
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.
Yes, that's on purpose - otherwise we would need to duplicate half of the logic within AppStartMetrics
again, app start type, foreground importance, etc..
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Outdated
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Outdated
Show resolved
Hide resolved
…ityLifecycleIntegration.java Co-authored-by: Stefano <stefano.siano@sentry.io>
…der' of github.com:getsentry/sentry-java into markushi/fix/determine-app-start-type-via-content-provider
…der' of github.com:getsentry/sentry-java into markushi/fix/determine-app-start-type-via-content-provider
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Show resolved
Hide resolved
@stefanosiano @markushi, let me and @denrase know if we should try this again with RN and Flutter before merging since there have been many changes since the initial draft. |
@krystofwoldrich I'll test again and report back. |
@markushi @krystofwoldrich So i was not able to verify this, now we bail out earlier, as the data suggests the app is not started in foreground. Also could not see in the debugger that the relevant code-paths in ![]() |
sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
Outdated
Show resolved
Hide resolved
…rmance/AppStartMetrics.java
@denrase @krystofwoldrich can you try now? |
@stefanosiano Worked, now cold start is even detected when i'm in debug mode. 👍 ![]() |
I'm testing it with RN right now. |
Cold app start is correctly detected. But I struggle to get warm app start. |
Fix Ensure app start type is set, even when ActivityLifecycleIntegration is not running or init is deferred.
Fixes getsentry/sentry-react-native#4598