Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie mithilfe der von Cloud Endpoints automatisch erfassten Logs und Messwerte den Zustand der eigenen APIs überwachen können. Endpoints schreibt Informationen zu allen Anfragen, die Nutzer an Ihre API senden, und zu allen Antworten in Logs. Endpoints verfolgt außerdem drei der vier goldenen Überwachungssignale: Latenz, Traffic und Fehler. Mit diesen Nutzungs- und Leistungsmesswerten können Sie Ihre API überwachen.
Vorbereitung
Stellen Sie Ihre API bereit und senden Sie Anfragen, um Logs und Messwerte zur Ansicht zu generieren. Wenn noch nichts eingerichtet ist, folgen Sie der Schnellstartanleitung für Endpoints.
API-Übersicht
Wenn Sie einen Fehler in Ihrem Dienst beheben oder einfach für einen reibungslosen Ablauf sorgen möchten, rufen Sie die API-Übersicht auf.
Rufen Sie in der Google Cloud Console die Seite Endpoints > Dienste für Ihr Projekt auf:
Wenn Sie mehr als eine API haben, klicken Sie auf die zu überwachende API.
Achten Sie darauf, dass Sie sich auf dem Tab Übersicht befinden.
Grafiken
Im oberen Bereich sehen Sie Grafiken für einige der Messwerte. Hier können Sie auf einen Blick Spitzenwerte und Rückgänge ablesen. Sie haben folgende Möglichkeiten:
Wählen Sie in der rechten oberen Ecke der ersten Grafik über die Drop-down-Liste Grafiken auswählen die für Sie interessanten Messwerte aus und entfernen Sie die Messwerte, die nicht angezeigt werden sollen. Jeder Eintrag in der Drop-down-Liste enthält ein Fragezeichen. Wenn Sie den Zeiger darauf halten, wird eine Beschreibung des betreffenden Messwerts eingeblendet.
In der rechten oberen Ecke der Übersicht können Sie verschiedene Zeitspannen auswählen. Die in der Grafik angezeigten Werte werden an die Zeitspanne angepasst und auch die Punktgranularität ändert sich.
Methodentabelle
Wenn Sie die Daten weiter aufschlüsseln möchten, scrollen Sie zur Tabelle unter den Grafiken. Sie enthält Messwerte für einzelne Methoden der API. Sie haben folgende Möglichkeiten:
Wählen Sie in der rechten oberen Ecke der Tabelle über die Drop-down-Liste Spalten auswählen die für Sie interessanten Messwerte aus und entfernen Sie die, die nicht angezeigt werden sollen. Auch hier haben die Einträge ein Fragezeichen. Wenn Sie den Zeiger auf dieses Fragezeichen bewegen, wird eine Beschreibung angezeigt.
Wählen Sie in der rechten oberen Ecke der Übersicht mit dem entsprechenden Auswahlelement eine Zeitspanne für die Messwerte in der Tabelle aus. Die ausgewählte Zeitspanne gilt sowohl für die Grafiken als auch für die Tabelle.
Logs
Wenn Sie ein Problem in den Messwerten feststellen, rufen Sie die Seite Log-Explorer in derGoogle Cloud Console auf, um die Logs der Anfragen und Antworten für Ihre API anzusehen.
Sie können Logs für einzelne Methoden der API aufrufen. Dafür klicken Sie in der Tabelle auf Logs ansehen.
Sie können Logs für alle Methoden der API aufrufen. Klicken Sie dafür in der unteren rechten Ecke auf Alle Logs ansehen.
So finden Sie Endpoints-Logs direkt im Log-Explorer:
Rufen Sie in der Google Cloud Console die Seite Stackdriver > Logging auf:
Machen Sie sich zuerst mit der Log-Explorer vertraut.
Erstellen Sie Abfragen, um die anzuzeigenden Logeinträge einzuschränken. Sie können beispielsweise angeben, dass alle Anfragen mit einer Latenz von mehr als 300 Millisekunden ausgegeben werden sollen.
Senken konfigurieren und verwalten, um Ihre Logs an unterstützte Ziele weiterzuleiten
Sie können Logs an BigQuery streamen und dort weitere Analysen vornehmen, die unbearbeiteten Logs in Cloud Storage speichern oder die Logs an Messaging-Themen in Pub/Sub senden.
Nach einem bestimmten Nutzerprojekt filtern
API-Nutzer können die anzuzeigenden Messwerte nach einem bestimmten Nutzerprojekt filtern. Dafür müssen sie mit jeder Anfrage einen API-Schlüssel senden. Endpoints identifiziert anhand des API-Schlüssels das Projekt, mit dem die aufrufende Anwendung verknüpft ist. Der API-Schlüssel muss daher imGoogle Cloud -Projekt des API-Nutzers erstellt worden sein. Informationen zum Einschränken des Zugriffs auf die API mithilfe eines API-Schlüssels finden Sie hier:
So filtern Sie Messwerte für ein bestimmtes Nutzerprojekt:
Rufen Sie die Projektnummer des API-Nutzerprojekts ab. Wenn Sie keine Berechtigung für den Zugriff auf das API-Nutzerprojekt haben, bitten Sie eine berechtigte Person, die Projektnummer für Sie zu ermitteln.
Rufen Sie in der Google Cloud Console die Seite Endpoints > Dienste für Ihr Projekt auf.
Geben Sie in der linken oberen Ecke der Seite Übersicht die Projektnummer in das Bearbeitungsfeld Nach Projektnummer filtern ein.
Klicken Sie auf Filtern.
Die Messwerte auf der Seite werden aktualisiert, sodass nur der Traffic aus dem angegebenen Projekt angezeigt wird.
Benachrichtigungen
Die von Endpoints erfassten Messwerte stehen auch in Cloud Monitoring zur Verfügung. Mit Monitoring können Sie Benachrichtigungen einrichten, die über Latenz, Traffic und Fehler informieren. Die Sättigung ist das einzige goldene Signal, für das Sie keine Benachrichtigung mit Endpoints-Messwerten einrichten können. Welche Messwerte Sie zur Überwachung der Sättigung benötigen, hängt von Ihrer Anwendung ab. In Cloud Monitoring finden Sie eine Liste der verfügbaren Messwerte zur Einrichtung von Benachrichtigungen für die Sättigung.
So richten Sie Benachrichtigungen ein:
Wählen Sie in der Google Cloud Console das Google Cloud Projekt mit der überwachten Endpoints-API aus, die dem Konto zugeordnet ist.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eCloud Endpoints automatically logs and tracks key metrics for your APIs, including latency, traffic, and errors, to help monitor their health and performance.\u003c/p\u003e\n"],["\u003cp\u003eThe Endpoints Services page provides an overview of API performance through graphs and a methods table, allowing you to quickly spot trends and drill down into specific methods.\u003c/p\u003e\n"],["\u003cp\u003eThe Logs Explorer allows you to view logs of requests and responses for your API, either for individual methods or all methods, aiding in debugging and monitoring.\u003c/p\u003e\n"],["\u003cp\u003eYou can filter metrics to view traffic from specific consumer projects by using their project number and setting it on the overview page.\u003c/p\u003e\n"],["\u003cp\u003eCloud Monitoring allows you to set up alerts for latency, traffic, and errors, and you can use additional Cloud Monitoring metrics to alert on saturation.\u003c/p\u003e\n"]]],[],null,["# Monitoring your API\n\n\u003cbr /\u003e\n\nThis page describes how you can monitor the health of APIs you own by using the\nlogs and metrics Cloud Endpoints maintains for you automatically. When\nusers make requests to your API, Endpoints logs information about\nthe requests and responses. Endpoints also tracks three of the\n[four golden signals of monitoring](https://landing.google.com/sre/book/chapters/monitoring-distributed-systems.html#xref_monitoring_golden-signals):\nlatency, traffic, and errors. These usage and performance metrics help you monitor\nyour API.\n\nBefore you begin\n----------------\n\nYou must deploy your API and send requests to it in order to generate logs and\nmetrics for viewing. If you don't have anything set up yet, try the\n[Endpoints quickstart](/endpoints/docs/deploy-api).\n\nAPI overview\n------------\n\nWhen you are debugging an issue with your service or just want to ensure that\neverything is running fine, go to your API's overview:\n\n1. In the Google Cloud console, go to the **Endpoints** \\\u003e **Services** page for\n your project:\n\n\n [Go to the Endpoints Services page](https://console.cloud.google.com/endpoints)\n\n \u003cbr /\u003e\n\n2. If you have more than one API, click the one you want to monitor.\n\n3. Ensure you are on the **Overview** tab.\n\n### Graphs\n\nAt the top are graphs for some of the metrics, so you can spot any spikes\nand drops right away. You can:\n\n- In the top-right of the first graph, use the **Select graphs** drop-down list\n to show graphs for metrics you are interested in, and remove the ones you\n don't want to view. Each entry in the drop-down list has a question-mark\n that you can hold your pointer over to to see a description of the metric\n it displays.\n\n- In the top-right corner of the overview, adjust the graphs by selecting from\n the various time spans. This adjusts the time range of values displayed in\n these graphs, which also alters the point granularity.\n\n### Methods table\n\nWhen you are ready to drill down further, scroll below the graphs for a table\nwith metrics for individual methods in your API. You can:\n\n- In the top-right of the table, use the **Select columns** drop-down list to\n show the metrics you are interested in and remove the ones you don't want\n displayed. Entries here also have the question-mark that you can hold your\n pointer over to see a description.\n\n- In the top-right corner of the overview, select a time span for the\n metric values in the table by using the time span picker. This picks a time\n span for both the graphs and the table.\n\n### Logs\n\nWhen you spot an issue in the metrics, go to the **Logs Explorer** page in the\nGoogle Cloud console to see logs of the requests and responses for your API.\n\n- To see logs for individual methods of your API, in the table click\n **View logs**.\n\n- To see logs for all methods in your API, in the bottom-right corner click\n **View all logs**.\n\n- To locate Endpoints logs directly from the Logs Explorer page:\n\n 1. In the Google Cloud console, go to the **Stackdriver** \\\u003e **Logging**\n page:\n\n\n [Go to the Logs Explorer page](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n 2. Select **Produced API, \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e** , where\n \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e is the name of the\n Endpoints service.\n\nSee the\n[Endpoints logs reference](/endpoints/docs/frameworks/ref-endpoints-logs)\nfor details on the structure of the logs in the Logs Explorer.\n\nLearn what else you can do with the logs:\n\n- Get started using the\n [Logs Explorer](/logging/docs/view/logs-explorer-interface).\n\n Build queries to specify the set of log entries that you want to view, such\n as getting all requests with a latency greater than 300 milliseconds.\n- [Configure and manage sinks](/logging/docs/export/configure_export_v2) to\n route your logs to supported destinations\n This lets you stream logs to BigQuery for further analysis, save the\n raw logs to Cloud Storage, or send them to Pub/Sub messaging\n topics.\n\n### Filter for a specific consumer project\n\n|\n| **Alpha**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nTo see metrics for a specific consumer project, your API consumers must send an\nAPI key when making a request. Because Endpoints uses the API key\nto identify the project that the calling application is associated\nwith, the API key must have been created in the API consumer's\nGoogle Cloud project. To learn how to restrict access to your API by using\nan API key, see\n\n\nthe following:\n\n- [Java: Restricting API access with API keys](/endpoints/docs/frameworks/java/restricting-api-access-with-api-keys-frameworks).\n- [Python: Restricting API access with API keys](/endpoints/docs/frameworks/python/restricting-api-access-with-api-keys-frameworks).\n\nTo filter metrics for a specific consumer project:\n\n1. Get the\n [project number](/resource-manager/docs/creating-managing-projects#identifying_projects)\n of the API consumer's project. If you don't have permission to access the\n API consumer's project, ask someone who has permission to get the project\n number for you.\n\n2. In the Google Cloud console, go to the **Endpoints** \\\u003e **Services** page\n for your project.\n\n\n [Go to the Endpoints Services page](https://console.cloud.google.com/endpoints)\n\n \u003cbr /\u003e\n\n3. In the top-left corner of the **Overview** page, enter the project number in\n the **Filter by Project Number** field.\n\n4. Click **Filter**.\n\nThe metrics on the page update to reflect traffic only from the specified\nproject.\n\nAlerting\n--------\n\n|\n| **Beta**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nMetrics collected by Endpoints are also available in\nCloud Monitoring. You can use Monitoring to set up alerting\non latency, traffic, and errors. The only\n[golden signal](https://landing.google.com/sre/book/chapters/monitoring-distributed-systems.html#xref_monitoring_golden-signals)\nthat you cannot set up an alert for using Endpoints metrics is\nsaturation. The metrics that you need to monitor for saturation depend on your\napplication. See the list of\n[metrics](/monitoring/api/metrics)\navailable in Cloud Monitoring for metrics that you can use to set up alerting\non saturation.\n\nTo set up alerting:\n\n1. In the Google Cloud console, select the Google Cloud project\n with your Endpoints monitored API which is associated with the\n account.\n\n [Go to Google Cloud console](https://console.cloud.google.com/)\n2. By using the navigation pane, select **Monitoring**.\n\n3. Create an [alerting policy](/monitoring/alerts)\n to set up alerts for the\n [golden signals](https://landing.google.com/sre/book/chapters/monitoring-distributed-systems.html#xref_monitoring_golden-signals)\n by using the following:\n\n - Latency\n\n 1. For **Condition Type** , enter `Metric Threshold`.\n 2. For **Resource Type** , enter `Produced API`.\n 3. For the metric, enter `Request latencies`.\n 4. Enter the threshold you want to alert on and follow the rest of the [Alerts guide](/monitoring/alerts).\n - Traffic\n\n 1. For **Condition Type** , enter `Metric Threshold`.\n 2. For **Resource Type** , enter `Produced API`.\n 3. For the metric, enter `Request count`.\n 4. Enter the threshold you want to alert on and follow the rest of the [Alerts guide](/monitoring/alerts).\n - Errors\n\n 1. For **Condition Type** , enter `Metric Threshold`.\n 2. For **Resource Type** , enter `Produced API`.\n 3. For the metric, enter `Request count`.\n 4. For response-code-class, enter `5xx`.\n 5. Enter the threshold you want to alert on and follow the rest of the [Alerts guide](/monitoring/alerts).\n\n| **Note:** If your API hasn't logged a 5xx response yet, the alerting policy form doesn't offer it as a response-code-class.\n| **Note:** If the critical constraint for your service is network IO, you might be able to use one of the Endpoints's metrics to set up an alert. All Endpoints logs are under the **Resource Type** of `Produced API`.\n\nWhat's next\n-----------\n\n- [Endpoints logs](/endpoints/docs/frameworks/ref-endpoints-logs)\n- [Endpoints metrics](/monitoring/api/metrics_gcp_p_z#gcp-serviceruntime)"]]