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

Warm starts cleanup #3954

Merged
merged 19 commits into from
Jan 3, 2025
Merged

Warm starts cleanup #3954

merged 19 commits into from
Jan 3, 2025

Conversation

stefanosiano
Copy link
Member

📜 Description

  • moved activity lifecycle spans logic into a separate class ActivityLifecycleSpanHelper
  • moved processInitSpan creation to AppStartMetrics
  • ActivityLifecycleIntegration now create regular spans, and adds TimeSpans to AppStartMetrics to handle hybrid SDKs
  • PerformanceAndroidEventProcessor does not add activity lifecycle spans to the transaction, as they are added by ActivityLifecycleIntegration directly
  • removed activity callback from SentryPerformanceProvider

💡 Motivation and Context

Cleans some code after the warm start changes
I added a separate PR to avoid having too many logical changes in one

💚 How did you test it?

📝 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

Sorry, something went wrong.

stefanosiano and others added 11 commits November 28, 2024 16:44

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
- creates `onCreate` and `onStart` TimeSpans
- set app start type to warm in AppStartMetrics when needed
AppStartMetrics has now a method to restart appStartSpan and reset its uptime_ms
PerformanceAndroidEventProcessor now attaches activity start spans to warm starts, too

SentryPerformanceProvider doesn't create spans anymore

TimeSpan.setStartUnixTimeMs now shifts other timestamps accordingly

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…t app start timestamp

reverted TimeSpan.setStartUnixTimeMs to @testonly method
…ld start was invalid (app was started in background, like via BroadcastReceiver)
…fecycleSpanHelper

moved processInitSpan creation to AppStartMetrics
ActivityLifecycleIntegration now create regular spans, and adds TimeSpans to AppStartMetrics to handle hybrid SDKs
PerformanceAndroidEventProcessor does not add activity lifecycle spans to the transaction, as they are added by ActivityLifecycleIntegration directly
# Conflicts:
#	sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java
Copy link
Contributor

github-actions bot commented Dec 3, 2024

🚨 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

Sorry, something went wrong.

Copy link
Contributor

github-actions bot commented Dec 5, 2024

🚨 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

Sorry, something went wrong.

Copy link
Contributor

github-actions bot commented Dec 5, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 495.90 ms 555.29 ms 59.39 ms
Size 1.70 MiB 2.36 MiB 671.98 KiB

Previous results on branch: fix/warm-starts-cleanup

Startup times

Revision Plain With Sentry Diff
55f973b 445.35 ms 510.94 ms 65.59 ms
91b2d45 432.93 ms 479.85 ms 46.92 ms
b66bbdb 419.41 ms 429.41 ms 10.00 ms
3c20f24 404.14 ms 488.88 ms 84.74 ms

App size

Revision Plain With Sentry Diff
55f973b 1.70 MiB 2.36 MiB 672.08 KiB
91b2d45 1.70 MiB 2.36 MiB 672.05 KiB
b66bbdb 1.70 MiB 2.36 MiB 669.84 KiB
3c20f24 1.70 MiB 2.36 MiB 669.84 KiB

@stefanosiano stefanosiano marked this pull request as ready for review December 5, 2024 12:17
Copy link
Contributor

github-actions bot commented Dec 5, 2024

🚨 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

Sorry, something went wrong.

Base automatically changed from fix/warm-starts to main December 23, 2024 16:19
# Conflicts:
#	CHANGELOG.md
#	sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java
#	sentry-android-core/src/main/java/io/sentry/android/core/PerformanceAndroidEventProcessor.java
#	sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java
#	sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt
#	sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt
#	sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt
Copy link
Contributor

github-actions bot commented Jan 2, 2025

🚨 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

Sorry, something went wrong.

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.

Nice one, looks goods to me! Left a few minor comments 🚀

Copy link
Contributor

github-actions bot commented Jan 3, 2025

🚨 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

Sorry, something went wrong.

@stefanosiano stefanosiano enabled auto-merge (squash) January 3, 2025 10:52
Copy link
Contributor

github-actions bot commented Jan 3, 2025

🚨 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

Sorry, something went wrong.

@stefanosiano stefanosiano merged commit 00c8eeb into main Jan 3, 2025
32 checks passed
@stefanosiano stefanosiano deleted the fix/warm-starts-cleanup branch January 3, 2025 11:15
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

3 participants