Monitor instances with Cloud Monitoring Stay organized with collections Save and categorize content based on your preferences.
This document describes how to use the Cloud Monitoring console to monitoryour Spanner instances.
The Cloud Monitoring console provides several monitoring tools forSpanner:
- Acurated dashboard, which shows pre-made charts for yourSpanner resources
- Custom charts, includingad-hoc charts in the Metrics Exploreras well ascharts in custom dashboards
- Alerts, which notify you if a metric exceeds a threshold that you specify
If you prefer to monitor Spanner programmatically, use theCloudClient Libraries for Cloud Monitoring toretrieve metrics.
Note: You can also monitor your instances byviewing charts in theGoogle Cloud console. Use the Google Cloud console to get aquick view of the most important metrics for your instance.Use the Cloud Monitoring curated dashboard
Cloud Monitoring provides you with a curated dashboard that summarizes keyinformation about your Spanner instances, including:
- Incidents: User-created monitoring alerts that are open, active, orresolved
- Events: A list of Spanneraudit logs (ifenabled and available)
- Instances: A high-level summary of your Spanner instances,includingcompute capacity, database count, and instance health
- Aggregated charts of throughput and storage use
To view the Spanner dashboard, do the following:
In the Google Cloud console, selectMonitoring, or use the following button:
IfResources is shown in the navigation pane, then selectResourcesand then selectCloud Spanner. Otherwise, selectDashboards and thenselect the dashboard namedCloud Spanner.
View instance and database details
When you open the curated dashboard for Spanner, it showsaggregated data for all of your instances. You can view more details about aspecific instance by clicking the instance's name underInstances.
The dashboard displays information such as instance metadata, databases in theinstance, and charts of various metrics broken down by region.
From the instance dashboard page, you can also see charts for a specificdatabase in the instance:
On the right-hand side, above the instance metrics charts, clickDatabasemetrics.
In theSelect a breakdown drop-down list, select the database that youwant to examine.
The Cloud Monitoring console displays charts for the database.
Create custom charts for Spanner metrics
You can use Cloud Monitoring to create custom charts forSpanner metrics. You can use the Metrics Explorer to createtemporary, ad-hoc charts, or you can create charts that appear on customdashboards.
In particular, Cloud Monitoring lets you create a custom chart that showswhether two or more metrics are correlated with each other. For example, you cancheck for a correlation betweenCPU utilization andlatency in a Spanner instance, which might indicatethat your instance needs morecompute capacity or that some of yourqueries are causing high CPU utilization.
To get started with this example, follow these steps:
In the Google Cloud console, selectMonitoring, or use the following button:
IfMetrics Explorer is shown in the navigation pane, select it.Otherwise, selectResources and then selectMetrics Explorer.
Click theView options tab, then select theLog scale on Y-axischeckbox. This option helps you compare multiple metrics when one metric hasmuch larger values than the others.
In the drop-down list above the right pane, selectLine.
Click theMetrics tab. You can now add metrics to the chart.
To add latency metrics to the chart, follow these steps:
- In theFind resource type and metric box, enter the value
spanner.googleapis.com/api/request_latencies, then click the row thatappears below the box. - In theFilter box, enter the value
instance_id, then enter theinstance ID you want to examine and clickApply. - In theAggregator drop-down list, clickmax.
Optional: Change the latency percentile:
- ClickShow advanced options.
- Click theAligner drop-down list, then click the latency percentilethat you want to view.
In most cases, you should look at either the 50th percentile latency, to understand the typical amount of latency, or the 99th percentile latency, to understand the latency for the slowest 1% of requests.
To add CPU utilization metrics to the chart, follow these steps:
- Click Add metric.
- In theFind resource type and metric box, enter the value
spanner.googleapis.com/instance/cpu/utilization, then click the row thatappears below the box. - In theFilter box, enter the value
instance_id, then enter theinstance ID you want to examine and clickApply. - In theAggregator drop-down list, clickmax.
You now have a chart that shows the CPU utilization and latency metrics for aSpanner instance. If both metrics are higher than expected at thesame time, you cantake additional steps to correct the issue.
For more information about creating custom charts, see theCloud Monitoringdocumentation.
Create alerts for Spanner metrics
When you create a Spannerinstance, you choose thecompute capacity for the instance. As the instance's workload changes,Spanner does not automatically adjust compute capacity of theinstance. As a result, you need to set up several alerts to ensure that theinstance stays within therecommended maximums for CPU utilization and therecommended limit for storage.
The following examples show how to set up alerting policies for someSpanner metrics. For a full list of available metrics, seemetricslist for Spanner.
High-priority CPU
To create an alerting policy that triggers when your high priority cpu utilization forSpanner is above a recommended threshold, use the following settings.
Steps to create an alerting policy.
To create an alerting policy, do the following:
In the Google Cloud console, go to thenotifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading isMonitoring.
- If you haven't created your notification channels and if you want to be notified, then clickEdit Notification Channels and add your notification channels. Return to theAlerting page after you add your channels.
- From theAlerting page, selectCreate policy.
- To select the resource, metric, and filters, expand theSelect a metric menu and then use the values in theNew condition table:
- Optional: To limit the menu to relevant entries, enter the resource or metric name in the filter bar.
- Select aResource type. For example, selectVM instance.
- Select aMetric category. For example, selectinstance.
- Select aMetric. For example, selectCPU Utilization.
- SelectApply.
- ClickNext and then configure the alerting policy trigger. To complete these fields, use the values in theConfigure alert trigger table.
- ClickNext.
Optional: To add notifications to your alerting policy, clickNotification channels. In the dialog, select one or more notification channels from the menu, and then clickOK.
To be notified when incidents are openend and closed, checkNotify on incident closure. By default, notifications are sent only when incidents are openend.
- Optional: Update theIncident autoclose duration. This field determines when Monitoring closes incidents in the absence of metric data.
- Optional: ClickDocumentation, and then add any information that you want included in a notification message.
- ClickAlert name and enter a name for the alerting policy.
- ClickCreate Policy.
| New condition Field | Value |
|---|---|
| Resource and Metric | In theResources menu, selectSpanner Instance. In theMetric categories menu, selectInstance. In theMetrics menu, selectCPU Utilization by priority. (The metric.type is spanner.googleapis.com/instance/cpu/utilization_by_priority). |
| Filter | instance_id =YOUR_INSTANCE_IDpriority = high |
| Across time series Time series group by | location for multi-region instances;leave it blank for regional instances. |
| Across time series Time series aggregation | sum |
| Rolling window | 10 m |
| Rolling window function | mean |
| Configure alert trigger Field | Value |
|---|---|
| Condition type | Threshold |
| Alert trigger | Any time series violates |
| Threshold position | Above threshold |
| Threshold value | 45% for multi-region instances;65% for regional instances. |
| Retest window | 10 minutes |
24 hour rolling average CPU
To create an alerting policy that triggers when the 24 hour rolling average of your cpu utilization forSpanner is above a recommended threshold, use the following settings.
Steps to create an alerting policy.
To create an alerting policy, do the following:
In the Google Cloud console, go to thenotifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading isMonitoring.
- If you haven't created your notification channels and if you want to be notified, then clickEdit Notification Channels and add your notification channels. Return to theAlerting page after you add your channels.
- From theAlerting page, selectCreate policy.
- To select the resource, metric, and filters, expand theSelect a metric menu and then use the values in theNew condition table:
- Optional: To limit the menu to relevant entries, enter the resource or metric name in the filter bar.
- Select aResource type. For example, selectVM instance.
- Select aMetric category. For example, selectinstance.
- Select aMetric. For example, selectCPU Utilization.
- SelectApply.
- ClickNext and then configure the alerting policy trigger. To complete these fields, use the values in theConfigure alert trigger table.
- ClickNext.
Optional: To add notifications to your alerting policy, clickNotification channels. In the dialog, select one or more notification channels from the menu, and then clickOK.
To be notified when incidents are openend and closed, checkNotify on incident closure. By default, notifications are sent only when incidents are openend.
- Optional: Update theIncident autoclose duration. This field determines when Monitoring closes incidents in the absence of metric data.
- Optional: ClickDocumentation, and then add any information that you want included in a notification message.
- ClickAlert name and enter a name for the alerting policy.
- ClickCreate Policy.
| New condition Field | Value |
|---|---|
| Resource and Metric | In theResources menu, selectSpanner Instance. In theMetric categories menu, selectInstance. In theMetrics menu, selectSmoothed CPU utilization. (The metric.type is spanner.googleapis.com/instance/cpu/smoothed_utilization). |
| Filter | instance_id =YOUR_INSTANCE_ID |
| Across time series Time series aggregation | sum |
| Rolling window | 10 m |
| Rolling window function | mean |
| Configure alert trigger Field | Value |
|---|---|
| Condition type | Threshold |
| Alert trigger | Any time series violates |
| Threshold position | Above threshold |
| Threshold | 90% |
| Retest window | 10 minutes |
Storage
To create an alerting policy that triggers when your storage for yourSpanner instance is above a recommended threshold, use the following settings.
Steps to create an alerting policy.
To create an alerting policy, do the following:
In the Google Cloud console, go to thenotifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading isMonitoring.
- If you haven't created your notification channels and if you want to be notified, then clickEdit Notification Channels and add your notification channels. Return to theAlerting page after you add your channels.
- From theAlerting page, selectCreate policy.
- To select the resource, metric, and filters, expand theSelect a metric menu and then use the values in theNew condition table:
- Optional: To limit the menu to relevant entries, enter the resource or metric name in the filter bar.
- Select aResource type. For example, selectVM instance.
- Select aMetric category. For example, selectinstance.
- Select aMetric. For example, selectCPU Utilization.
- SelectApply.
- ClickNext and then configure the alerting policy trigger. To complete these fields, use the values in theConfigure alert trigger table.
- ClickNext.
Optional: To add notifications to your alerting policy, clickNotification channels. In the dialog, select one or more notification channels from the menu, and then clickOK.
To be notified when incidents are openend and closed, checkNotify on incident closure. By default, notifications are sent only when incidents are openend.
- Optional: Update theIncident autoclose duration. This field determines when Monitoring closes incidents in the absence of metric data.
- Optional: ClickDocumentation, and then add any information that you want included in a notification message.
- ClickAlert name and enter a name for the alerting policy.
- ClickCreate Policy.
| New condition Field | Value |
|---|---|
| Resource and Metric | In theResources menu, selectSpanner Instance. In theMetric categories menu, selectInstance. In theMetrics menu, selectStorage used. (The metric.type is spanner.googleapis.com/instance/storage/utilization). |
| Filter | instance_id =YOUR_INSTANCE_ID |
| Across time series Time series aggregation | sum |
| Rolling window | 10 m |
| Rolling window function | max |
| Configure alert trigger Field | Value |
|---|---|
| Condition type | Threshold |
| Condition triggers if | Any time series violates |
| Threshold position | Above threshold |
| Threshold value | You don't need to set a specific threshold for the maximum storage per node. However, we recommendedthat you set up an alert for when you are approaching the maximum storage limit. To learn more, seeStorage utilization metrics. |
| Retest window | 10 minutes |
What's next
- Understand theCPU utilization andlatencymetrics for Spanner.
- Use the Google Cloud console to get a quick view ofthe most important metrics for your instance.
- Learn more aboutCloud Monitoring.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.