firebase / firebase/firebase-android-sdk

Ad hoc screen traces rather than Fragment only

Open
#3,756 4 comments 1 reaction 0 assignees View on GitHub
api: performance type: feature request
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 23h
Merged PRs (30d)
34

Description

## What feature would you like to see?

I understand that Firebase is implementing a method to automatically sample screentraces per-screen like Fragment on Android or ViewController on iOS. However, this isn't good enough for cross platform frameworks like React Native which runs in one fragment of one activity. Screens in React Native are sometimes a bunch of components nested in an RCTView (or its equivalent Android abstraction). Thus in React Native it's actually preferential to be able to start and stop a screentrace on demand, because the native code does not know when a React Native screen has mounted. Could the ScreenTrace API be provided on an **ad hoc** basis with start/stop methods? Could the Fragment based workflow be shut off so we can instrument our own ScreenTrace?

## How would you use it?

1. React Native App starts
2. developer calls `ScreenTrace.start('StartScreen')`
3. the user navigates to the next React Native screen
4. developer calls `ScreenTrace.stop('StartScreen')` and `ScreenTrace.start('MySecondScreen')`

Like in previous versions, a screentrace is always running but now the developer has fine tuned control over when to start and stop the screen trace and what name to give it.

Big thanks to @mikehardy for helping me triage this issue in RN

Contributor guide

Open the contributing guide

Research direction

Start by locating the Firebase Performance Android ScreenTrace API and the Fragment-based screen-trace workflow; the issue does not name specific files or tests. Review how screen traces are currently started and stopped, then determine the API and opt-out behavior needed for React Native. Done means developers can control named traces explicitly and disable the automatic Fragment workflow, with coverage for both paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, firebase, java, react-native
Domain
mobile-dev, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.