Go 1.11 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Go 1.11 アプリケーションをデプロイできなくなります。既存の Go 1.11 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Go に移行することをおすすめします。
モニタリングとアラートのレイテンシ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このページでは、Google App Engine でレイテンシの増大をモニタリングしてアラートを受け取る方法について説明します。
App Engine アプリでは、さまざまな理由でレイテンシが大きくなる可能性があります。たとえば、アプリのコードが最適化されていない、リソースが十分にない、ビジー状態のマシンが存在するといった理由が考えられます。このガイドでは、理由にかかわらず App Engine によって生成されるレイテンシに焦点を当てて説明します。
レイテンシの増大は 5xx エラーにつながる可能性が高いことを理解しておくことが重要です。したがって、レイテンシの増大を迅速に検出すれば、早い段階でこれに対処してアプリケーション エラーを解決できます。
モニタリングとアラートの設定
モニタリング
アプリのレスポンスのレイテンシをモニタリングするためにカスタマイズしたグラフを作成する場合は、[Cloud Monitoring] > [Metrics Explorer] を使用して独自のグラフを構築します。
[Metrics Explorer] ページに移動
[リソースの種類] で、[GAE アプリケーション] を選択し、[指標] フィルタで [レスポンスのレイテンシ] を選択します。確認する具体的なサービスがある場合は、[フィルタ] を使用して特定のモジュールでフィルタすることもできます。そうすると、そのサービスのレスポンス レイテンシ グラフが表示されます。
これでカスタマイズしたグラフを設定できたので、次のセクションでは、一定の秒数を超えるレイテンシの通知を設定する方法について説明します。
アラート
アラート ポリシーを作成する方法は次のとおりです。
- 通知を設定し、[Cloud Monitoring] > [アラート] でアラート ポリシーを作成して、[+ CREATE POLICY] をクリックします。
[ADD ALERT CONDITION] をクリックして、アラートに条件を追加します。
[アラート] ページに移動
ターゲットとして [GAE アプリケーション] を選択します。
たとえば、App Engine アプリの応答時間のようなレスポンスのレイテンシに関するアラートを受け取る場合は、[レスポンスのレイテンシ] を選択します。
状況に応じてモジュール ID を選択し、しきい値と通知チャンネルを追加することもできます。手順については、通知チャンネルの管理をご覧ください。
ポリシーの作成が終了すると、[アラート] ページの一覧にそのポリシーが表示されます。作成したポリシーをクリックすると、次の図のような詳細が表示されます。
以上で、最初の App Engine レイテンシ ポリシーが作成されました。ポリシーを作成した後は、インシデントが検出されると選択したチャンネルにアプリからアラートが送信されます。
レイテンシのデバッグ
App Engine レイテンシ ダッシュボードの確認
通常、App Engine アプリケーションのレイテンシを確認するには、[App Engine] > [ダッシュボード] に移動して [レイテンシ] グラフを選択します。
App Engine ダッシュボードに移動
レイテンシ グラフをサービス、バージョン、期間でフィルタして、データを詳しく調査できます。
上の図では、アプリケーションのレイテンシが数ミリ秒から 25 秒近くまで変動していることがわかります。
アプリのレイテンシについて
特定のリクエストにかかった時間をすぐに知りたい場合は、次の情報を調べます。
Cloud Logging
Cloud Logging では、リクエストログとアプリケーション ログの 2 種類のログを見ることができます。リクエストログは、アプリケーションへのリクエストごとに App Engine によって自動的に作成されるログで、HTTP メソッドやレスポンス コードなどが含まれます。アプリケーション ログは、ユーザーが書き込むアプリケーションのログです。
リクエストログまたはアプリケーション ログを表示するには、ログの表示をご覧ください。
Cloud Trace
Cloud Trace は、リクエストがアプリケーションを通じてどのように伝播するかを把握するために役立ちます。リクエストごとの詳しいレイテンシ情報の分析や、アプリケーション全体のレイテンシの確認などができます。
Cloud Trace でトレースの詳細を表示するには、トレースを検索して調査するの手順を実施します。次の図に示すように、[Trace エクスプローラ] でフィルタを使用して App Engine の特定のサービスやバージョンでトレースをフィルタできます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThis page guides you through monitoring and receiving alerts for elevated latency in Google App Engine applications.\u003c/p\u003e\n"],["\u003cp\u003eHigh latency in App Engine can be monitored using Cloud Monitoring's Metrics Explorer, which allows for customized graphs and filters based on service or module.\u003c/p\u003e\n"],["\u003cp\u003eAlerting policies for response latency can be created in Cloud Monitoring, where you can set thresholds and notification channels to receive alerts when latency exceeds specified levels.\u003c/p\u003e\n"],["\u003cp\u003eTo debug latency issues, you can check the App Engine dashboard's latency graph, which allows filtering by service, version, and interval.\u003c/p\u003e\n"],["\u003cp\u003eCloud Logging and Cloud Trace are available tools to further understand and debug app latency, allowing you to view request and application logs, and track request propagation through the application.\u003c/p\u003e\n"]]],[],null,["# Monitoring and alerting latency\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/legacy/standard/go111/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."]]