-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Add Continuous Profiling support (v8) #3710
base: 8.x.x
Are you sure you want to change the base?
Conversation
made AndroidProfiler's executor nullable, as timeout will be handled differently for continuous profiling
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Add Continuous Profiling support (v8) ([#3710](https://github.com/getsentry/sentry-java/pull/3710)) If none of the above apply, you can opt out of this check by adding |
Performance metrics 🚀
|
sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java
Show resolved
Hide resolved
} | ||
isRunning = true; | ||
|
||
closeFuture = executorService.schedule(() -> stop(true), MAX_CHUNK_DURATION_MILLIS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if we should start using dedicated executors per feature - our main one is getting busier and busier, so if it's not a big stretch I'd create a new executorService for the whole profiling thing (if it doesn't depend on other things being executed by the main one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, this should be in try-catch probably, because of RejectedExecutionException
sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java
Show resolved
Hide resolved
sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java
Outdated
Show resolved
Hide resolved
if (profiler == null) { | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if we should add an if (isRunning) { return; }
check here to not call profiler.start again in case of sequential start calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's already checked inside the AndroidProfiler.start()
, and logs a message and returns null in that case
# Conflicts: # sentry-android-core/src/main/java/io/sentry/android/core/AndroidProfiler.java # sentry-android-core/src/main/java/io/sentry/android/core/AndroidTransactionProfiler.java
# Conflicts: # sentry-android-core/src/main/java/io/sentry/android/core/AndroidProfiler.java
* 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
📜 Description
This is the first part for the continuous profiling support for Android.
Internal doc is here
Part 1
Add the implementation of the continuous profiler itself
Part 2 -> #3711
Create new envelope type and payload
Create and send profile_chunk envelope
Part 3 -> #3725
Instantiate profiler
Set ProfileContext to transactions and spans
Add performance collectors to the profiler
Part 4 -> #3730
Handle app start profiling
Part 5 -> #3844
Add new user-facing APIs
Part 6
Handle rate limiting
Part 7
Update docs
💡 Motivation and Context
💚 How did you test it?
Unit tests
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps