Investigate adoption of ProfilingManager triggers

Aberta
#6,286 1 comentário 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@markushi já está trabalhando nisso.

Desde 21/10/2026.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

Android Platform: Android Platform: Java Product Area: Profiling

The ProfilingManager API offers a way to setup trigger based profiling (ref: https://developer.android.com/reference/android/os/ProfilingManager#addProfilingTriggers(java.util.List%3Candroid.os.ProfilingTrigger%3E)), giving us profiles for critical moments within the app's lifecycle.

The expected flow

  1. the SDK sets up triggers using .addProfilingTriggers()
  2. the SDK setups a results listener using .registerForAllProfilingResults()
  3. the SDK consumes the results via the listener / or (e.g. when the app gets killed) on the next app start (TBD: confirm if the listener re-delivers the profile, or if we need to scan the directory for profiles)

In contrast, our SDK right now only uses the requestProfiling()API and can only handle call stack profiles. (https://github.com/getsentry/sentry-java/blob/a5555eaf0f620eb63285e9d50ee239bfabff7c5e/sentry-android-core/src/main/java/io/sentry/android/core/PerfettoProfiler.java).

Investigation Scope
  1. Find out which triggers would be interesting for us
  2. Investigate what each trigger produces (see https://developer.android.com/reference/android/os/ProfilingManager#constants_1 for the types)
  3. Investigate the impact of having the existing profiler running side by side with the triggers (e.g. do multiple listeners receive all profiling results, can there be only one listener, who wins, are there any race conditions)
  4. For all PROFILING_TYPE_STACK_SAMPLING profiles
    1. Would it fit into our profile_chunk model? The main concerns are the profile duration and profile size.
    2. Can we link those profile_chunks to transactions or errors (via event.context.profiler.profiler_id)?
      1. For example a cold app start profile could be linked to the app.start transaction
      2. But as ProfilingManager runs in parallel to our sentry transaction model, is it feasible to link them? Are there timing races? When does the system deliver the results?
Out of Scope
  • Any kind of heap dump profiles
  • For PROFILING_TYPE_SYSTEM_TRACE profiles
    1. Could it be feasible to parse the trace on the SDK side, similar to what we do for tombstones via https://github.com/abovevacant/epitaph, and transform them into transactions?
    2. What's their size?
    3. Could it be feasible to add them as event attachments? If so, could we link them in time?
Linguagem predominante
Kotlin
Estrelas
1.4k
Forks
483
Merge médio
2d 54min
PRs com merge (30d)
207

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de getsentry/sentry-java

Todas as issues de getsentry/sentry-java

Issues semelhantes

Mais issues de Kotlin

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.