您可以設定應用程式,讓應用程式收集特定資訊。您可以使用多種開放原始碼的檢測架構,從應用程式收集指標、記錄和追蹤記錄,並將資料傳送給任何供應商,包括 Google Cloud。如要檢測應用程式,建議您使用開放原始碼的廠商中立檢測架構 (例如 OpenTelemetry),而非廠商和產品專屬的 API 或用戶端程式庫。
[[["容易理解","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-05 (世界標準時間)。"],[],[],null,["# Collect metrics overview\n\nThis document describes what metrics are automatically available to you\nwhen you use Google Cloud services.\nIt also describes different approaches that\nyou can use to collect additional information about the performance of\nyour services.\n\nYou can monitor the (numeric) metric data stored in your Google Cloud project by\ncreating [alerting policies](/monitoring/alerts). These policies notify you when\nthe data monitored by the policy meets criteria that you define.\nYou can also visualize your\nmetric data by creating [charts](/monitoring/charts/metrics-explorer) and\n[dashboards](/monitoring/dashboards).\n\nThe metrics scope of a Google Cloud project determines the time-series data\nthat can be charted or monitored by the Google Cloud project. By default, the\nmetrics scope limits the project to the time-series data stored by\nproject. You can configure a metrics scope to include time-series data\nthat is stored by other projects.\nFor conceptual information and references to\nconfiguration documents, see [Metrics scopes overview](/monitoring/settings).\n\nMetrics from Google Cloud services\n----------------------------------\n\nSystem metrics generated by Google Cloud services are automatically\ncollected and stored by Cloud Monitoring. These metrics provide\ninformation about how the service is operating. For example,\nCompute Engine reports over 25 unique metrics for each\nvirtual machine (VM) instance.\n\nFor a complete list of available system metrics,\nsee [Google Cloud metrics](/monitoring/api/metrics_gcp).\n\nMetrics from your VMs\n---------------------\n\nSome system metrics are automatically captured from your Compute Engine\ninstances. However, these\n[automatically collected Compute Engine metrics](/monitoring/api/metrics_gcp_c#gcp-compute)\nmight not provide you with all the information\nthat you need to monitor your services.\n\nTo collect additional system metrics from your Compute Engine instances,\ninstall an agent. For example,\nthe [Ops Agent metrics](/monitoring/api/metrics_opsagent) include those for CPU, disk, memory,\nand swap. These metrics, and others, can be collected from your\nLinux and Windows VMs.\n\nFor agent information, see [Google Cloud Observability agents](/monitoring/agent).\n\nMetrics from integrations\n-------------------------\n\nCloud Monitoring provides integrations that let you collect telemetry\nfrom applications such as Apache\nWeb Server, MySQL, Redis, and others for deployments running on\nCompute Engine and Google Kubernetes Engine:\n\n- When using Compute Engine, third-party telemetry is collected by\n the [Ops Agent](/monitoring/agent/ops-agent).\n\n- When using GKE, third-party telemetry is collected by\n [Google Cloud Managed Service for Prometheus](/stackdriver/docs/managed-prometheus).\n\nIn the Google Cloud console, go to the\n**Integrations**\npage:\n\n[Go to **Integrations**](https://console.cloud.google.com/monitoring/integrations)\n\n\u003cbr /\u003e\n\nIf you use the search bar to find this page, then select the result whose subheading is\n**Monitoring**.\n\nMetrics you define\n------------------\n\n\nYou can instrument your application so that it collects\napplication-specific information. Several open-source\ninstrumentation frameworks let you collect metrics, logs, and\ntraces from your application and send that data to any vendor,\nincluding Google Cloud. To instrument your application, we recommend that you use a\nvendor-neutral instrumentation framework that is open source, such as\n[OpenTelemetry](https://opentelemetry.io/), instead of\nvendor- and product-specific APIs or client libraries.\n\nFor information about instrumenting your applications by using\nvendor-neutral instrumentation frameworks, see\n[Instrumentation and observability](/stackdriver/docs/instrumentation/overview).\n\nYou can instrument your application by using a client library\nor the [Cloud Monitoring API](/monitoring/docs/apis).\nFor more information about these\napproaches, see [User-defined metrics overview](/monitoring/custom-metrics).\n\nMetrics derived from logs\n-------------------------\n\nGoogle Cloud supports creating metrics from log data. These\n*log-based metrics* record numeric information about\nthe logs written to [Cloud Logging](/logging/docs).\nSome metrics, such as the total number of log entries received by your\nGoogle Cloud project, are automatically derived from your logs.\nYou can also define log-based metrics. For example, you might\ncreate a metric that counts the number of `404 Not Found` errors\nfor an application deployed to App Engine.\n\nFor more information, see [Log-based metrics overview](/logging/docs/logs-based-metrics).\n\nPricing\n-------\n\nIn general, Cloud Monitoring system metrics are free, and metrics\nfrom external systems, agents, or applications are not. Billable metrics are\nbilled by either the number of bytes or the number of samples ingested.\n\nFor more information, see the Cloud Monitoring sections of the [Google Cloud Observability pricing](https://cloud.google.com/stackdriver/pricing) page."]]