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

Set warm start delay heuristic to 2 seconds #863

Merged
merged 2 commits into from
May 20, 2024

Conversation

bidetofevil
Copy link
Collaborator

@bidetofevil bidetofevil commented May 17, 2024

Goal

At 60 seconds, the heuristic we are using to determine whether we are experiencing a warm start vs a cold start, which previously measured the time between the last event before activity onCreate is called to the activity onCreate of the Activity we consider to be the activity whose rendering will end startup, is too generous, leaving too much time for background app startups followed by a user-invoked launcher startup to be considered a cold startup.

As such, we are going to shrink that to a more reasonable 2 seconds, which is quite a bit of time already if that last even is the end of the Application onCreate. We are also counting the FIRST activity onCreate being invoked, event if it is not the startup activity, because that indicates the startup is happening.

Even with this fix, though, the implementation is still imperfect, because if we don't know when application onCreate finishes (which we don't know out of the box), we simply use the end of the Embrace SDK's init time as that. We should look to improve this heuristic by getting customers to set this information, much like how they call reportFullyDrawn() to sent the end of time startup for GPC.

Ideally, we don't even use this heuristic, but that is a longer term goal that we can't quite do it without some major time investment.

While this is not perfect, p99 should be plenty good enough - with a few false negatives leading to an actual cold start being tracked as a warm start. But that would still be better than the state of the startup traces now.

Testing

Added appropriate tests. I also did some consolidation so there is less repeats in the tests.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @bidetofevil and the rest of your teammates on Graphite Graphite

Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 55.55556% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 80.76%. Comparing base (aabe330) to head (33188c2).

Current head 33188c2 differs from pull request most recent head d62cd7e

Please upload reports for the commit d62cd7e to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #863      +/-   ##
==========================================
- Coverage   80.78%   80.76%   -0.03%     
==========================================
  Files         429      429              
  Lines       11469    11477       +8     
  Branches     1752     1756       +4     
==========================================
+ Hits         9265     9269       +4     
  Misses       1446     1446              
- Partials      758      762       +4     
Files Coverage Δ
...bracesdk/capture/startup/AppStartupTraceEmitter.kt 71.20% <55.55%> (-0.39%) ⬇️

... and 1 file with indirect coverage changes

@bidetofevil bidetofevil marked this pull request as ready for review May 20, 2024 06:22
@bidetofevil bidetofevil requested a review from a team as a code owner May 20, 2024 06:22
Copy link
Contributor

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator Author

bidetofevil commented May 20, 2024

Merge activity

  • May 20, 5:28 AM EDT: Graphite rebased this pull request as part of a merge.
  • May 20, 5:57 AM EDT: @bidetofevil merged this pull request with Graphite.

@bidetofevil bidetofevil merged commit 57c8ec6 into master May 20, 2024
2 checks passed
@bidetofevil bidetofevil deleted the hho/warm-start-threshold branch May 20, 2024 09:57
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.

None yet

2 participants