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

Various fixes to instrumentations running on the main thread #4051

Merged
merged 10 commits into from
Jan 16, 2025

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Jan 15, 2025

📜 Description

Here are just some preventive measure that will make less code/instructions to run on the main thread:

  • Safety check for the Window.Callback to not be a SentryWindowCallback already to prevent multiple callbacks running simultaneously
  • Get rid of requireNonNull calls as they are redundant (we do instanceof checks later on anyway)
  • Check if tracing is enabled before instrumenting File I/O streams, because otherwise they go into the void anyway
  • Speed up ViewUtils.findTarget method by avoiding ViewGroup children traversal if the touch was not within the ViewGroup bounds

Before

Screenshot 2025-01-13 at 23 36 38

After

Screenshot 2025-01-14 at 00 09 42

💡 Motivation and Context

Internal customer discussions

💚 How did you test it?

Manually + automated

📝 Checklist

  • 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.
  • I updated the wizard 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.

Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 422.89 ms 470.40 ms 47.50 ms
Size 1.70 MiB 2.36 MiB 672.13 KiB

@romtsn romtsn merged commit ed98d11 into 7.x.x Jan 16, 2025
29 checks passed
@romtsn romtsn deleted the rz/fix/main-thread-instrumentations branch January 16, 2025 08:04
markushi pushed a commit that referenced this pull request Jan 28, 2025
* Get rid of redundant requireNonNull

* Do not instrument Window.Callback multiple times

* Do not instrument FileIO if tracing is disabled

* Do not traverse children if a touch event is not within view groups bounds

* Add test for SentryFileOutputStream

* Fix test

* Fix test

* Changelog

* pr id

* Fix api dump
markushi added a commit that referenced this pull request Jan 30, 2025
* Various fixes to instrumentations running on the main thread (#4051)

* Get rid of redundant requireNonNull

* Do not instrument Window.Callback multiple times

* Do not instrument FileIO if tracing is disabled

* Do not traverse children if a touch event is not within view groups bounds

* Add test for SentryFileOutputStream

* Fix test

* Fix test

* Changelog

* pr id

* Fix api dump

* Fix BroadcastReceivers (#4052)

* Drop TempSesnorBreadcrumbIntegration

* Drop PhoneStateBreadcrumbsIntegration

* Reduce number of system events we're listening to and use RECEIVER_NOT_EXPORTED

* Format code

* Changelog

* Update CHANGELOG.md

Co-authored-by: Stefano <stefano.siano@sentry.io>

* Update CHANGELOG.md

Co-authored-by: Stefano <stefano.siano@sentry.io>

---------

Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
Co-authored-by: Stefano <stefano.siano@sentry.io>

* Only provide {{auto}} ip-address if sendDefaultPii is enabled

* Update changelog

* Reduce the number of IPC calls (#4058)

* Remove binder call for external storage

* Remove binder call for memory in profiler

* Cache static values to avoid binder calls

* Comment

* Changelog

* Formatting

* Fix tests

* Minor fixes

* change protected method in final class to private

---------

Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io>
Co-authored-by: stefanosiano <stefano.siano@sentry.io>

* Update Changelog

* Fix tests

---------

Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
Co-authored-by: Stefano <stefano.siano@sentry.io>
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.

2 participants