-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
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
sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java
Outdated
Show resolved
Hide resolved
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
sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java
Show resolved
Hide resolved
# 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
# Conflicts: # sentry-opentelemetry/sentry-opentelemetry-bootstrap/src/main/java/io/sentry/opentelemetry/OtelSpanFactory.java # sentry-opentelemetry/sentry-opentelemetry-extra/api/sentry-opentelemetry-extra.api
* continuous profiler now doesn't start if offline or rate limited * continuous profiler stops when rate limited * continuous profiler prevents sending chunks after being closed * added profile_chunk rate limit * continuous profiler now reset its id when rate limited or offline
🚨 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:
|
* added SentryOptions.continuousProfilesSampleRate * now continuous profiling is disabled if continuousProfilesSampleRate is 0 * profiles directory is created when continuous profiling is enabled, too * continuous profiling decision is passed to SentryAppStartProfilingOptions * app start continuous profiling is sampled, too
* Set continuousProfilesSampleRate and startProfiler() and stopProfiler() as experimental * Added chunk start timestamp to ProfileChunk * increased continuous profiling chunk duration to 1 minute
* Set continuousProfilesSampleRate and startProfiler() and stopProfiler() as experimental * Added chunk start timestamp to ProfileChunk * Moved setContinuousProfilesSampleRate into ExperimentalOptions * increased chunk duration to 1 minute * replaced continuousProfilesSampleRate with profileSessionSampleRate (Default null) * sample rate is now evaluated inside AndroidContinuousProfiler and every time a session finishes
* renamed Sentry.startProfiler with Sentry.startProfileSession and Sentry.stopProfiler with Sentry.stopProfileSession
* Added ProfileLifecycle * Sentry.startProfileSession() will work only in MANUAL mode * Tracer start will start profiler only in TRACE mode * Tracer and spans now attach profilerId only when sampled
* added isStartProfilerOnAppStart experimental option
# Conflicts: # CHANGELOG.md # sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java # sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java # sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java # sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt # sentry/api/sentry.api # sentry/src/main/java/io/sentry/ExperimentalOptions.java # sentry/src/main/java/io/sentry/SentryTracer.java # sentry/src/main/java/io/sentry/SpanContext.java # sentry/src/main/java/io/sentry/TracesSampler.java # sentry/src/main/java/io/sentry/util/SampleRateUtils.java # sentry/src/test/java/io/sentry/ScopesTest.kt # sentry/src/test/java/io/sentry/protocol/ContextsTest.kt # sentry/src/test/java/io/sentry/util/SampleRateUtilTest.kt
# Conflicts: # CHANGELOG.md
🚨 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:
|
🚨 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:
|
🚨 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:
|
📜 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 -> #3926
Handle rate limiting
Part 7 -> #4013
Add sample rate
Part 8
Update docs
User docs -> getsentry/sentry-docs#11872
Wrap everything up -> #4069
Continuous Profiling can now be pushed out as experimental feature.
The following PRs are required before GA.
Changing sample rate to session sample rate -> Change continuous profiling to session sample rate #4180
Rename APIs -> Rename continuous profiling APIs #4182
add profile_lifecycle option (manual or trace) -> Add continuous profiling ProfileLifecycle #4202
add
start_profiler_on_app_start
option -> Add Continuous Profiling isStartProfilerOnAppStart option #4226use single chunk for multiple transactions with a small gap -> Continuous Profiling - Add delayed stop #4293
get out of experimental -> Continuous Profiling - Out of Experimental #4310
stop when app goes in background -> Continuous Profiling - stop when app goes in background #4311
Add onboarding docs -> Update Android onboarding with Continuous Profiling sentry#88443
Update docs -> Update Android continuous profiling instructions and options sentry-docs#13219
💡 Motivation and Context
💚 How did you test it?
Unit tests
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps