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

Fix app start spans missing from Pixel devices #3634

Merged
merged 5 commits into from
Aug 12, 2024

Conversation

stefanosiano
Copy link
Member

📜 Description

Pixel devices were missing app start spans.

💡 Motivation and Context

We post a task on the main thread on Application creation and register a callback on activity creation to check if an activity has been created right after the application is created.
This works fine, unless running on Pixel devices, where the task posted on the main thread in application creation is called before the Activity.onCreate().
So we are now posting a task to post another task to check the activity creation, meaning we post it twice. This seems to work fine on Pixel devices from our tests
Closes #3608

💚 How did you test it?

📝 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 August 12, 2024 10:33
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 461.53 ms 573.17 ms 111.63 ms
Size 1.70 MiB 2.35 MiB 660.03 KiB

Comment on lines +244 to +247
// We post on the main thread a task to post a check on the main thread. On Pixel devices
// (possibly others) the first task posted on the main thread is called before the
// Activity.onCreate callback. This is a workaround for that, so that the Activity.onCreate
// callback is called before the application one.
Copy link
Member

Choose a reason for hiding this comment

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

🥇 for the comment

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.

... googol oh my ....

@stefanosiano stefanosiano merged commit 32eed6a into main Aug 12, 2024
26 checks passed
@stefanosiano stefanosiano deleted the fix/app-start-spans-missing branch August 12, 2024 16:39
This pull request was closed.
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.

Cold start measurement doesn't work in 7.12.1
3 participants