Hi, I am looking for way to add screen trace log f...
# compose
k
Hi, I am looking for way to add screen trace log for firebase performance metric to compose screens (similar to slow rendering/frozen frames metric of activity and fragment). Any idea where we should start and stop the trace?
m
Not sure if it is the best way but you can start the trace on every successful composition:
Copy code
@Composable
inline fun TraceCompositions() {
        SideEffect { Trace.beginSection() }
}
And stop the trace within a DisposableEffect, something like:
Copy code
@Composable
inline fun TraceCompositions() {
        SideEffect { Trace.beginSection() }
 DisposableEffect() {

        onDispose {
        Trace.endSection()
        }
    }
}