Monitor and alert with quota metrics

"Monitor and alert with quota metrics"

Set up quota usage alerts in the Quotas page

You can set up quota alerts from the Quotas page to get notifications when quota usage reaches a defined threshold. This feature currently only supported for project-level quotas.

To set up an alert for a specific quota, do the following:

  1. Ensure you have the permission to create alerts

  2. Go to the Quotas page: Go to Quotas

  3. On the Quotas page, on the last column of the table, click the button to open the actions menu, and click Create quota alert.

  4. Select the quota usage template and select the desired notification channels.

  5. Click Create policies

  6. Optional: If you would like to customize the default alert policy, expand the drop-down, and follow the directions.

Use Cloud Monitoring

The Cloud Monitoring API and console allows you to monitor quota usage, limits, and errors in greater depth. You can use these metrics to create custom dashboards and alerts.You can monitor quota usage over time and receive alerts. For example, when you're approaching a quota limit.

Cloud Monitoring supports a wide variety of metrics that you can combine with filters and aggregations for new and insightful views into your quota usage. For example, you can combine a metric for allocation quota usage with a quota_metric filter on Cloud TPU names.

To use Metrics Explorer to view the metrics for a monitored resource, follow these steps:

  1. In the Google Cloud console, select Monitoring, and then select  Metrics Explorer, or click the following button:

    Go to Metrics Explorer

  2. In the Select a metric pane, expand the Metric menu, enter quota usage in the filter bar, and then use the submenus to select a specific resource type and metric:
    1. In the Active resources menu, select Consumer Quota.
    2. In the Active metric categories menu, select Quota.
    3. In the Active metrics menu, select Allocation quota usage or Rate quota usage.
    4. Click Apply.
  3. Optional: To configure how the data is viewed, add filters, groupings, and configure the alignment fields. By default, Metrics Explorer adds a grouping that averages all time series:
    • To group time series by resource or metric labels, expand the Labels menu in the Group by section, and then make your selections. You can also change the Grouping function.
    • To view all time series, in the Group by entry, click Delete.
    • To access the alignment fields, click More Options.
    For more information, see Select metrics when using Metrics Explorer.
  4. Optional: Change the settings in the Display pane:
    • For quota and other metrics that report one sample per day, set the Widget type to Stacked bar chart.
    • For distribution valued metrics, set the Widget type to Heatmap chart.
  5. Optional: For quota and other metrics that report one sample per day, set the time frame to at least one week.

Similarly, to see quota limits or exceeded errors, first select Consumer Quota as the resource type and then select Quota limit or Quota exceeded error.

After you've found the quota usage information you want, you can use Cloud Monitoring to create custom dashboards and alerts to help you monitor and maintain a robust application. For more information, see the following documents:

For examples of common quota-specific alerting policies, see Using quota metrics.

The Cloud Monitoring reference guide includes a detailed reference for quota metrics.

Check quota metric support

Not all services support quota metrics in Cloud Monitoring. To see applicable quota metrics for supported services, select Consumer Quota as the resource type when building a chart or creating an alerting policy. Services that don't support quota metrics aren't displayed.

  • Common services that support quota metrics include Compute Engine, Dataflow, Cloud Spanner, Pub/Sub, Cloud Vision, Speech-to-Text, Cloud Monitoring, and Cloud Logging.

  • Common services that do not support quota metrics include App Engine, Cloud Storage, and Cloud SQL.