0
0
Firebasecloud~5 mins

Performance monitoring in Firebase - Commands & Configuration

Choose your learning style9 modes available
Introduction
Performance monitoring helps you see how fast your app works and find slow parts. It shows real data from users so you can fix problems and make your app better.
When you want to know if your app loads quickly for users.
When you need to find which part of your app is slow or causing delays.
When you want to track app speed changes after updates.
When you want to see how your app performs on different devices or networks.
When you want to get alerts if your app becomes slow or crashes.
Config File - firebase.json
firebase.json
{
  "performance": {
    "monitoringEnabled": true
  }
}

This file enables Firebase Performance Monitoring for your project.

The performance.monitoringEnabled key turns on performance data collection.

Commands
This command sets up Firebase Performance Monitoring in your project by adding necessary files and configurations.
Terminal
firebase init performance
Expected OutputExpected
=== Setting up Performance Monitoring ✔ Firebase Performance Monitoring setup complete.
This command deploys the performance monitoring configuration to Firebase so it starts collecting data from your app.
Terminal
firebase deploy --only performance
Expected OutputExpected
=== Deploying to 'your-project-id' ✔ Deploy complete!
--only - Deploy only the specified Firebase feature, here performance monitoring.
This command shows the collected performance metrics from your app so you can review app speed and issues.
Terminal
firebase performance:metrics
Expected OutputExpected
Metric Name Average Response Time App Start Time 1.2s Network Request Time 0.8s Screen Render Time 0.5s
Key Concept

If you remember nothing else from this pattern, remember: enabling and deploying Firebase Performance Monitoring lets you see real user app speed and find slow parts to fix.

Common Mistakes
Not running 'firebase init performance' before deploying.
Without initialization, the project lacks necessary setup files, so deployment fails or monitoring does not start.
Always run 'firebase init performance' first to set up monitoring.
Forgetting to deploy performance after initialization.
Changes are local until deployed, so no data is collected or visible in Firebase console.
Run 'firebase deploy --only performance' to activate monitoring in the cloud.
Expecting immediate data after deployment.
Performance data depends on user activity and can take time to appear.
Use the app normally and wait some time before checking metrics.
Summary
Run 'firebase init performance' to set up performance monitoring in your project.
Deploy the setup with 'firebase deploy --only performance' to start data collection.
Use 'firebase performance:metrics' to view app speed and performance data.