Skip to content

Conversation

@stefanosiano
Copy link
Contributor

📜 Description

added isStartProfilerOnAppStart

#skip-changelog

💡 Motivation and Context

We are adding isStartProfilerOnAppStart, as per docs

💚 How did you test it?

Unit tests

📝 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

…Default 0.0)

sample rate is now evaluated inside AndroidContinuousProfiler and every time a session finishes
…ry.stopProfiler with Sentry.stopProfileSession
…ry.stopProfiler with Sentry.stopProfileSession
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
…rofiling-lifecycle

# Conflicts:
#	CHANGELOG.md
#	sentry-android-core/api/sentry-android-core.api
#	sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.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/AndroidContinuousProfilerTest.kt
#	sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt
#	sentry/api/sentry.api
#	sentry/src/main/java/io/sentry/ExperimentalOptions.java
#	sentry/src/main/java/io/sentry/IContinuousProfiler.java
#	sentry/src/main/java/io/sentry/NoOpContinuousProfiler.java
#	sentry/src/main/java/io/sentry/Scopes.java
#	sentry/src/main/java/io/sentry/SentryOptions.java
#	sentry/src/main/java/io/sentry/TracesSampler.java
#	sentry/src/test/java/io/sentry/NoOpContinuousProfilerTest.kt
#	sentry/src/test/java/io/sentry/ScopesTest.kt
#	sentry/src/test/java/io/sentry/SentryOptionsTest.kt
#	sentry/src/test/java/io/sentry/SentryTest.kt
@stefanosiano stefanosiano marked this pull request as ready for review March 4, 2025 12:21
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2025

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

Generated by 🚫 dangerJS against 23ee0ae

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 396.11 ms 404.06 ms 7.95 ms
Size 1.65 MiB 2.32 MiB 682.87 KiB

Previous results on branch: feat/continuous-profiling-app-start-option

Startup times

Revision Plain With Sentry Diff
783a2d2 388.38 ms 502.72 ms 114.34 ms
b96bfa5 409.75 ms 479.36 ms 69.61 ms
84030c2 417.94 ms 419.47 ms 1.53 ms

App size

Revision Plain With Sentry Diff
783a2d2 1.65 MiB 2.32 MiB 682.84 KiB
b96bfa5 1.65 MiB 2.32 MiB 682.91 KiB
84030c2 1.65 MiB 2.32 MiB 682.87 KiB

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.

LGTM!

// We always delete the config file for app start profiling
FileUtils.deleteRecursively(appStartProfilingConfigFile);
if (!options.isEnableAppStartProfiling()) {
if (!options.isEnableAppStartProfiling() && !options.isStartProfilerOnAppStart()) {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be an OR?

Suggested change
if (!options.isEnableAppStartProfiling() && !options.isStartProfilerOnAppStart()) {
if (!options.isEnableAppStartProfiling() || !options.isStartProfilerOnAppStart()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, if at least one of the options is true, then the profiler will start on next app start, and we need to create the config file for that

Base automatically changed from feat/continuous-profiling-lifecycle to feat/continuous-profiling-part1 March 14, 2025 16:17
…rofiling-app-start-option

# Conflicts:
#	sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java
#	sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt
#	sentry/api/sentry.api
#	sentry/src/main/java/io/sentry/ExperimentalOptions.java
#	sentry/src/main/java/io/sentry/SentryAppStartProfilingOptions.java
#	sentry/src/main/java/io/sentry/SentryOptions.java
#	sentry/src/test/java/io/sentry/JsonSerializerTest.kt
#	sentry/src/test/java/io/sentry/SentryOptionsTest.kt
@stefanosiano stefanosiano merged commit 3d0fb3c into feat/continuous-profiling-part1 Mar 14, 2025
30 checks passed
@stefanosiano stefanosiano deleted the feat/continuous-profiling-app-start-option branch March 14, 2025 17:08
stefanosiano added a commit that referenced this pull request Mar 18, 2025
* added IContinuousProfiler and implementations
* made AndroidProfiler's executor nullable, as timeout will be handled differently for continuous profiling

Change payload for Continuous Profiling v8 (p2) (#3711)
* 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

Add rate limit for Continuous Profiling v8 (p6) (#3926)
* 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

Add continuousProfilesSampleRate (#4013)
* 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

Wrap up continuous profiling  (#4069)
* Set continuousProfilesSampleRate and startProfiler() and stopProfiler() as experimental
* Added chunk start timestamp to ProfileChunk
* increased continuous profiling chunk duration to 1 minute

Change continuous profiling to session sample rate (#4180)
* 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

Rename continuous profiling APIs (#4182)
* renamed Sentry.startProfiler with Sentry.startProfileSession and Sentry.stopProfiler with Sentry.stopProfileSession

Add continuous profiling ProfileLifecycle (#4202)
* 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

Add Continuous Profiling isStartProfilerOnAppStart option (#4226)
* added isStartProfilerOnAppStart experimental option
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.

3 participants