getsentry / getsentry/sentry-java

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

Đang mở
#5,049 6 bình luận 5 reaction 0 người được giao Xem trên GitHub
2. High Android Improvement Traces
Ngôn ngữ chính
Kotlin
Star
1.4k
Fork
478
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
69

Mô tả

### 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.