You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(profiling): Add PerfettoProfiler and wire into AndroidContinuousProfiler
Introduces PerfettoProfiler, which uses Android's ProfilingManager system
service (API 35+) for Perfetto-based stack sampling. When useProfilingManager
is enabled, AndroidContinuousProfiler selects PerfettoProfiler at init time
via createWithProfilingManager(); on older devices no profiling data is
collected and the legacy Debug-based profiler is not used as a fallback.
Key changes:
- PerfettoProfiler: calls requestProfiling(STACK_SAMPLING), waits for
ProfilingResult via CountDownLatch, reads .pftrace via getResultFilePath()
- AndroidContinuousProfiler: factory methods createLegacy() /
createWithProfilingManager() replace the public constructor; init() split
into initLegacy() / initProfilingManager() for clarity; stopFuture uses
cancel(false) to avoid interrupting the Perfetto result wait
- AndroidOptionsInitializer: branches on isUseProfilingManager() to select
the correct factory method
- SentryEnvelopeItem: fromPerfettoProfileChunk() builds a single envelope
item with meta_length header separating JSON metadata from binary .pftrace
- SentryEnvelopeItemHeader: adds metaLength field for the binary format
- ProfileChunk: adds contentType and version fields; Builder.setContentType()
- SentryClient: routes Perfetto chunks to fromPerfettoProfileChunk()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: sentry-android-core/api/sentry-android-core.api
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -41,8 +41,9 @@ public final class io/sentry/android/core/ActivityLifecycleIntegration : android
41
41
}
42
42
43
43
public class io/sentry/android/core/AndroidContinuousProfiler : io/sentry/IContinuousProfiler, io/sentry/transport/RateLimiter$IRateLimitObserver {
44
-
public fun <init> (Lio/sentry/android/core/BuildInfoProvider;Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;Lio/sentry/ILogger;Ljava/lang/String;ILio/sentry/util/LazyEvaluator$Evaluator;)V
45
44
public fun close (Z)V
45
+
public static fun createLegacy (Lio/sentry/android/core/BuildInfoProvider;Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;Lio/sentry/ILogger;Ljava/lang/String;ILio/sentry/util/LazyEvaluator$Evaluator;)Lio/sentry/android/core/AndroidContinuousProfiler;
46
+
public static fun createWithProfilingManager (Landroid/content/Context;Lio/sentry/android/core/BuildInfoProvider;Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;Lio/sentry/ILogger;Lio/sentry/util/LazyEvaluator$Evaluator;)Lio/sentry/android/core/AndroidContinuousProfiler;
46
47
public fun getChunkId ()Lio/sentry/protocol/SentryId;
47
48
public fun getProfilerId ()Lio/sentry/protocol/SentryId;
48
49
public fun getRootSpanCounter ()I
@@ -338,6 +339,12 @@ public final class io/sentry/android/core/NetworkBreadcrumbsIntegration : io/sen
338
339
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
339
340
}
340
341
342
+
public class io/sentry/android/core/PerfettoProfiler {
343
+
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;Lio/sentry/ILogger;)V
344
+
public fun endAndCollect ()Lio/sentry/android/core/AndroidProfiler$ProfileEndData;
345
+
public fun start (J)Lio/sentry/android/core/AndroidProfiler$ProfileStartData;
346
+
}
347
+
341
348
public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor {
342
349
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;Z)V
0 commit comments