Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getsentry/sentry-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: getsentry/sentry-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cursor/sentry-envelope-meta-length-dd17
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 11 commits
  • 25 files changed
  • 3 contributors

Commits on Mar 30, 2026

  1. feat(profiling): Add useProfilingManager option

    Adds a new boolean option `useProfilingManager` that gates whether
    the SDK uses Android's ProfilingManager API (API 35+) for Perfetto-based
    profiling. On devices below API 35 where ProfilingManager is not
    available, no profiling data is collected — the legacy Debug-based
    profiler is not used as a fallback.
    
    Wired through SentryOptions and ManifestMetadataReader (AndroidManifest
    meta-data). Defaults to false (opt-in).
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    0d34c42 View commit details
    Browse the repository at this point in the history
  2. chore(samples): Update sample app to support Perfetto profiling testing

    Adds UI controls to the profiling sample activity for testing both
    legacy and Perfetto profiling paths. Enables useProfilingManager
    flag in the sample manifest for API 35+ testing.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    86e585c View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2026

  1. feat(profiling): Skip legacy app-start profiling when useProfilingMan…

    …ager is set
    
    When useProfilingManager is true, SentryPerformanceProvider now skips
    creating the legacy Debug-based profiler at app start. This ensures
    AndroidOptionsInitializer creates a Perfetto profiler instead, without
    needing special handover logic between the two profiling engines.
    
    The useProfilingManager flag is persisted in SentryAppStartProfilingOptions
    (written at end of Sentry.init(), read on next app launch) so the
    decision is available before SDK initialization.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    squash into options commit
    43jay committed Mar 31, 2026
    Configuration menu
    Copy the full SHA
    788d91a View commit details
    Browse the repository at this point in the history
  2. feat(profiling): Add PerfettoProfiler and wire into AndroidContinuous…

    …Profiler
    
    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>
    43jay and claude committed Mar 31, 2026
    Configuration menu
    Copy the full SHA
    022a6b2 View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2026

  1. ref(profiling): Extract PerfettoContinuousProfiler from AndroidContin…

    …uousProfiler
    
    Separate the Perfetto/ProfilingManager profiling backend into its own
    IContinuousProfiler implementation to keep the two backends independent.
    
    - AndroidContinuousProfiler is restored to legacy-only (no Perfetto fields,
      no conditional branches, no @SuppressLint annotations)
    - PerfettoContinuousProfiler is a new @RequiresApi(35) class that delegates
      to PerfettoProfiler and always sets content_type="perfetto"
    - AndroidOptionsInitializer branches on useProfilingManager to pick the
      right implementation
    - Consistent locking: startInternal/stopInternal both require caller to
      hold the lock, with callers wrapped accordingly
    - Renamed rootSpanCounter to activeTraceCount in PerfettoContinuousProfiler
    - Extracted tryResolveScopes/onScopesAvailable from initScopes in both classes
    - Fixed duplicate listener bug in PerfettoProfiler (was using local lambda
      instead of class-scope profilingResultListener)
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Apr 1, 2026
    Configuration menu
    Copy the full SHA
    77bec23 View commit details
    Browse the repository at this point in the history
  2. test(profiling): Add unit test for PerfettoContinuousProfiler rate li…

    …miting
    
    Verify that onRateLimitChanged stops the profiler, resets profiler/chunk
    IDs, and logs the expected warning.
    
    Run with:
      ./gradlew :sentry-android-core:testDebugUnitTest --tests "io.sentry.android.core.PerfettoContinuousProfilerTest"
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Apr 1, 2026
    Configuration menu
    Copy the full SHA
    2cbcdba View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2026

  1. ref(profiling): Remove app-start profiling logic from PerfettoContinu…

    …ousProfiler
    
    Currently PerfettoContinuousProfiler is not doing app-start profiling.
    Because of this, scopes are always available. Remove the
    legacy patterns that were carried over from AndroidContinuousProfiler:
    
    - Replace tryResolveScopes/onScopesAvailable with resolveScopes() that
      returns @NotNull IScopes and logs an error if scopes is unexpectedly
      unavailable
    - Remove payloadBuilders list, payloadLock, and sendChunks() buffering;
      replace with sendChunk() that sends a single chunk immediately
    - Remove scopes != null guards and SentryNanotimeDate fallback
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Apr 7, 2026
    Configuration menu
    Copy the full SHA
    39cf934 View commit details
    Browse the repository at this point in the history
  2. ref(profiling): Improve thread safety in PerfettoContinuousProfiler

    - Add lock to isRunning(), getProfilerId(), getChunkId() so all public
      getters are synchronized with writes in startInternal/stopInternal
    - Add lock to reevaluateSampling() and remove volatile from shouldSample;
      all accesses are now under the same lock
    - Add Caller must hold lock javadoc to resolveScopes()
    - Add class-level javadoc documenting the threading/locking policy
    - Replace ArrayDeque with ConcurrentLinkedDeque in PerfettoProfiler for
      frame measurement collections; these are written by the FrameMetrics
      HandlerThread and read by the executor thread in endAndCollect()
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Apr 7, 2026
    Configuration menu
    Copy the full SHA
    d9d4774 View commit details
    Browse the repository at this point in the history
  3. chore(samples): Improve ProfilingActivity UI for Perfetto testing

    - Show active profiler status line with (i) info button to show
      SDK config (sample rates, lifecycle mode, use-profiling-manager)
    - Conditionally show Start(Manual) or Start(Transaction) button based
      on profileLifecycle mode, since each is a no-op in the wrong mode
    - Hide duration seekbar in MANUAL mode (only affects transaction length)
    - Remove inline profiling result TextView; show results via Toast and
      in the (i) dialog instead
    - Apply AppTheme.Main to fix edge-to-edge clipping on API 35+
    - Add indices to the bitmap list items so user can see the list view
      jumping around
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Apr 7, 2026
    Configuration menu
    Copy the full SHA
    26f0316 View commit details
    Browse the repository at this point in the history
  4. chore: Run spotlessApply and apiDump

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    43jay and claude committed Apr 7, 2026
    Configuration menu
    Copy the full SHA
    4e173d3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    56eb859 View commit details
    Browse the repository at this point in the history
Loading