Firebase Performance Monitoring Integration in Mobile Applications
Developer's profiler shows 60 fps. Firebase Crashlytics shows no crashes. But users write "everything is slow." Firebase Performance Monitoring is instrumentation for real-time response measurements on actual user devices, not in lab conditions.
What Performance Monitoring Measures
SDK automatically collects:
-
App start time — from
applicationDidFinishLaunchingcall to moment when app becomes interactive -
Screen rendering — for each
UIViewControlleron iOS andActivity/Fragmenton Android: slow frames (>16 ms) and frozen frames (>700 ms) -
Network requests — response time, request/response size, HTTP status for all requests via
URLSession/OkHttp
Plus custom traces for any code block.
Connection and Custom Traces
On iOS via Swift Package Manager or CocoaPods — add FirebasePerformance. SDK initializes automatically on startup via FirebaseApp.configure().
Custom trace for measuring expensive operation:
import FirebasePerformance
func loadProductCatalog() async {
let trace = Performance.startTrace(name: "load_product_catalog")
defer { trace?.stop() }
trace?.setValue("v2", forAttribute: "api_version")
let products = await productRepository.fetchAll()
trace?.incrementMetric("product_count", by: Int64(products.count))
}
On Android / Kotlin:
val trace = Firebase.performance.newTrace("load_product_catalog")
trace.start()
trace.putAttribute("api_version", "v2")
val products = productRepository.fetchAll()
trace.putMetric("product_count", products.size.toLong())
trace.stop()
putAttribute lets you segment traces in console by arbitrary parameters — e.g., view load time separately for each API version.
Network Requests and Custom NetworkInterceptor
Automatic request interception works via swizzling URLSession on iOS. If project uses custom URLSession or Alamofire, manual registration via HTTPMetric may be needed:
let metric = HTTPMetric(url: url, httpMethod: .get)
metric?.start()
URLSession.shared.dataTask(with: url) { data, response, error in
metric?.responseCode = (response as? HTTPURLResponse)?.statusCode ?? -1
metric?.stop()
}.resume()
For Alamofire — add EventMonitor that wraps metrics around each request.
What to Watch in Console
After integration, dashboard has:
| Metric | Alert Threshold |
|---|---|
| App start time | > 2 sec — issue |
| Slow frames | > 1% |
| Frozen frames | > 0.1% |
| Network request time | Anomalies by percentiles p50/p90/p95 |
Console shows breakdown by app version, country, device type, and OS. This is the only way to know that specific screen is slow only on Android 10 on budget devices.
What's Included in Work
- SDK addition and basic initialization
- Custom traces for key operations (data loading, heavy list rendering)
- Network request interception setup for non-standard stack
- Basic dashboard with alert thresholds
Timeline
Basic integration with automatic traces: 1 day. With custom traces for specific screens and Network interceptor setup: 2 days. Cost estimated individually.







