[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\niOS+ Android \n\n\u003cbr /\u003e\n\nPerformance Monitoring uses *traces* to collect data about monitored processes in your app.\nA trace is a report that contains data captured between two points in time\nin your app.\n\nFor Apple and Android apps, Performance Monitoring *automatically* collects several traces\nrelated to app lifecycle. All these traces are like timers because they measure\nthe time it takes for the process to run (the \"duration\").\n\n- [App start trace](#app-start) --- A trace that measures the time between when\n the user opens the app and when the app is responsive\n\n- [App-in-foreground trace](#app-in-foreground) --- A trace that measures the\n time when the app is running in the foreground and available to the user\n\n- [App-in-background trace](#app-in-background) --- A trace that measures the\n time when the app is running in the background\n\nSince these traces only collect the metric \"duration\", they are sometimes called\n\"Duration traces\".\n\nYou can view data from these traces in the *Custom traces* subtab of the traces\ntable, which is at the bottom of the *Performance* dashboard (learn more about\n[using the console](#monitor-in-console) later on this page).\n| These out-of-the-box traces get you started with monitoring your app, but to learn about the performance of specific tasks or flows in your app, try out [instrumenting your own custom\n| traces of code](/docs/perf-mon/custom-code-traces) in your app.\n\nDefinitions for each trace\n\nPerformance Monitoring uses method calls and notifications in your app to determine when\neach type of trace starts and stops. All these traces are like timers because\nthey measure the time it takes for the process to run.\n\nApp start trace\n\nThis trace measures the time between when the user opens the app and when the\napp is responsive. In the console, the trace's name is `_app_start`. The\ncollected metric for this trace is \"duration\".\n\n- Starts when the application loads the first `Object` to memory.\n\n- Stops after the first successful run loop that occurs after the application\n receives the `UIApplicationDidBecomeActiveNotification` notification.\n\nApp-in-foreground trace\n\nThis trace measures the time when the app is running in the foreground and\navailable to the user. In the console, the trace's name is `_app_in_foreground`.\nThe collected metric for this trace is \"duration\".\n\n- Starts when the application receives the\n `UIApplicationDidBecomeActiveNotification` notification.\n\n- Stops when it receives the\n `UIApplicationWillResignActiveNotification` notification.\n\nApp-in-background trace\n\nThis trace measures the time when the app is running in the background. In the\nconsole, the trace's name is `_app_in_background`. The reported metric for this\ntrace is \"duration\".\n\n- Starts when the application receives the\n `UIApplicationWillResignActiveNotification` notification.\n\n- Stops when it receives the `UIApplicationDidBecomeActiveNotification`\n notification.\n\nMetrics collected by these traces\n\nThese traces are out-of-the-box traces, so you cannot add custom metrics or\ncustom attributes to them.\n\nAll these traces are like timers because they measure the time it takes for the\nmonitored process to run. The name of this collected metric is called\n\"duration\".\n\nTrack, view, and filter performance data\n\nTo view real-time performance data, make sure that your app uses a Performance\nMonitoring SDK version that's compatible with real-time data processing.\n[Learn more about real-time performance data](/docs/perf-mon/troubleshooting#faq-real-time-data).\n\nTrack key metrics in your dashboard\n\nTo learn how your key metrics are trending, add them to your metrics board at the top of the\n*Performance* dashboard. You can quickly identify regressions by seeing week-over-week\nchanges or verify that recent changes in your code are improving performance.\nFirebase Performance Monitoring dashboard\" /\\\u003e\n\nTo add a metric to your metrics board, follow these steps:\n\n1. Go to the [*Performance* dashboard](//console.firebase.google.com/project/_/performance)in the Firebase console.\n2. Click an empty metric card, then select an existing metric to add to your board.\n3. Click more_vert on a populated metric card for more options, for example to replace or remove a metric.\n\n\u003cbr /\u003e\n\nThe metrics board shows collected metric data over time, both in graphical form and as a\nnumerical percentage change.\n\nLearn more about [using the dashboard](/docs/perf-mon/console).\n\nView traces and their data\n\nTo view your traces, go to the\n[*Performance* dashboard](//console.firebase.google.com/project/_/performance)\nin the Firebase console, scroll down to the traces table, then click the appropriate subtab.\nThe table displays some top metrics for each trace, and you can even sort the list by the\npercentage change for a specific metric.\n\nPerformance Monitoring provides a troubleshooting page in the Firebase console that highlights metric\nchanges, making it easy to quickly address and minimize the impact of performance issues on your\napps and users. You can use the troubleshooting page when you learn about potential\nperformance issues, for example, in the following scenarios:\n\n- You select relevant metrics on the dashboard and you notice a big delta.\n- In the traces table you sort to display the largest deltas at the top, and you see a significant percentage change.\n- You receive an email alert notifying you of a performance issue.\n\nYou can access the troubleshooting page in the following ways:\n\n- On the metric dashboard, click the **View metric details** button.\n- On any metric card, select **more_vert\n =\\\u003e View details**. The troubleshooting page displays information about the metric you selected.\n- In the traces table, click a trace name or any metric value in the row associated with that trace.\n- In an email alert, click **Investigate now**.\n\nWhen you click a trace name in the traces table, you can then drill down into metrics of\ninterest. Click the\n**Filteradd** button to filter the data\nby attribute, for example:\nFirebase Performance Monitoring data being filtered by attribute\" /\\\u003e\n\n- Filter by *App version* to view data about a past release or your latest release\n- Filter by *Device* to learn how older devices handle your app\n- Filter by *Country* to make sure your database location isn't affecting a specific region\n\nLearn more about\n[viewing data for your\ntraces](/docs/perf-mon/console#view-traces-and-data).\n\nNext Steps\n\n- Learn more about\n [using attributes](/docs/perf-mon/attributes) to examine performance data.\n\n- Learn more about how to\n [track performance issues](/docs/perf-mon/issue-management) in the\n Firebase console.\n\n- [Set up alerts](/docs/perf-mon/alerts) for code changes that are degrading\n the performance of your app. For example, you can configure an email alert for\n your team if your app start time exceeds a threshold that you set.\n\n\u003c!-- --\u003e\n\n- View detailed reports of [user sessions](/docs/perf-mon/console#sessions) in which you can see a specific trace in a timeline context of other traces collected during the same session."]]