docs/perf-mon/get-started.md
Project: /docs/perf-mon/_project.yaml Book: /docs/_book.yaml page_type: guide
{% include "_shared/apis/console/_local_variables.html" %} {% include "_local_variables.html" %} {% include "docs/perf-mon/_local_variables.html" %} {% include "_shared/firebase/_snippet_include_comment.html" %}
<link rel="stylesheet" type="text/css" href="/styles/docs.css" />This quickstart describes how to set up Firebase Performance Monitoring to help you to gain insight into the performance characteristics of your Flutter apps.
If you haven't already, configure and initialize Firebase in your Flutter project.
From the root directory of your Flutter project, run the following command to install the Performance Monitoring Flutter plugin:
flutter pub add firebase_performance
From the root directory of your Flutter project, run the following command:
flutterfire configure
Running this command ensures that your Flutter app's Firebase configuration is up-to-date and, for Android, adds the required Performance Monitoring Gradle plugin to your app.
Once complete, rebuild your Flutter project:
flutter run
After you've added the Performance Monitoring SDK, Firebase automatically starts collecting data related to your app's lifecycle (like app start time), and data for HTTP/S network requests.
On Flutter, automatic screen rendering performance monitoring is not possible for individual Flutter screens. A single view controller encapsulates your entire Flutter application natively so the underlying native Firebase SDK is not aware of screen transitions.
Note: When you add Performance Monitoring to your app, the Remote Config SDK is included as a dependency. If you already use Remote Config, you won't see any difference. However, if you're new to Remote Config, explore the Remote Config documentation to learn more about the various features you'll be able to access in your app.
Firebase starts processing the events when you successfully add the SDK to your app. If you're still developing locally, interact with your app to generate events for initial data collection and processing.
Note: The Performance Monitoring SDK batches events locally then sends them to Firebase periodically (every 30 seconds) or when the app comes back to foreground. So, there's a delay between an app interaction and when Firebase receives the event information from your app.
Continue to develop your app using a simulator or test device.
Generate events by switching your app between background and foreground several times, interacting with your app by navigating across screens, and/or triggering network requests.
Go to the Performance dashboard of the Firebase console. You should see your initial data display within a few minutes.
If you don't see a display of your initial data, review the troubleshooting tips.
Check your log messages for any error messages.
Performance Monitoring tags its log messages with the following tags so that you can filter your log messages:
Firebase/PerformanceFirebasePerformanceCheck for the following types of logs which indicate that Performance Monitoring is logging performance events:
Click on the URL to view your data in the Firebase console. It may take a few moments for the data to update in the dashboard.
To monitor performance data associated with specific code in your app, you can instrument custom code traces.
With a custom code trace, you can measure how long it takes your app to complete a specific task or set of tasks, such as loading a set of images or querying your database. The default metric for a custom code trace is its duration, but you can also add custom metrics, such as cache hits and memory warnings.
In your code, you define the beginning and the end of a custom code trace (and add any desired custom metrics) using the API provided by the Performance Monitoring SDK.
Visit Add monitoring for specific code to learn more about these features and how to add them to your app.
After you've validated Performance Monitoring using the an emulator and one or more test devices, you can deploy the updated version of your app to your users.
You can monitor performance data in the Performance dashboard of the Firebase console.
Learn more about data automatically collected by Performance Monitoring:
View, track, and filter your performance data in the Firebase console.
Add monitoring for specific tasks or workflows in your app by instrumenting custom code traces.