getsentry / getsentry/sentry-java

Capture slow/frozen frames during entire visible lifecycle for Activities and Fragments

Abierto
#5,049 6 comentarios 5 reacciones 0 asignados Ver en GitHub
2. High Android Improvement Traces
Lenguaje dominante
Kotlin
Estrellas
1.4k
Forks
478
Merge medio
2 d 23 h
PR fusionados (30 d)
67

Descripción

### Problem Statement

Currently, Sentry's Activity/Fragment tracing only measures slow/frozen frames during the **load phase** (around onCreate). Everything after the initial load is lost.

**This creates a significant gap in UI performance monitoring:**

1. **Incomplete visibility** - Users experience frozen frames throughout their entire visible session on a screen, not just during initial load. Scrolling through lists, interacting with forms, animations during user actions - all these can cause jank but are currently invisible to Sentry.

2. **Firebase Performance parity gap** - Firebase Performance offers automatic **screen rendering traces** that track slow/frozen frames for the entire **visible lifecycle**:
- **Activities:** `OnActivityStarted()` → `OnActivityStopped()`
- **Fragments:** `OnFragmentResume()` → `OnFragmentPaused()`

This is one of the main reasons teams still run Firebase Performance alongside Sentry, adding SDK overhead and complexity.

3. **Real user impact unmeasured** - The most impactful frozen frames often happen during user interactions (button clicks, scroll, swipe gestures) rather than initial screen load. Without visible lifecycle tracking, we miss the frames that actually frustrate users.

**Context:** This request comes from multiple mobile teams at Delivery Hero (HungerStation/Pandora and other brands) who have validated the need for this feature in our internal Sentry working group.

### Solution Brainstorm

## Proposed Solution

Extend Activity/Fragment auto-instrumentation to capture slow/frozen frames for the **visible lifecycle**, not just the load phase.

### Implementation approach (matching Firebase Performance screen traces):

**For Activities:**
- **Start:** `OnActivityStarted()` - when the Activity becomes visible
- **Stop:** `OnActivityStopped()` - when the Activity is no longer visible

**For Fragments:**
- **Start:** `OnFragmentResume()` - when the Fragment becomes active
- **Stop:** `OnFragmentPaused()` - when the Fragment is paused

### What this captures:

- Frame rendering during user scroll interactions
- Jank during button presses and form interactions
- Animation performance throughout the visible session
- Any frozen frames that occur while the user is actively viewing the screen

### Expected benefits:

- **Full visibility** into UI performance throughout visible user sessions
- **Correlation with user actions** - Link frozen frames to specific interactions
- **Sampling compatibility** - Work with existing `TracesSamplerCallback` for controlling data volume
- **Dashboard integration** - Surface visible-lifecycle-wide metrics in Mobile Vitals

### Reference:

Firebase Performance screen traces: https://firebase.google.com/docs/perf-mon/screen-traces?platform=android

This feature would allow teams to consolidate on Sentry for mobile performance monitoring instead of running multiple SDKs.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.