You can export Performance Monitoring data from Apple and Android apps into BigQuery for further analysis. BigQuery allows you to analyze the data using BigQuery SQL, export it to another cloud provider, and even use the data for your custom ML models.
Enable BigQuery export
Go to the Integrations page in the Firebase console, then click Link in the BigQuery card.
Follow the on-screen instructions to enable BigQuery.
When you enable BigQuery export for Performance Monitoring:
Firebase exports a copy of your existing data to BigQuery.
At initial linking, Firebase automatically schedules your BigQuery tables to backfill data from the past 7 days so that you can start experimenting right away. Allow a few hours for the initial data to be available in BigQuery.
You can also manually schedule data backfills for up to the past 30 days.
After the dataset is created, the location can't be changed, but you can copy the dataset to a different location or manually move (recreate) the dataset in a different location. To learn more, see Change dataset location.
Firebase sets up regular syncs of your data from your Firebase project to BigQuery. These daily export operations begin at 4:00 AM Pacific Time and usually finish in 24 hours.
By default, all apps in your project are linked to BigQuery and any apps that you later add to the project are automatically linked to BigQuery. You can manage which apps send data.
To deactivate BigQuery export, unlink your project in the Firebase console.
What data is exported to BigQuery?
For each app in the project, the export creates a table that includes all the captured performance events. Each row in the table is a single performance event that can be one of the following:
Duration trace — traces that collect, by default, the metric of "duration", which include app start, app-in-foreground, and app-in-background, as well as any developer-instrumented custom code traces
event_nameis the same as the trace name
Trace metric — custom metrics that are associated with developer-instrumented custom code traces
event_nameis the name of the metric
parent_trace_nameis the trace name that contains this metric
Screen trace — traces spanning the lifetime of a screen (screen rendering traces)
_st_plus the actual screen name
Network request — traces spanning the lifetime of a network request (HTTP network request traces)
event_nameis the categorized pattern of the network request URL
Each performance event contains attributes of the event (such as country and carrier of the client device), as well as event-specific information:
- Duration traces, trace metrics, and screen traces contain
- Trace metrics contain
- Screen traces contain
- Network traces contain
Detailed data schema
|event_timestamp||timestamp||Timestamp since Epoch when event started on client device (trace start, network start, etc.)|
|app_display_version||string||Display version of the application (for example, "4.1.7")
|app_build_version||string||Build version of the application (for example, "1523456")
|os_version||string||OS version of the client device
|device_name||string||Name of the client device (for example, "Google Pixel")|
|country||string||Two-letter country code of the country from which the event took place (for example, "US", or "ZZ" for unknown country)|
|carrier||string||Carrier of the client device|
|radio_type||string||Active radio type when the event took place (for example, "WIFI")|
|custom_attributes||ARRAY<RECORD>||All custom attributes attached to this event|
|custom_attributes.key||string||Key of the custom attribute|
|custom_attributes.value||string||Value of the custom attribute|
|event_type||string||Type of the event; possible values:
|event_name||string||Name of the event
|parent_trace_name||string||Name of the parent trace that carries the trace metric
Only present for
|trace_info||RECORD||Only present for
|trace_info.screen_info||RECORD||Only present for
|trace_info.screen_info.slow_frame_ratio||float64||Ratio of slow frames for this screen trace, between 0 and 1 (for example, a value of 0.05 means 5% of the frames for this screen instance took more than 16ms to render)|
|trace_info.screen_info.frozen_frame_ratio||float64||Ratio of frozen frames for this screen trace, between 0 and 1 (for example, a value of 0.05 means 5% of the frames for this screen instance took more than 700ms to render)|
|trace_info.metric_info||RECORD||Only present for
|trace_info.metric_info.metric_value||int64||Value of the trace metric|
|network_info||RECORD||Only present for
|network_info.response_code||int64||HTTP response code for the network response (for example, 200, 404)|
|network_info.response_mime_type||string||MIME type of the network response (for example, "text/html")|
|network_info.request_http_method||string||HTTP method of the network request (for example, "GET" or "POST")|
|network_info.request_payload_bytes||int64||Size of the network request payload
|network_info.response_payload_bytes||int64||Size of the network response payload
What can you do with the exported data?
The following sections offer examples of queries that you can run in BigQuery against your exported Performance Monitoring data.
View average app start latency break-down by country
SELECT AVG(trace_info.duration_us), country FROM `TABLE_NAME` WHERE _PARTITIONTIME > TIMESTAMP("YYYY-MM-DD") AND event_type = "DURATION_TRACE" AND event_name = "_app_start" GROUP BY 2;
Check the ratio of frozen frames against various conditions
For example, you can check the ratio of frozen frames alongside the amount of time users spend on each screen of your app when on different radio types (WiFi, 4G, etc.).
SELECT AVG(trace_info.duration_us / 1000000) AS seconds_on_screen, AVG(trace_info.screen_info.frozen_frame_ratio) AS frozen_frame_ratio, event_name, radio_type FROM `TABLE_NAME` WHERE _PARTITIONTIME > TIMESTAMP("YYYY-MM-DD") AND event_type = "SCREEN_TRACE" GROUP BY event_name, radio_type ORDER BY event_name, radio_type;
Compute cache hit rate for loading certain types of files from disk
This analysis assumes that you instrumented a custom code trace for loading from
disk with a custom attribute named
file-extension and a custom metric (a
cache-hit that is set to
1 if cache hit and
For example, you can compute the cache hit rate for loading PNG files from disk:
SELECT AVG(trace_info.metric_info.metric_value) AS cache_hit_rate FROM `TABLE_NAME` WHERE _PARTITIONTIME > TIMESTAMP("YYYY-MM-DD") AND event_type = "TRACE_METRIC" AND event_name = "cache-hit" AND parent_trace_name = "loadFromDisk" AND STRUCT("file-extension", "png") IN UNNEST(custom_attributes);
Check for the time of day that users issue network requests
For example, you can check at what hour of the day users from the United States issue network requests from your app:
SELECT count(1) AS hourly_count, EXTRACT(HOUR FROM event_timestamp) AS hour_of_day FROM `TABLE_NAME` WHERE _PARTITIONTIME > TIMESTAMP("YYYY-MM-DD") AND event_type = "NETWORK_REQUEST" AND country = "US" GROUP BY 2 ORDER BY 2;
Take your Performance Monitoring data anywhere
Sometimes you want to access your Performance Monitoring data server-side or push it to another third-party solution. There is currently no charge for exporting data.
You can export your data by:
Using the BigQuery web UI
Running the CLI command
Submitting an extract job via the API or client libraries.