serviceruntime 指標は、プロジェクトのトラフィックの概要を示します。これらの指標は、ほとんどの Google Cloud API で使用できます。consumed_api モニタリング対象リソースタイプには、これらの一般的な指標が含まれています。これらの指標は 30 分ごとにサンプリングされるため、データが平滑化されます。
[[["わかりやすい","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 UTC。"],[[["\u003cp\u003eCloud Monitoring collects data from Google Cloud products, allowing for the setup of custom dashboards and usage alerts for monitoring metrics, events, and metadata.\u003c/p\u003e\n"],["\u003cp\u003eMonitored resources in Cloud Monitoring represent entities like virtual machines or databases, each with unique metrics and resource labels for detailed information.\u003c/p\u003e\n"],["\u003cp\u003eFirestore, available in Native and Datastore modes, offers specific metrics like \u003ccode\u003eapi/request_count\u003c/code\u003e, \u003ccode\u003eapi/request_latencies\u003c/code\u003e, \u003ccode\u003eapi/request_sizes\u003c/code\u003e, and \u003ccode\u003eapi/response_sizes\u003c/code\u003e to monitor API traffic, latencies, and payload sizes.\u003c/p\u003e\n"],["\u003cp\u003eEntity operation metrics, such as \u003ccode\u003eentity/read_sizes\u003c/code\u003e and \u003ccode\u003eentity/write_sizes\u003c/code\u003e, provide insights into the size of read and write operations within a Firestore database, although with less granular breakdowns than some other metrics.\u003c/p\u003e\n"],["\u003cp\u003eIndex and TTL metrics, including \u003ccode\u003eindex/write_count\u003c/code\u003e, \u003ccode\u003eentity/ttl_deletion_count\u003c/code\u003e, and \u003ccode\u003eentity/ttl_expiration_to_deletion_delays\u003c/code\u003e, allow monitoring of index write rates and the effectiveness of TTL policies in both Firestore modes.\u003c/p\u003e\n"]]],[],null,["# Understand performance monitoring in Firestore in Datastore mode\n\n[Cloud Monitoring](/monitoring/docs) collects\nmetrics, events, and metadata from Google Cloud products.\nWith Cloud Monitoring, you can also set up custom dashboards and usage\nalerts.\n\nThis document guides you through using metrics, learning about custom metrics\ndashboard, and setting alerts.\n\nMonitored Resources\n-------------------\n\nA monitored resource in Cloud Monitoring represents a logical or physical\nentity, such as a virtual machine, a database, or an application. Monitored\nresources contain a unique set of metrics that can be explored, reported through\na dashboard, or used to create alerts. Each resource also has a set of resource\nlabels, which are key-value pairs that hold additional information about the\nresource. Resource labels are available for all metrics associated with the\nresource.\n\nUsing the [Cloud Monitoring\nAPI](https://cloud.google.com/monitoring/api/resources), Firestore in Datastore mode\nperformance is monitored with the following resources:\n\nMetrics\n-------\n\nFirestore is available in two different modes, Firestore Native and\nFirestore in Datastore mode. For a feature\ncomparison between these two modes, see [Choose between database\nmodes](/firestore/docs/firestore-or-datastore).\n\nFor a complete list of metrics for the Firestore in Datastore\nmode, see [Firestore in Datastore\nmetrics](https://cloud.google.com/monitoring/api/metrics_gcp_d_h#gcp-datastore).\n\n### Service runtime metrics\n\nThe [`serviceruntime`](https://cloud.google.com/monitoring/api/metrics_gcp_p_z#gcp-serviceruntime)\nmetrics provide a high-level overview of a project's traffic. These metrics are\navailable for most Google Cloud APIs. The\n[`consumed_api`](https://cloud.google.com/monitoring/api/resources#tag_consumed_api)\nmonitored resource type contains these common metrics. These metrics are sampled\nevery 30 minutes resulting in data being smoothed out.\n\nAn important resource label for the `serviceruntime` metrics is `method`. This label\nrepresents the underlying RPC method called. The SDK method that you call may\nnot necessarily be named the same as the underlying RPC method. The reason is\nthat the SDK provides high-level API abstraction. However, when trying to\nunderstand how your application interacts with Firestore, it is\nimportant to understand the metrics based on the name of the RPC method.\n\nIf you need to know what the underlying RPC method is for a given SDK method,\nsee the [API documentation](/datastore/docs/reference/data/rpc/google.datastore.v1).\n\n#### api/request_count\n\nThis metric provides the count of completed requests, across protocol(request protocol, such as http, gRPC, etc.),\nresponse code ([HTTP response code](https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto)), `response_code_class` (response code class, such as 2xx, 4xx,etc.), and `grpc_status_code` ([numeric gRPC response code](https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto)). Use this metric to\nobserve the overall API request and calculate the error rate.\n[](/static/firestore/native/docs/images/cloudmon-req-count.png) **Figure 1.** api/request_count metric (click to enlarge).\n\nIn figure 1, requests that return a 2xx code grouped by service and method can be seen. 2xx codes are HTTP status codes that indicate the request was successful.\n[](/static/firestore/native/docs/images/cloudmon-req-count-1.png) **Figure 2.** api/request_count metric that return a 2xx code (click to enlarge).\n\nIn figure 2, commits grouped by `response_code` can be seen. In this example, we only see HTTP 200 responses which implies that the database is healthy.\n\nUse the following service runtime metrics to monitor your database.\n\n##### api/request_count in datastore_request resource type\n\nThe `api/request_count` metric is also available under the `datastore_request`\nresource type with `api_method` and `response_code` breakdowns. Use this metric\ninstead to take advantage of the finer sampling period, which helps catch\nspikes.\n[](/static/firestore/native/docs/images/cloudmon-datastore-req-count.png) **Figure 3.** api/request_count metric under the datastore_request resource (click to enlarge).\n\n##### api/request_latencies\n\nThe `api/request_latencies` metric provides latency distributions across all completed requests.\n\nFirestore records metrics from the **Firestore Service** component. Latency metrics include the time that Firestore receives the request to the time that Firestore finishes sending the response, including interactions with the storage layer. Due to this, round-trip latency (rtt) between the client and the Firestore service is not included in these metrics.\n**Figure 4.** api/request_latencies to calculate latency distribution.\n\n##### api/request_sizes and api/response_sizes\n\nThe `api/request_sizes` and `api/response_sizes` metrics respectively provide\ninsights into payload sizes (in bytes). These can be useful for understanding\nwrite workloads that send large amounts of data or queries that are too broad,\nand return large payloads.\n[](/static/firestore/native/docs/images/cloudmon-req-size.png) **Figure 5.** api/request_sizes and api/response_sizes metrics (click to enlarge).\n\nIn figure 5, a heatmap for response sizes for the `RunQuery` method can be seen.\nWe can see that sizes are steady, 50 bytes median, and overall between 10 bytes\nand 100 bytes. Note that payload sizes are always measured in uncompressed\nbytes, exclusive of transmission control overheads.\n\n### Entity operation metrics\n\nThese metrics provide distributions in bytes of payload sizes for reads (lookups\nand queries) and writes to a Firestore database. The values represent\nthe total size of the payload. For example, any results returned by a query.\nThese metrics are similar to the `api/request_sizes` and `api/response_sizes` metrics\nwith the main difference being the entity operation metrics provide more\ngranular sampling, but less granular breakdowns.\n\nFor example, the entity operation metrics use the `datastore_request` monitored\nresource so there is no service or method breakdown.\n\n- `entity/read_sizes`: Distribution of sizes of read entities, grouped by type.\n- `entity/write_sizes`: Distribution of sizes of written entities, grouped by operations.\n\n### Index metrics\n\nIndex write rates can be contrasted with the `document/write_ops_count` metric\nto understand the [index fanout\nratio](/datastore/docs/concepts/indexes#exploding_index).\n\n- `index/write_count`: Count of index writes.\n\n[](/static/firestore/native/docs/images/cloudmon-index-count.png) **Figure 7.** Index write rate contrasted with document write rate (click to enlarge).\n\nIn figure 7, you can see how index write rate can be contrasted with document\nwrite rate. In this example, for every document write, there are approximately 6\nindex writes, which is a relatively small index fanout rate.\n\n### TTL Metrics\n\nThe TTL metrics are available for both Firestore Native and\nFirestore in Datastore mode databases. Use these metrics to\nmonitor the effect of the [TTL\npolicy](/datastore/docs/ttl) enforced.\n\n- `entity/ttl_deletion_count`: Total count of entities deleted by TTL services.\n- `entity/ttl_expiration_to_deletion_delays`: Time elapsed between when an\n entity with a TTL expired, and when it was actually deleted.\n\n If you see that the TTL deletion delays are taking longer than 24 hours,\n [contact\n support](/datastore/docs/getting-support).\n\nWhat' next\n----------\n\n- Learn about [using the Cloud Monitoring dashboard](/datastore/docs/use-monitoring-dashboard) to view metrics."]]