[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eThis page explains how to monitor and receive alerts for high latency in Google App Engine applications, which can prevent potential 5xx errors.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a custom latency graph in Cloud Monitoring's Metrics Explorer by selecting "GAE Application" as the resource type and "Response latency" as the metric.\u003c/p\u003e\n"],["\u003cp\u003eTo receive alerts for elevated latency, you can configure an alerting policy in Cloud Monitoring's Alerting section, setting "GAE Application" and the desired latency metric.\u003c/p\u003e\n"],["\u003cp\u003eThe App Engine dashboard provides a general overview of application latency, allowing you to filter by service, version, and interval.\u003c/p\u003e\n"],["\u003cp\u003eCloud Logging and Cloud Trace can be used to understand specific request latencies and how the request propagate respectively, with both allowing filtering by App Engine service and version.\u003c/p\u003e\n"]]],[],null,["# Monitoring and alerting latency\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page describes how to monitor and get alerts from elevated latency in\nGoogle App Engine.\n\nHigh latency for App Engine apps can occur for various reasons. For\nexample, the app does not have optimized code, there aren't enough resources,\nthere are busy machines, and so forth. This guide focuses on the latency\ngenerated by App Engine regardless of the reason.\n\nIt is important to understand that high latency can often lead to 5xx errors.\nTherefore, rapid detection of high latency can help you act in time and thus\nresolve application errors.\n\nSetting up Monitoring and Alerting\n----------------------------------\n\n### Monitoring\n\nIf you want to create a customized graph to monitor your app's response latency,\nuse **Cloud Monitoring** \\\u003e **Metrics Explorer** to build your own graph.\n\n[Go to Metrics Explorer page](https://console.cloud.google.com/monitoring/metrics-explorer)\n\nIn the **Resource Type** , select *GAE Application* and select *Response latency*\nin the **Metric** filter. If you have a specific service to check, you can also\nuse **Filters** to filter by the specific module to see the response latency\nchart.\n\nNow that you've set up your customized graph, let's take a look at the next\nsection and learn how to set up notifications for latencies over a certain\namount of seconds.\n\n### Alerting\n\nTo create an alerting policy, do the following:\n\n1. Set up notifications, create an alerting policy in **Cloud Monitoring** \\\u003e **Alerting** and click on **+ CREATE POLICY**.\n2. Add a condition to your alert by clicking **ADD CONDITION**.\n\n [Go to Alerting page](https://console.cloud.google.com/monitoring/alerting)\n3. Select GAE Application as a target:\n\nFor example, if you wanted to get alerts for response latency, such as how long\nyour App Engine app is taking to respond, select response latency.\n\nYou can also select the module ID if it's appropriate, and add a threshold and a\nnotification channel. See\n[Managing notification channels](https://cloud.google.com/monitoring/support/notification-options)\nfor instructions.\n\nAfter you have finished creating the policy, you will see the policy in a list\nin the Alerting page. Click on the created policy to see the details, as shown\nin the following image:\n\nCongratulations, you just created your first App Engine latency policy!\nAfter you create your policy, the app will send an alert to the selected channel\nif it detects an incident.\n\nDebugging latency\n-----------------\n\n### Checking the App Engine latency dashboard\n\nIn general, when you want to see the latency of App Engine applications,\ngo to **App Engine** \\\u003e **Dashboard** and select the **Latency** graph.\n\n[Go to App Engine dashboard](https://console.cloud.google.com/appengine)\n\nIn the latency graph, you can drill into the data by filtering the graphs by\nservice, version, and interval.\n\nIn the previous image, notice how the application latency varies from a few\nmilliseconds to almost 25s.\n\n### Understanding app latency\n\nTo understand now how long a particular request has taken, go to:\n\n- [Cloud Logging](/logging) to view request logs and application logs.\n- [Cloud Trace](/trace) to track how requests propagate.\n\n#### Cloud Logging\n\nIn Cloud Logging you can find two categories of logs, request logs and\napplication logs. Request logs are automatically written by App Engine\nfor each request to your application and contains the HTTP method, response\ncode, and so forth. Application logs are those that you write for your\napplication.\n\nTo view request logs or application logs, see\n[Viewing logs](/appengine/docs/flexible/writing-application-logs#viewing_logs).\n\n#### Cloud Trace\n\nCloud Trace is useful for understanding how requests propagate through your\napplication. You can inspect detailed latency information for a single request\nor view aggregate latency for your entire application.\n\nTo view trace details in Cloud Trace, you can follow\n[Find and explore traces](/trace/docs/finding-traces).\nIn the [Trace explorer](https://console.cloud.google.com/traces/list), as shown in the following\nimage, you can use the filters to filter by your specific App Engine\nservice and version."]]