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

Handle App Start Continuous Profiling v8 (p4) #3730

Merged

Conversation

stefanosiano
Copy link
Member

📜 Description

create app start continuous profiler instead of transaction profiler, based on config
updated SentryAppStartProfilingOptions with isContinuousProfilingEnabled flag
updated SentryOptions with isContinuousProfilingEnabled() method

#skip-changelog

💡 Motivation and Context

Handle App Start Continuous Profiler
Part 4 of #3710

💚 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

… based on config

updated SentryAppStartProfilingOptions with isContinuousProfilingEnabled flag
updated SentryOptions with isContinuousProfilingEnabled() method
@stefanosiano stefanosiano changed the base branch from main to feat/continuous-profiling-part3 September 30, 2024 10:09
Copy link
Contributor

github-actions bot commented Sep 30, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 540e276

@stefanosiano stefanosiano marked this pull request as ready for review September 30, 2024 12:04
@@ -98,6 +99,11 @@ public void shutdown() {
if (appStartProfiler != null) {
appStartProfiler.close();
}
final @Nullable IContinuousProfiler appStartContinuousProfiler =
Copy link
Member

Choose a reason for hiding this comment

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

as I understood there could be only one profiler at a time (cont. or tx-based), right? Just got an idea we could have a general IProfiler interface (that would have all the methods that IContinuousProfiler currently has), and then it'd have a sub-interface ITransactionProfiler with the tx-specific methods.

This way you could only manage one instance of IProfiler everywhere (like here) and it would be more readable I guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

you're probably right on this, but in the long term we will deprecate and optionally remove the transaction profiler.
I think the extraction of the AndroidProfiler is enough for now.
But we can refactor it if you have a strong preference

…rofiling-part4

# Conflicts:
#	sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java
#	sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java
#	sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
#	sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt
#	sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt
#	sentry/src/main/java/io/sentry/SentryOptions.java
Copy link
Contributor

github-actions bot commented Nov 13, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 409.29 ms 423.43 ms 14.14 ms
Size 1.65 MiB 2.31 MiB 677.72 KiB

Previous results on branch: feat/continuous-profiling-part4

Startup times

Revision Plain With Sentry Diff
b1083a7 427.67 ms 483.64 ms 55.96 ms

App size

Revision Plain With Sentry Diff
b1083a7 1.65 MiB 2.31 MiB 676.46 KiB

* AndroidContinuousProfiler now retrieve the scopes on start()
* removed profilesSampleRate from sample app to enable continuous profiling
* added Sentry.startProfiler and Sentry.stopProfiler APIs
@stefanosiano stefanosiano merged commit c0a7fd1 into feat/continuous-profiling-part3 Nov 14, 2024
24 of 25 checks passed
@stefanosiano stefanosiano deleted the feat/continuous-profiling-part4 branch November 14, 2024 14:49
stefanosiano added a commit that referenced this pull request Nov 14, 2024
* added profile context to SentryTracer
* removed isProfilingEnabled from AndroidContinuousProfiler, as it's useless
* added continuous profiler to SentryOptions
* added DefaultTransactionPerformanceCollector to AndroidContinuousProfiler
* updated DefaultTransactionPerformanceCollector to work with string ids other than transactions
* fixed ProfileChunk measurements being modifiable from other code
* added thread id and name to SpanContext.data
* added profiler_id to span data
* close continuous profiler on scopes close
* renamed TransactionPerformanceCollector to CompositePerformanceCollector
* added SpanContext.data ser/deser

Handle App Start Continuous Profiling v8 (p4) (#3730)
* create app start continuous profiler instead of transaction profiler, based on config
* updated SentryAppStartProfilingOptions with isContinuousProfilingEnabled flag
* updated SentryOptions with isContinuousProfilingEnabled() method
* cut profiler setup out in a specific function to improve readability of AndroidOptionsInitializer

Add new APIs for Continuous Profiling v8 (p5) (#3844)
* AndroidContinuousProfiler now retrieve the scopes on start()
* removed profilesSampleRate from sample app to enable continuous profiling
* added Sentry.startProfiler and Sentry.stopProfiler APIs
stefanosiano added a commit that referenced this pull request Nov 14, 2024
* added profile_chunk envelope create
* added IHub.captureProfileChunk and ISentryClient.captureProfileChunk
* added profilerId and chunkId reset logic to AndroidContinuousProfiler
* added absolute timestamps to ProfileMeasurementValue
* added ProfileContext to Contexts
* removed timestampMillis from MemoryCollectionData and CpuCollectionData, now it uses timestamp.nanotime() to achieve same result
* continuous profiler doesn't stop anymore when an error occurs, but continue scheduling restart

Instantiate continuous profiling v8 (p3) (#3725)
* added profile context to SentryTracer
* removed isProfilingEnabled from AndroidContinuousProfiler, as it's useless
* added continuous profiler to SentryOptions
* added DefaultTransactionPerformanceCollector to AndroidContinuousProfiler
* updated DefaultTransactionPerformanceCollector to work with string ids other than transactions
* fixed ProfileChunk measurements being modifiable from other code
* added thread id and name to SpanContext.data
* added profiler_id to span data
* close continuous profiler on scopes close
* renamed TransactionPerformanceCollector to CompositePerformanceCollector
* added SpanContext.data ser/deser

Handle App Start Continuous Profiling v8 (p4) (#3730)
* create app start continuous profiler instead of transaction profiler, based on config
* updated SentryAppStartProfilingOptions with isContinuousProfilingEnabled flag
* updated SentryOptions with isContinuousProfilingEnabled() method
* cut profiler setup out in a specific function to improve readability of AndroidOptionsInitializer

Add new APIs for Continuous Profiling v8 (p5) (#3844)
* AndroidContinuousProfiler now retrieve the scopes on start()
* removed profilesSampleRate from sample app to enable continuous profiling
* added Sentry.startProfiler and Sentry.stopProfiler APIs
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