How to track frame metrics for Fragments with Firebase performance?
Asked Answered
A

2

9

Firebase Performance monitoring SDK for Android automatically tracks slow rendering and frozen frames for Activity. But there's no such data for Fragment. For example if activity A hosts 3 fragments, then it'll report slow rendering and frozen frames for activity A but there's no way of knowing which fragment is causing that. Is there a way to implement similar screen tracing for fragments?

Anthropology answered 17/1, 2020 at 7:24 Comment(1)
Contact Firebase support directly if you would like to submit a feature request. support.google.com/firebase/contact/supportUnwarrantable
H
0

Firebase performance now captures performance metrics for Fragments Out of the box. Please integrate to the Android SDK version 20.1.0 or above to start seeing the fragment metrics on the console.

More details on the feature and what to expect are here: https://firebase.google.com/docs/perf-mon/screen-traces?platform=android

Holo answered 8/7, 2022 at 16:15 Comment(1)
Hey @Holo would it be possible to add some functionality to this Fragment monitoring which allows us to customize the name of the Fragment? I'm finding this to be very noisy. For example in React Native if there are 100 Fragments named Screen then that would be a frustrating experience. Instead I would like to be able to control each Fragment's name so it's i.e. HomeScreen or AccountScreen. I don't want to do this with attributes because attributes are 2nd class citizen and not a great experience.Cubicle
C
4

This is correct that Firebase performance SDK doesn't capture frozen frames automatically(For Fragments) but we can do it manually. Refer to this doc by google: https://firebase.google.com/codelabs/measure-android-view-performance#7

And this ScreenTrace class: https://github.com/FirebaseExtended/codelab-measure-android-view-performance/blob/main/measure-view-performance-start/app/src/main/java/com/google/firebase/example/perfmon/ScreenTrace.java

Now we can use activity's fragment manager to start recording the trace or inside the Application class we can add the fragment lifecycle callback and start the record trace inside onAttach()

Caesarean answered 16/6, 2021 at 13:34 Comment(0)
H
0

Firebase performance now captures performance metrics for Fragments Out of the box. Please integrate to the Android SDK version 20.1.0 or above to start seeing the fragment metrics on the console.

More details on the feature and what to expect are here: https://firebase.google.com/docs/perf-mon/screen-traces?platform=android

Holo answered 8/7, 2022 at 16:15 Comment(1)
Hey @Holo would it be possible to add some functionality to this Fragment monitoring which allows us to customize the name of the Fragment? I'm finding this to be very noisy. For example in React Native if there are 100 Fragments named Screen then that would be a frustrating experience. Instead I would like to be able to control each Fragment's name so it's i.e. HomeScreen or AccountScreen. I don't want to do this with attributes because attributes are 2nd class citizen and not a great experience.Cubicle

© 2022 - 2024 — McMap. All rights reserved.