Monitoring API usage
Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to use API metrics to track and understand your usage
of Google APIs and Google Cloud APIs.
Google APIs produce detailed usage metrics that can help you:
Track and understand your usage of Google APIs.
Monitor performance of your applications and Google APIs.
Discover problems between your applications and Google APIs.
It can dramatically speed up resolution times when you troubleshoot problems
or need technical support from Google.
The metrics that Google APIs produce are the standard signals that Google's
own Site Reliability Engineers use to assess the health of a service.
These metrics covers request counts, error rates, total latencies, backend
latencies, request sizes, and response sizes. For the API metric definitions,
see
Cloud Monitoring documentation.
You can view API metrics in two places:
API Dashboard and
Cloud Monitoring. The metrics you see are specific to
your project, and they don't reflect the overall service status.
Using the API Dashboard
The simplest way to view your API metrics is to use the Google Cloud
console's API Dashboard. You can see an
overview of all your API usage, or you can drill down to your usage of a
specific API.
To see an overview of your API usage:
Visit Cloud console's APIs and Services section.
The main API Dashboard is displayed by default. In this page you can
see all the APIs you currently have enabled for your project,
as well as overview charts for the following metrics:
Traffic: the number of requests per second made by or about your
project to enabled APIs
Errors: the percentage of requests to enabled APIs that
resulted in errors
Median latency: the median latency for requests to enabled APIs,
if available".
To view usage details for a specific API:
Select the API you want to view in the main API Dashboard list of APIs.
The API's Overview page shows a more detailed traffic chart with a
breakdown by response code.
For even more detailed usage information, select View metrics.
By default, the following pre-built charts are displayed,
though more are available:
Traffic by response code
Errors by API method
Overall latency at the 50th, 95th, and 99th percentile
Latency by API method (median)
If you want to add more charts, you can select additional
pre-built charts from the Select Graphs drop-down menu.
Using Cloud Monitoring
If you use Cloud Monitoring, you can dive deeper into available metrics
data using the Metrics Explorer to give you greater insight into your API usage.
Cloud Monitoring supports a wide variety of metrics, which you can combine
with filters and aggregations for new and insightful views into your application
performance. For example, you can combine a request count metric with a filter
on the HTTP Response Code class to build a dashboard that shows error rates over
time, or you can look at the 95th percentile latency of requests to the Cloud
Pub/Sub API.
Available metrics
The following table lists the available serviceruntime metrics.
The API-usage metrics are those that include
consumed_api as a monitored resource.
The "metric type" strings in this table must be prefixed
with serviceruntime.googleapis.com/. That prefix has been
omitted from the entries in the table.
When querying a label, use the metric.labels. prefix; for
example, metric.labels.LABEL="VALUE".
Metric type Launch stage(Resource hierarchy levels) Display name
The count of completed requests. Sampled every 60 seconds. After sampling, data is not visible for up to 1800 seconds. protocol:
The protocol of the request, e.g. "http", "grpc".
response_code:
The HTTP response code for HTTP requests, or HTTP equivalent code for gRPC requests. See code mapping in https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto.
response_code_class:
The response code class for HTTP requests, or HTTP equivalent class for gRPC requests, e.g. "2xx", "4xx".
grpc_status_code:
The numeric gRPC response code for gRPC requests, or gRPC equivalent code for HTTP requests. See code mapping in https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto.
Distribution of backend latencies in seconds for non-streaming requests. Sampled every 60 seconds. After sampling, data is not visible for up to 1800 seconds.
Distribution of request latencies in seconds for non-streaming requests excluding the backend. Sampled every 60 seconds. After sampling, data is not visible for up to 1800 seconds.
Distribution of request sizes in bytes recorded at request completion. Sampled every 60 seconds. After sampling, data is not visible for up to 1800 seconds.
Distribution of response sizes in bytes recorded at request completion. Sampled every 60 seconds. After sampling, data is not visible for up to 1800 seconds.
The count of MCP requests. response_code:
The HTTP response code for HTTP requests, or HTTP equivalent code for MCP requests.
response_code_class:
The response code class for HTTP requests, or HTTP equivalent class for gRPC requests, e.g. '2xx', '4xx'.
The total consumed allocation quota. Values reported more than 1/min are dropped. If no changes are received in quota usage, the last value is repeated at least every 24 hours. Sampled every 60 seconds. quota_metric:
The name of quota metric or quota group.
The number of times exceeding the concurrent quota was attempted. Sampled every 86400 seconds. After sampling, data is not visible for up to 180 seconds. limit_name:
The quota limit name, such as "Requests per day" or "In-use IP addresses".
quota_metric:
The name of quota metric or quota group.
time_window:
The window size for concurrent operation limits.
The concurrent limit for the quota. Sampled every 86400 seconds. After sampling, data is not visible for up to 180 seconds. limit_name:
The quota limit name, such as "Requests per day" or "In-use IP addresses".
quota_metric:
The name of quota metric or quota group.
time_window:
The window size for concurrent operation limits.