
Firebase Performance Monitoring on Android: Custom Traces & HTTP Metrics
Firebase Performance Monitoring on Android: Custom Traces & HTTP Metrics Firebase Performance Monitoring reveals bottlenecks in your app. Custom traces let you measure specific operations while automatic HTTP monitoring tracks network performance. Basic Performance Monitoring Setup class MyApplication : Application () { override fun onCreate () { super . onCreate () val firebasePerformance = FirebasePerformance . getInstance () firebasePerformance . isPerformanceCollectionEnabled = true } } Creating Custom Traces class DataRepository { fun fetchUserData () { val trace = FirebasePerformance . getInstance (). newTrace ( "fetch_user_data" ) trace . start () try { val response = apiService . getUser () trace . putAttribute ( "response_size" , response . data . size . toString ()) } finally { trace . stop () } } } Custom Metrics in Traces val trace = FirebasePerformance . getInstance (). newTrace ( "database_operation" ) trace . start () // Your operation here val duration = System . curren
Continue reading on Dev.to Tutorial
Opens in a new tab

