Skip to content

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Jan 16, 2025

📜 Description

  • Most of the changes I've done were mostly around caching values that are not going to change during the runtime of a process (like device name or app version code).
  • Introduced AndroidLazyEvaluator that is like LazyEvaluator but gets Context as an argument

Before (Binder calls on the main thread)

Screenshot 2025-01-15 at 22 50 58

After (Binder calls on the main thread)

Code 2025-01-16 23 37 58

💡 Motivation and Context

Finding Binder calls with trace-ipc and trying to reduce them to prevent main thread blockage potentially and other problems.

💚 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.

Next steps

There's still one standing out binder call left around checking network connectivity but this will do in a follow-up PR

@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 429.98 ms 514.00 ms 84.02 ms
Size 1.70 MiB 2.36 MiB 671.15 KiB

Previous results on branch: rz/fix/ipc-calls

Startup times

Revision Plain With Sentry Diff
ba9db79 448.98 ms 516.84 ms 67.86 ms
75c08f1 412.24 ms 497.08 ms 84.84 ms
eb9154f 419.19 ms 474.28 ms 55.09 ms

App size

Revision Plain With Sentry Diff
ba9db79 1.70 MiB 2.36 MiB 671.15 KiB
75c08f1 1.70 MiB 2.36 MiB 671.15 KiB
eb9154f 1.70 MiB 2.36 MiB 671.15 KiB

@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

Made a few small changes, LGTM now!

@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

Copy link
Contributor

@stefanosiano stefanosiano left a comment

Choose a reason for hiding this comment

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

looks good
In case it will ever be needed again, we could change the LazyEvaluator to have a generic parameter in the getValue().
That way we could even pass a Pair<Context, BuildInfoProvider> so that we don't need multiple evaluators for different API levels.
Not sure if it's worth it now, but let's keep it in mind in the future

@markushi markushi merged commit 6381921 into 7.x.x Jan 20, 2025
29 checks passed
@markushi markushi deleted the rz/fix/ipc-calls branch January 20, 2025 13:48
markushi added a commit that referenced this pull request Jan 28, 2025
* 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 <[email protected]>
Co-authored-by: stefanosiano <[email protected]>
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 <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Stefano <[email protected]>

---------

Co-authored-by: Sentry Github Bot <[email protected]>
Co-authored-by: Stefano <[email protected]>

* 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 <[email protected]>
Co-authored-by: stefanosiano <[email protected]>

* Update Changelog

* Fix tests

---------

Co-authored-by: Roman Zavarnitsyn <[email protected]>
Co-authored-by: Sentry Github Bot <[email protected]>
Co-authored-by: Stefano <[email protected]>
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.

4 participants