Chart and monitor quota metrics

This document describes how to create alerting policies and charts to monitor quota allocated to you by Google Cloud, and it includes several examples. Google Cloud establishes various quotas that you can use to track and limit the resources consumed by a project or organization. For general information about quotas, including information on allocation quotas and rate quotas, see Working with quotas.

Before you begin

This document assumes familiarity with time-series data and its manipulation. The following resources provide additional information:

Quota management

Cloud Monitoring manages quota in two ways:

  • Consumer quota: For this type of quota, the monitored resource is consumer_quota. The metrics for this resource are a subset of the serviceruntime metrics.

    Most of the examples on this page are consumer-quota examples.

  • Resource-specific quotas: Some services provide monitored resources that have resource-specific metrics for quotas. These metric types appear in groups of three and follow a naming format:

    • service/quota/quota-type/exceeded
    • service/quota/quota-type/limit
    • service/quota/quota-type/usage

    For example, Compute Engine has the compute.googleapis.com/VpcNetwork resource. The quota-related metrics associated with this resource are the compute.googleapis.com/quota subset of the compute metrics. There are three metric types related to the "instances per VPC network" quota:

Identify quota metrics and limit names

Raw data about quota consumption, particularly for consumer quota, can include information about many different quotas. To extract information about a specific quota for a chart or alerting policy, you need to identify that subset of quota data.

Depending on the source, quota data might include labels that you can use to isolate the information you want. These labels include the following:

  • Quota metric: The quota metric is an identifier for a type of quota; it is not one of the metric types described in Metrics list. For example, all consumer-quota data is written as serviceruntime.googleapis.com metric type like quota/allocation/usage. This metric type has a quota_metric label that can be used to filter for a specific quota, for example, allocation-usage data.
  • Limit name: The limit name identifies a limit on a specific type of quota. A quota can have more than one limit associated with it. For example, a quota for read calls might have a per-minute limit of 100 and a per-day limit of 1000, with two limit names, readsPerMinute and readsPerDay. Quota-related metric types might have a limit_name field for this value.

All serviceruntime.googleapis.com/quota metric types provide the quota_metric label, but only some include the limit_name label. Resource-specific metric types for quota include the limit_name label.

Not all Google Cloud services support quota metrics. To determine if a service supports quota metrics and to identify the values of the quota-specific labels, you can use the following procedure:

  1. In the Google Cloud console, go to the Quotas & System Limits page:

    Go to Quotas & System Limits

    If you use the search bar to find this page, then select the result whose subheading is IAM & Admin.

  2. Click View column and add the following columns to the quota display:

    • Metric: This column displays the value of the quota_metric label.
    • Limit name: This column displays the value of the limit_name label.
    • Monitored resource: When populated, the quota uses the listed monitored resource. When empty, the monitored resource for the quota is consumer_quota.
  3. Locate the quota of interest.

    For example, the Compute Engine API subnetworks quota lists the Metric as compute.googleapis.com/subnetworks, the Limit name as SUBNETWORKS-per-project, and it doesn't list a Monitored resource. Therefore, the monitored resource for this quota is consumer_quota.

Example: View usage for a specific consumer quota metric

The goal is to create a chart that displays, by region, Compute Engine's total disk-storage quota. This consumer-quota example retrieves quota/allocation/usage data, and then filters the data so that allocation usage for a specific quota metric is displayed:

  1. In the Google Cloud console, select Cloud Monitoring, and then select Metrics Explorer.

  2. Select the Configuration tab.

  3. In the toolbar, set the time frame to one month by selecting 1M.

  4. Expand the Line chart menu and select Stacked bar chart.

  5. Configure Metrics Explorer to display the allocation quota usage:

    1. Click Select a metric and enter allocation in the Filter bar.
    2. Select Consumer Quota for the resource.
    3. Select Quota for the metric category.
    4. Select Allocation quota usage for the metric and the click Apply.

    Select consumer quota.

    The chart displays the allocation-quota usage as a bar chart for the period of six weeks. By viewing the legend, you see that the chart displays the quota usage for multiple services.

    If you use the Cloud Monitoring API, then the equivalent filter value is:

    metric.type="serviceruntime.googleapis.com/quota/allocation/usage" resource.type="consumer_quota"
    

    You can view this filter value by expanding the Resource type menu and then selecting Direct filter mode.

  6. To limit the chart to the Compute Engine service, add the filter service = compute.googleapis.com:

    Filter consumer quota by compute service.

    If you use the Cloud Monitoring API, then the equivalent filter value is:

    metric.type="serviceruntime.googleapis.com/quota/allocation/usage" resource.type="consumer_quota" resource.label.service="compute.googleapis.com"
    

    The chart now displays the time series for the allocated quota usage for Compute Engine quotas. The legend displays the value of the quota_metric label for each displayed time series. This value identifies the specific quota. For example, compute.googleapis.com/disks_total_storage identifies the time series for Compute Engine's total disk-storage quota.

    The chart displays quota usage only for those quotas that have recorded usage. For example, if the project doesn't have any Compute Engine resources, then filtering for the compute.googleapis.com service results in a chart with no data.

  7. To create a chart that displays Compute Engine's total disk storage quota usage, use the filter quota_metric = compute.googleapis.com/disks_total_storage:

    Filter consumer quota by quota metric.

    If you use the Cloud Monitoring API, then the equivalent filter value is:

    metric.type="serviceruntime.googleapis.com/quota/allocation/usage" resource.type="consumer_quota" metric.label.quota_metric="compute.googleapis.com/disks_total_storage"
    
  8. The previous chart displays time series for the regions us-central1 and us-east1, and for multiple zones including the zone us-central1-a.

    To refine the chart so that it displays data only for the regions, without the zones, add a filter based on the location label. For this example, where both regions are prefixed by us- and end with 1, a filter that uses the regular expression location =~ ^us.*1$ works well:

    Filter by quota metric and region.

For consumer quota, the value of the quota_metric label identifies both the service and the specific quota usage being monitored. When you create charts or alerting policies that monitor a specific quota metric, you use that information.

Alerting policies in Cloud Monitoring

Alerting policies are a way to configure Monitoring to notify you when something, like reaching 85% of your limit on a quota, happens.

An alerting policy is a collection of conditions and notification information:

  • A condition describes what is being monitored, how the time-series data for that resource is to be combined, and when an incident is generated. An alerting policy must specify at least one condition.
  • The notification channel specifies who is to be notified, and how they are to be notified, when an incident occurs. For example, you can configure the alerting policy to send email to a specific person or to a group of people.

There are two techniques you can use to create alerting-policy conditions:

  • Using Monitoring filters to select and manipulate data. For example, when you use the graphical interface to create alerting-policy conditions, you are creating filters. The example shown in Working with quota metrics uses filters to select data for a chart. You can also use filters in requests to the Monitoring API.

  • Using MQL to select and manipulate data. MQL is a text-based query language. With the MQL code editor, you can create queries that you can't create with the filter-based technique. We recommend that you use MQL for creating ratio-based alerting policies. For more information, see MQL alerting-policy examples.

This page discusses both techniques. You can also create charts by using either technique.

Filter alerting-policy examples

In this section, each subsection includes a JSON representation of an alerting policy, along with a pair of tables that describe how to configure the policy in the Google Cloud console:

  • The first table describes what is being monitored and how the data is to be combined.
  • The second table describes when an incident is to be generated.

These examples are for the filter-based approach.

None of these policies compute ratios. For ratio-based examples, see MQL alerting-policy examples.

Alerting on quota/exceeded errors

You can create an alerting policy to notify you if any service in your Google Cloud project is reporting a quota exceeded error. You can create this type of policy by using Google Cloud console or by using the Cloud Monitoring API.

Using the Google Cloud console

The remainder of the content in this subsection is for the conditions dialog of an alerting policy.

Complete the New condition dialog by using the settings in the following table. These setting specify that you want to monitor the time series data for the serviceruntime metric /quota/exceeded for all services in your Google Cloud project, and that you want to group the data by the quota limit.

New condition dialog
Field

Value
Resource and Metric In the Resources menu, select Consumer Quota.
In the Metric categories menu, select Quota.
In the Metrics menu, select Quota exceeded error.

(The metric.type is serviceruntime.googleapis.com/quota/exceeded,
and the resource.type is consumer_quota).
Filter

Add a filter so the chart only displays data for the service that you want to monitor. For example, to monitor the Identity and Access Management service, add the folliowing filter: service = iam.googleapis.com.

When the filter field is empty, all available metric data is included in the chart.

Rolling window Select 1 m
Rolling window function Select count true

This metric is of type GAUGE, meaning each data point in the time series is an instantaneous measurement. The value type is BOOL. A value of true indicates that the quota was exceeded.

For this metric, the rolling window functions of count true and count are equivalent.

Across time series
Time series aggregation

Select sum.

The aggregation field is automatically set to sum when data is grouped. This setting defines how the data in the individual time series is combined.

Across time series
Time series group by

Select quota_metric.

This option groups the data by the type of name of the quota_metric.

Complete the Configure trigger dialog by using the following settings. These settings cause the alerting policy to create an alert if the number of quota-exceeded errors exceeds the value of 0 for 1 m. A value of 0 is selected here because quota exceeded errors are unexpected and an indication that a quota needs to be increased or that a service needs to be modified to reduce the API requests. You might want to use a higher threshold.

Configure trigger dialog
Field

Value
Condition type Threshold
Alert trigger Any time series violates
Threshold position Above threshold
Threshold value 0
Retest window 1 m

Using the Cloud Monitoring API

You can create this alerting policy using the API method alertPolicies.create. You can invoke the Cloud Monitoring API directly, by using the Google Cloud CLI, or by using client libraries. For more information, see Creating policies.

For information on representing alerting policies in JSON or YAML, see Sample policies.

A representation of this alerting policy in JSON format follows.


{
    "combiner": "OR",
    "conditions": [
      {
        "conditionThreshold": {
          "aggregations": [
            {
              "alignmentPeriod": "60s",
              "crossSeriesReducer": "REDUCE_SUM",
              "groupByFields": [
                "metric.label.quota_metric"
              ],
              "perSeriesAligner": "ALIGN_COUNT_TRUE"
            }
          ],
          "comparison": "COMPARISON_GT",
          "duration": "60s",
          "filter": "metric.type=\"serviceruntime.googleapis.com/quota/exceeded\" resource.type=\"consumer_quota\"",
          "trigger": {
            "count": 1
          }
        },
        "displayName": "Quota exceeded error by label.quota_metric SUM",
      }
    ],
    "displayName": "Quota exceeded policy",
  }

Alerting on the absolute quota/allocation/usage

You can create an alerting policy to notify you if the allocation quota usage for a specific service in your Google Cloud project is exceeding a user-specified threshold. You can create this type of policy by using Google Cloud console or by using the Cloud Monitoring API.

Using the Google Cloud console

The remainder of the content in this subsection is for the conditions dialog of an alerting policy.

Complete the New condition dialog by using the settings in the following table. These setting specify that you want to monitor the time series data for the serviceruntime metric /quota/allocation/usage for one service in your Google Cloud project, and that you want to group the data by the quota limit.

New condition dialog
Field

Value
Resource and Metric In the Resources menu, select Consumer Quota.
In the Metric categories menu, select Quota.
In the Metrics menu, select Allocation quota usage.

(The metric.type is serviceruntime.googleapis.com/quota/allocation/usage,
and the resource.type is consumer_quota).
Filter

Add a filter so the chart only displays data for the service that you want to monitor. For example, to monitor the Identity and Access Management service, add the folliowing filter: service = iam.googleapis.com.

When the filter field is empty, all available metric data is included in the chart.

Rolling window Select 1440 m

The period matches is the sampling interval for this metric.

Rolling window function Select next older

The rolling window function is set to next older to include the most recent measured value of this GAUGE metric.

Across time series
Time series aggregation

Select sum.

The aggregation field is automatically set to sum when data is grouped. This setting defines how the data in the individual time series is combined.

Across time series
Time series group by

Select quota_metric.

This option groups the data by the type of name of the quota_metric.

Complete the Configure trigger dialog by using the following settings. These settings cause the alerting policy to create an alert if the value of the time series exceeds 2.5 for 1440 m. The value of 1440 m matches the rolling window. The value of 2.5 was selected for this example, because it is slightly higher than the normal value for the test system. You should select the threshold based on the service you are monitoring in combination with an understanding of the expected range of values for the metric.

Configure trigger dialog
Field

Value
Condition type Threshold
Alert trigger Any time series violates
Threshold position Above threshold
Threshold value 2.5
Retest window 1440 m

Using the Cloud Monitoring API

You can create this alerting policy using the API method alertPolicies.create. You can invoke the Cloud Monitoring API directly, by using the Google Cloud CLI, or by using client libraries. For more information, see Creating policies.

For information on representing alerting policies in JSON or YAML, see Sample policies.

A representation of this alerting policy in JSON format follows.


{
    "combiner": "OR",
    "conditions": [
      {
        "conditionThreshold": {
          "aggregations": [
            {
              "alignmentPeriod": "86400s",
              "crossSeriesReducer": "REDUCE_SUM",
              "groupByFields": [
                "metric.label.quota_metric"
              ],
              "perSeriesAligner": "ALIGN_NEXT_OLDER"
            }
          ],
          "comparison": "COMPARISON_GT",
          "duration": "86400s",
          "filter": "metric.type=\"serviceruntime.googleapis.com/quota/allocation/usage\" resource.type=\"consumer_quota\" resource.label.\"service\"=\"iam.googleapis.com\"",
          "thresholdValue": 2.5,
          "trigger": {
            "count": 1
          }
        },
        "displayName": "Allocation quota usage for iam.googleapis.com by label.quota_metric SUM",
      }
    ],
    "displayName": "Absolute quota usage policy",
  }

MQL alerting-policy examples

MQL is a text-based query language that uses a series of operations that are linked by pipes. MQL lets you build more powerful and flexible queries than you can build with Monitoring filters. We recommend that you use MQL for setting up ratio-based alerting policies. For example, with MQL, you can set up a ratio for rate-quota usage, which requires computing the ratio of a gauge metric (the limit) and a delta metric (the rate).

You can create MQL-based alerting policies by using the Google Cloud console or the Monitoring API:

For information specific to MQL, see Using Monitoring Query Language. For more information on MQL-based alerting policies, see Alerting policies with MQL.

Alerting policy that monitors the ratio of rate quota to quota limit

The following MQL query pattern describes an alerting policy that sends a notification when the per-minute rate usage of a specific resource service exceeds 80% of a specific limit:

fetch consumer_quota
| filter resource.service == 'sample.googleapis.com'
| { metric serviceruntime.googleapis.com/quota/rate/net_usage
    | align delta_gauge(1m)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        sum(value.net_usage)
  ; metric serviceruntime.googleapis.com/quota/limit
    | filter metric.limit_name == 'Limit'
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        sliding(1m), max(val()) }
| ratio
| every 1m
| condition gt(val(), 0.8 '1')

To use this query pattern, make the following changes:

  • Replace sample.googleapis.com with the service you want to monitor.
  • Replace Limit for the metric.limit_name with the limit you want to track. For information on finding limit names, see Identifying quota metrics and limit names
  • Replace 1m in the delta_gauge and sliding functions with an appropriate window for your limit.

Don't modify the every 1m operation, which determines how far apart data points are in the query results.

You can't create this query with filters.

Alerting policy that monitors the ratio of rate quota with wildcards

MQL supports filtering with wildcards, regular expressions, and boolean logic. For example, you can use MQL to create an alerting policy that tracks multiple limits and warns you if any exceeds a threshold.

The following MQL query pattern describes an alerting policy that sends notifications when the per-minute or per-day rate usage of any resource services exceeds 80%:

fetch consumer_quota
| filter resource.service =~ '.*'
| { { metric serviceruntime.googleapis.com/quota/rate/net_usage
      | align delta_gauge(1m)
      | group_by [resource.project_id, metric.quota_metric, resource.location],
          sum(value.net_usage)
    ; metric serviceruntime.googleapis.com/quota/limit
      | filter metric.limit_name =~ '.*PerMinute.*'
      | group_by [resource.project_id, metric.quota_metric, resource.location],
          sliding(1m), max(val()) }
    | ratio
  ; { metric serviceruntime.googleapis.com/quota/rate/net_usage
      | align delta_gauge(23h)
      | group_by [resource.project_id, metric.quota_metric, resource.location],
          sum(value.net_usage)
    ; metric serviceruntime.googleapis.com/quota/limit
      | filter metric.limit_name =~ '.*PerDay.*'
      | group_by [resource.project_id, metric.quota_metric, resource.location],
          sliding(23h), max(val()) }
    | ratio }
| union
| every 1m
| condition gt(val(), 0.8 '1')

In the previous query, the argument for the delta_gauge aligner is set to 23 hours instead of 1 day. MQL can only require 23 hours 30 minutes of data, and for computation purposes, the delta_gauge aligner adds one hour to the alignment period. If you use delta_gauge(1d), then the condition can't be saved because the condition requires 25 hours of data. This behavior is different from the next_older aligner, which doesn't pad the alignment period.

To use this query pattern, make the following changes:

  • Replace the regular expression for the resource.service with a regular expression for the services you want to track.
  • In the first ratio:
    • Replace .*PerMinute.* for the metric.limit_name with a regular expression for the first group of limits you want to track. For information on finding limit names, see Identifying quota metrics and limit names
    • Replace 1m in the delta_gauge and sliding functions with a window appropriate to your limits.
  • In the second ratio:
    • Replace .*PerDay.* for the metric.limit_name with a regular expression for the second group of limits you want to track.
    • Replace 23h in the delta_gauge and sliding functions with a window appropriate to your limits.

Don't modify the every 1m operation, which determines how far apart data points are in the query results.

You can't create this query with filters.

Ratio alert on usage of allocation quota for one limit

The following MQL query pattern describes an alert that monitors when the per-day allocation usage of a specific resource service exceeds 80% of a specific limit:

fetch consumer_quota
| filter resource.service == 'sample.googleapis.com'
| { metric serviceruntime.googleapis.com/quota/allocation/usage
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        max(val())
  ; metric serviceruntime.googleapis.com/quota/limit
    | filter metric.limit_name == 'Limit'
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        min(val())
  }
| ratio
| every 1m
| condition gt(val(), 0.8 '1')

To use this query pattern, make the following changes:

  • Replace sample.googleapis.com with the service you want to monitor.
  • Replace Limit for the metric.limit_name with the limit you want to track. For information on finding limit names, see Identifying quota metrics and limit names

Don't modify the every 1m operation, which determines how far apart data points are in the query results.

Example: CPU usage of 75% in any region

The following query creates an alerting policy that triggers when the CPU usage of Compute Engine VM instance goes higher than 75% of the limit in any region:

fetch consumer_quota
| filter resource.service == 'compute.googleapis.com'
| { metric serviceruntime.googleapis.com/quota/allocation/usage
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        max(val())
  ; metric serviceruntime.googleapis.com/quota/limit
    | filter metric.limit_name == 'CPUS-per-project-region'
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        min(val())
  }
| ratio
| every 1m
| condition gt(val(), 0.75 '1')

This consumer-quota policy uses the CPUS-per-project-region limit name in the Compute Engine API "CPUs" quota. For information on finding limit names, see Identifying quota metrics and limit names.

Alerting policy that monitors the ratio of allocation quota for any service

MQL supports filtering with wildcards, regular expressions, and boolean logic. For example, you can use MQL to create an alert that tracks multiple limits or services and warns you if any exceeds a threshold.

The following MQL query describes an alert that monitors when the per-day allocation usage of any resource service exceeds 80% for any of quota limits:

fetch consumer_quota
| filter resource.service =~ '.*'
| { metric serviceruntime.googleapis.com/quota/allocation/usage
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        max(val())
  ; metric serviceruntime.googleapis.com/quota/limit
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        min(val())
  }
| ratio
| every 1m
| condition gt(val(), 0.8 '1')

You can use this query as presented, or you can replace the regular expression for the resource.service with a regular expression for the services you want to track. You can also filter on a specific service and use wildcards in a limit filter.

Don't modify the every 1m operation, which determines how far apart data points are in the query results.

Example: CPU usage higher than 50% in specific zones

The following query creates an alerting policy that triggers when the CPU usage of Compute Engine VM instances goes higher than 50% of the limit in any of the us-central1 zones. This query filters the limit data by a limit name and the resource location:

fetch consumer_quota
| filter resource.service == 'compute.googleapis.com'
| { metric serviceruntime.googleapis.com/quota/allocation/usage
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        max(val())
  ; metric serviceruntime.googleapis.com/quota/limit
    | filter metric.limit_name == 'CPUS-per-project-zone' &&
              resource.location =~ 'us-central1-.*'
    | align next_older(1d)
    | group_by [resource.project_id, metric.quota_metric, resource.location],
        min(val())
  }
| ratio
| every 1m
| condition gt(val(), 0.50 '1')

This consumer-quota policy uses the CPUS-per-project-zone limit name in the Compute Engine API "CPUs" quota. For information on finding limit names, see Identifying quota metrics and limit names.

Ratio alert using resource-specific quota

You can use MQL to set up ratios for resource-specific quota-related metrics. In this case, you specify a service-specific monitored resource and compute a ratio over a pair of resource-specific quota-relateds metrics.

The following query pattern describes an alert that monitors when the usage of a quota exceeds 80% of the limit:

fetch sample.googleapis.com/SampleResource
  | { metric sample.googleapis.com/quota/samplemetric/usage
    | align next_older(1d)
    | group_by [resource.label_1, ... , resource.label_n,
                metric.label_1, ... , metric.label_n],
        max(val())
  ; metric sample.googleapis.com/quota/samplemetric/limit
    | align next_older(1d)
    | group_by [resource.label_1, ... , resource.label_n,
                metric.label_1, ... , metric.label_n],
        min(val())
  }
| ratio
| every 1m
| condition gt(val(), 0.8 '1')

To use this query pattern, make the following changes:

  • Replace sample.googleapis.com with the service you want to monitor.
  • Replace sampleResource with the associated monitored resource.
  • Replace samplemetric with the string for a group of metric types.
  • In the group_by operations, list each of the resource and metric labels.

Example: CPU usage of 75% in any region

For example, the following MQL query sets up an alert that monitors when the usage of the Compute Engine instances_per_vpc_network quota exceeds 80% for any network ID:

fetch compute.googleapis.com/VpcNetwork
| { metric compute.googleapis.com/quota/instances_per_vpc_network/usage
    | align next_older(1d)
    | group_by [resource.resource_container, metric.limit_name,
                resource.location, resource.network_id],
        max(val())
  ; metric compute.googleapis.com/quota/instances_per_vpc_network/limit
    | align next_older(1d)
    | group_by [resource.resource_container, metric.limit_name,
                resource.location, resource.network_id],
        min(val())
  }
| ratio
| every 1m
| condition gt(val(), 0.80 '1')

Note that this query uses the resource type compute.googleapis.com/VpcNetwork, not consumer_quota, and it takes the ratio of two compute.googleapis.com/quota/instances_per_vpc_network metrics, usage and limit.

Chart examples

Charts display time-series data. You can use Metrics Explorer to create a chart. With Metrics Explorer you can either discard the chart when you no longer need it, or you can save it to a dashboard. In the dashboard view, you can add a chart to the dashboard.

When you only want to configure a chart that displays quota data, you can use the settings in the New condition table. Alerting conditions use different notation than charting tools. Charting tools include Metrics Explorer and configuring charts on custom dashboards:
New condition dialog
field name
Charts
Rolling window function

Optimally configured based on selected metric and aggregation settings.

To specify the alignment function, do the following:

  1. In the Aggregation element, expand the first menu and select Configure aligner. The Alignment function and Grouping elements are added.
  2. Expand the Alignment function element and make a selection.

Rolling window Min Interval
(to access, click Add query element)
Time series group by
(in the Across time series section)
Aggregation element's second menu
Time series aggregation
(in the Across time series section)
Aggregation element's first menu

Time series for quota/rate/net_usage

To view the time series data for the serviceruntime metric quota/rate/net_usage, for all services in your Google Cloud project, where the data is grouped by the name of the quota metric and the rate of usage is displayed, use the following settings:

New condition dialog
Field

Value
Resource and Metric In the Resources menu, select Consumer Quota.
In the Metric categories menu, select Quota.
In the Metrics menu, select Rate quota usage.

(The metric.type is serviceruntime.googleapis.com/quota/rate/net_usage,
and the resource.type is consumer_quota).
Filter

Add a filter so the chart only displays data for the service that you want to monitor. For example, to monitor the Identity and Access Management service, add the folliowing filter: service = iam.googleapis.com.

When the filter field is empty, all available metric data is included in the chart.

Rolling window Select 1 m

The period of 1 minute matches the sampling interval for this metric.

Rolling window function Select rate

By setting the aligner to the value of rate, the values stored in the time series for this DELTA metric are converted into a new time series that stores rate data. The y-axis for the chart has the units of quota per second.

Across time series
Time series aggregation

Select sum.

The aggregation field is automatically set to sum when data is grouped. This setting defines how the data in the individual time series is combined.

Across time series
Time series group by

Select quota_metric.

This option groups the data by the type of name of the quota_metric.

Time series for quota/instances_per_vpc_network/limit

To view the time series data for the compute.googleapis.com metric quota/instances_per_vpc_network/limit, for all the networks in your Google Cloud project, use the following settings:

New condition dialog
Field

Value
Resource and Metric In the Resource type menu, select VPC Network.
In the Metric category menu, select quota.
In the Metric menu, select Instances per VPC Network quota limit.

(The metric.type is compute.googleapis.com/quota/instances_per_vpc_network/limit,
and the resource.type is compute.googleapis.com/VpcNetwork).
Filter Leave empty
Rolling window Select 1 m

The period matches is the sampling interval for this metric.

Rolling window function Select mean
Across time series
Time series aggregation
Leave as none
Across time series
Time series group by
Leave empty

Time series for quota/instances_per_vpc_network/usage

To view the time series data for the compute.googleapis.com metric quota/instances_per_vpc_network/usage, for one of the networks in your Google Cloud project, use the following settings:

New condition dialog
Field

Value
Resource and Metric In the Resource type menu, select VPC Network.
In the Metric category menu, select quota.
In the Metric menu, select Instances per VPC Network quota usage.

(The metric.type is compute.googleapis.com/quota/instances_per_vpc_network/usage,
and the resource.type is compute.googleapis.com/VpcNetwork).
Metric In the Metric menu, select compute.googleapis.com/quota/instances_per_vpc_network/usage.
Filter

Add a filter so the chart only displays a subset of all the data. For example, to see the usage for a specific network, add the following filter: network_id = identifier.

When the filter field is empty, all available metric data is included in the chart.

Rolling window Select 1 m

The period matches is the sampling interval for this metric.

Rolling window function Select mean
Across time series
Time series aggregation
Leave as none
Across time series
Time series group by
Leave empty

MQL charts

You can use MQL queries to create charts by using the MQL code editor. For example, any of the queries shown in MQL alerting policy examples can be entered into the code editor. You can omit the last operation, condition, in each query; it applies except when creating a condition for an alerting policy. In a chart, the condition operation does nothing.

For more information, see Use the code editor for MQL and MQL examples.