---
title: Google Cloud Spanner
description: >-
  The first and only relational database service that is both strongly
  consistent and horizontally scalable.
breadcrumbs: Docs > Integrations > Google Cloud Spanner
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Google Cloud Spanner

{% callout %}
# Important note for users on the following Datadog sites: us2.ddog-gov.com

{% alert level="info" %}
To find out if this integration is available in your organization, see your [Datadog Integrations](https://app.datadoghq.com/integrations) page or ask your organization administrator.

To initiate an exception request to enable this integration for your organization, email [support@ddog-gov.com](mailto:support@ddog-gov.com).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Google Cloud Spanner is the first and only relational database service that is both strongly consistent and horizontally scalable.

Get metrics from Google Spanner to:

- Visualize the performance of your Spanner databases.
- Correlate the performance of your Spanner databases with your applications.

## Setup{% #setup %}

### Metric collection{% #metric-collection %}

#### Installation{% #installation %}

If you haven't already, set up the [Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google-cloud-platform.md) first. There are no other installation steps.

### Log collection{% #log-collection %}

Google Cloud Spanner logs are collected with Google Cloud Logging and sent to a Dataflow job through a Cloud Pub/Sub topic. If you haven't already, [set up logging with the Datadog Dataflow template](https://docs.datadoghq.com/integrations/google-cloud-platform.md#log-collection).

Once this is done, export your Google Cloud Spanner logs from Google Cloud Logging to the Pub/Sub topic:

1. Go to the [Google Cloud Logging page](https://console.cloud.google.com/logs/viewer) and filter Google Cloud Spanner logs.
1. Click **Create Sink** and name the sink accordingly.
1. Choose "Cloud Pub/Sub" as the destination and select the Pub/Sub topic that was created for that purpose. **Note**: The Pub/Sub topic can be located in a different project.
1. Click **Create** and wait for the confirmation message to show up.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **gcp.spanner.api.api_request_count**(count)                                                   | Cloud Spanner API requests.                                                                                                                                                                                                                                                                                                                                                                                 |
| **gcp.spanner.api.read_request_latencies_by_change_stream.avg**(count)                      | The average distribution of read request latencies by whether it is a change stream query. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.*Shown as second*                                                                                                                         |
| **gcp.spanner.api.read_request_latencies_by_change_stream.samplecount**(count)              | Distribution of read request latencies by whether it is a change stream query. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.                                                                                                                                                      |
| **gcp.spanner.api.read_request_latencies_by_change_stream.sumsqdev**(count)                 | Distribution of read request latencies by whether it is a change stream query. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.                                                                                                                                                      |
| **gcp.spanner.api.read_request_latencies_by_serving_location.avg**(count)                   | The average distribution of read request latencies by serving location, whether it is a directed read query, and whether it is a change stream query. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.*Shown as second*                                                              |
| **gcp.spanner.api.read_request_latencies_by_serving_location.samplecount**(count)           | Distribution of read request latencies by serving location, whether it is a directed read query, and whether it is a change stream query. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers. This is a superset of spanner.googleapis.com/api/read_request_latencies_by_change_stream. |
| **gcp.spanner.api.read_request_latencies_by_serving_location.sumsqdev**(count)              | Distribution of read request latencies by serving location, whether it is a directed read query, and whether it is a change stream query. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers. This is a superset of spanner.googleapis.com/api/read_request_latencies_by_change_stream. |
| **gcp.spanner.api.received_bytes_count**(count)                                                | Uncompressed request bytes received by Cloud Spanner.*Shown as byte*                                                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.api.request_count**(rate)                                                         | Rate of Cloud Spanner API requests.*Shown as request*                                                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.api.request_latencies.avg**(gauge)                                                | Distribution of server request latencies for a database. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.*Shown as second*                                                                                                                                                           |
| **gcp.spanner.api.request_latencies.samplecount**(gauge)                                        | Sample count of server request latencies for a database.*Shown as second*                                                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.api.request_latencies.sumsqdev**(gauge)                                           | Sum of Squared Deviation of server request latencies for a database.*Shown as second*                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.api.request_latencies_by_transaction_type.avg**(count)                         | The average distribution of server request latencies by transaction types. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.*Shown as second*                                                                                                                                         |
| **gcp.spanner.api.request_latencies_by_transaction_type.samplecount**(count)                 | Distribution of server request latencies by transaction types. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.                                                                                                                                                                      |
| **gcp.spanner.api.request_latencies_by_transaction_type.sumsqdev**(count)                    | Distribution of server request latencies by transaction types. This includes latency of request processing in Cloud Spanner backends and API layer. It does not include network or reverse-proxy overhead between clients and servers.                                                                                                                                                                      |
| **gcp.spanner.api.sent_bytes_count**(count)                                                    | Uncompressed response bytes sent by Cloud Spanner.*Shown as byte*                                                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.client.attempt_count**(count)                                                     | The total number of RPC attempt performed by the Spanner client.                                                                                                                                                                                                                                                                                                                                            |
| **gcp.spanner.client.attempt_latencies.avg**(count)                                             | The average distribution of the total end-to-end latency across a RPC attempt.*Shown as millisecond*                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.client.attempt_latencies.samplecount**(count)                                     | Distribution of the total end-to-end latency across a RPC attempt.                                                                                                                                                                                                                                                                                                                                          |
| **gcp.spanner.client.attempt_latencies.sumsqdev**(count)                                        | Distribution of the total end-to-end latency across a RPC attempt.                                                                                                                                                                                                                                                                                                                                          |
| **gcp.spanner.client.operation_count**(count)                                                   | The total number of operations performed by the Spanner client.                                                                                                                                                                                                                                                                                                                                             |
| **gcp.spanner.client.operation_latencies.avg**(count)                                           | The average distribution of the total end-to-end latency across all RPC attempts associated with a Spanner operation.*Shown as millisecond*                                                                                                                                                                                                                                                                 |
| **gcp.spanner.client.operation_latencies.samplecount**(count)                                   | Distribution of the total end-to-end latency across all RPC attempts associated with a Spanner operation.                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.client.operation_latencies.sumsqdev**(count)                                      | Distribution of the total end-to-end latency across all RPC attempts associated with a Spanner operation.                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.graph_query_stat.total.bytes_returned_count**(count)                           | Number of data bytes that the graph queries returned, excluding transmission encoding overhead.*Shown as byte*                                                                                                                                                                                                                                                                                              |
| **gcp.spanner.graph_query_stat.total.execution_count**(count)                                 | Number of times Cloud Spanner saw graph queries during the interval.                                                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.graph_query_stat.total.failed_execution_count**(count)                         | Number of times graph queries failed during the interval.                                                                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.graph_query_stat.total.query_latencies.avg**(count)                             | The average distribution of total length of time, in seconds, for graph query executions within the database.*Shown as second*                                                                                                                                                                                                                                                                              |
| **gcp.spanner.graph_query_stat.total.query_latencies.samplecount**(count)                     | Distribution of total length of time, in seconds, for graph query executions within the database.                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.graph_query_stat.total.query_latencies.sumsqdev**(count)                        | Distribution of total length of time, in seconds, for graph query executions within the database.                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.graph_query_stat.total.returned_rows_count**(count)                            | Number of rows that the graph queries returned.                                                                                                                                                                                                                                                                                                                                                             |
| **gcp.spanner.graph_query_stat.total.scanned_rows_count**(count)                             | Number of rows that the graph queries scanned excluding deleted values.                                                                                                                                                                                                                                                                                                                                     |
| **gcp.spanner.instance.autoscaling.high_priority_cpu_utilization_target**(gauge)             | High priority CPU utilization target used for autoscaling.*Shown as percent*                                                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.instance.autoscaling.max_node_count**(gauge)                                     | Maximum number of nodes autoscaler is allowed to allocate to the instance.                                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.instance.autoscaling.max_processing_units**(gauge)                               | Maximum number of processing units autoscaler is allowed to allocate to the instance.                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.instance.autoscaling.min_node_count**(gauge)                                     | Minimum number of nodes autoscaler is allowed to allocate to the instance.                                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.instance.autoscaling.min_processing_units**(gauge)                               | Minimum number of processing units autoscaler is allowed to allocate to the instance.                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.instance.autoscaling.storage_utilization_target**(gauge)                         | Storage utilization target used for autoscaling.*Shown as percent*                                                                                                                                                                                                                                                                                                                                          |
| **gcp.spanner.instance.backup.used_bytes**(gauge)                                               | Backup storage used in bytes.*Shown as byte*                                                                                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.instance.cpu.smoothed_utilization**(gauge)                                        | 24-hour smoothed utilization of provisioned CPU. Values are typically numbers between 0.0 and 1.0 (but might exceed 1.0), charts display the values as a percentage between 0% and 100% (or more).*Shown as percent*                                                                                                                                                                                        |
| **gcp.spanner.instance.cpu.utilization**(gauge)                                                  | Percent utilization of provisioned CPU. Values are typically numbers between 0.0 and 1.0 (but might exceed 1.0), charts display the values as a percentage between 0% and 100% (or more).*Shown as percent*                                                                                                                                                                                                 |
| **gcp.spanner.instance.cpu.utilization_by_operation_type**(gauge)                             | Percent utilization of provisioned CPU, by operation type. Values are typically numbers between 0.0 and 1.0 (but might exceed 1.0), charts display the values as a percentage between 0% and 100% (or more). Currently, it does not include CPU utilization for system tasks.*Shown as percent*                                                                                                             |
| **gcp.spanner.instance.cpu.utilization_by_priority**(gauge)                                    | Percent utilization of provisioned CPU, by priority. Values are typically numbers between 0.0 and 1.0 (but might exceed 1.0), charts display the values as a percentage between 0% and 100% (or more).*Shown as percent*                                                                                                                                                                                    |
| **gcp.spanner.instance.cross_region_replicated_bytes_count**(count)                          | Number of bytes replicated from preferred leader to replicas across regions.*Shown as byte*                                                                                                                                                                                                                                                                                                                 |
| **gcp.spanner.instance.data_boost.processing_unit_second_count**(count)                      | Total processing units used for DataBoost operations.                                                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.instance.dual_region_quorum_availability**(gauge)                               | Quorum availability signal for dual region instance configs.                                                                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.instance.leader_percentage_by_region**(gauge)                                   | Percentage of leaders by cloud region. Values are typically numbers between 0.0 and 1.0, charts display the values as a percentage between 0% and 100%.*Shown as percent*                                                                                                                                                                                                                                   |
| **gcp.spanner.instance.node_count**(gauge)                                                      | Total number of nodes.                                                                                                                                                                                                                                                                                                                                                                                      |
| **gcp.spanner.instance.peak_split_cpu_usage_score**(gauge)                                   | Maximum cpu usage score observed in a database across all splits.                                                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.instance.placement_row_limit**(gauge)                                            | Upper limit for placement rows.                                                                                                                                                                                                                                                                                                                                                                             |
| **gcp.spanner.instance.placement_row_limit_per_processing_unit**(gauge)                     | Upper limit for placement rows per processing unit.                                                                                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.instance.placement_rows**(gauge)                                                  | Number of placement rows in a database.                                                                                                                                                                                                                                                                                                                                                                     |
| **gcp.spanner.instance.processing_units**(gauge)                                                | Total number of processing units.                                                                                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.instance.replica.autoscaling.high_priority_cpu_utilization_target**(gauge)     | High priority CPU utilization target used for autoscaling replica.*Shown as percent*                                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.instance.replica.autoscaling.max_node_count**(gauge)                             | Maximum number of nodes autoscaler is allowed to allocate to the replica.                                                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.instance.replica.autoscaling.max_processing_units**(gauge)                       | Maximum number of processing units autoscaler is allowed to allocate to the replica.                                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.instance.replica.autoscaling.min_node_count**(gauge)                             | Minimum number of nodes autoscaler is allowed to allocate to the replica.                                                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.instance.replica.autoscaling.min_processing_units**(gauge)                       | Minimum number of processing units autoscaler is allowed to allocate to the replica.                                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.instance.replica.cmek.total_keys**(gauge)                                         | Number of CMEK keys identified by database and key revocation status.                                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.instance.replica.node_count**(gauge)                                              | Number of nodes allocated to each replica identified by location and replica type.                                                                                                                                                                                                                                                                                                                          |
| **gcp.spanner.instance.replica.processing_units**(gauge)                                        | Number of processing units allocated to each replica identified by location and replica type.                                                                                                                                                                                                                                                                                                               |
| **gcp.spanner.instance.session_count**(gauge)                                                   | Number of sessions in use.                                                                                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.instance.storage.limit_bytes**(gauge)                                             | Storage limit for instance in bytes.*Shown as byte*                                                                                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.instance.storage.limit_bytes_per_processing_unit**(gauge)                      | Storage limit per processing unit in bytes.*Shown as byte*                                                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.instance.storage.used_bytes**(gauge)                                              | Storage used in bytes.*Shown as byte*                                                                                                                                                                                                                                                                                                                                                                       |
| **gcp.spanner.instance.storage.utilization**(gauge)                                              | Storage used as a fraction of storage limit.*Shown as percent*                                                                                                                                                                                                                                                                                                                                              |
| **gcp.spanner.lock_stat.total.lock_wait_time**(count)                                         | Total lock wait time for lock conflicts recorded for the entire database.*Shown as second*                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.query_count**(count)                                                              | Count of queries by database name, status, query type, and used optimizer version.                                                                                                                                                                                                                                                                                                                          |
| **gcp.spanner.query_stat.total.bytes_returned_count**(count)                                  | Number of data bytes that the queries returned, excluding transmission encoding overhead.*Shown as byte*                                                                                                                                                                                                                                                                                                    |
| **gcp.spanner.query_stat.total.cpu_time**(count)                                               | Number of seconds of CPU time Cloud Spanner spent on operations to execute the queries.*Shown as second*                                                                                                                                                                                                                                                                                                    |
| **gcp.spanner.query_stat.total.execution_count**(count)                                        | Number of times Cloud Spanner saw queries during the interval.                                                                                                                                                                                                                                                                                                                                              |
| **gcp.spanner.query_stat.total.failed_execution_count**(count)                                | Number of times queries failed during the interval.                                                                                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.query_stat.total.query_latencies**(gauge)                                        | Distribution of total length of time, in seconds, for query executions within the database.*Shown as second*                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.query_stat.total.remote_service_calls_count**(count)                           | Count of remote service calls.                                                                                                                                                                                                                                                                                                                                                                              |
| **gcp.spanner.query_stat.total.remote_service_calls_latencies.avg**(count)                   | The average latency of remote service calls.*Shown as millisecond*                                                                                                                                                                                                                                                                                                                                          |
| **gcp.spanner.query_stat.total.remote_service_calls_latencies.samplecount**(count)           | Latency of remote service calls.                                                                                                                                                                                                                                                                                                                                                                            |
| **gcp.spanner.query_stat.total.remote_service_calls_latencies.sumsqdev**(count)              | Latency of remote service calls.                                                                                                                                                                                                                                                                                                                                                                            |
| **gcp.spanner.query_stat.total.remote_service_network_bytes_sizes.avg**(count)              | The average network bytes exchanged with remote service.*Shown as byte*                                                                                                                                                                                                                                                                                                                                     |
| **gcp.spanner.query_stat.total.remote_service_network_bytes_sizes.samplecount**(count)      | Network bytes exchanged with remote service.                                                                                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.query_stat.total.remote_service_network_bytes_sizes.sumsqdev**(count)         | Network bytes exchanged with remote service.                                                                                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.query_stat.total.remote_service_processed_rows_count**(count)                 | Count of rows processed by a remote service.                                                                                                                                                                                                                                                                                                                                                                |
| **gcp.spanner.query_stat.total.remote_service_processed_rows_latencies.avg**(count)         | The average latency of rows processed by a remote service.*Shown as millisecond*                                                                                                                                                                                                                                                                                                                            |
| **gcp.spanner.query_stat.total.remote_service_processed_rows_latencies.samplecount**(count) | Latency of rows processed by a remote service.                                                                                                                                                                                                                                                                                                                                                              |
| **gcp.spanner.query_stat.total.remote_service_processed_rows_latencies.sumsqdev**(count)    | Latency of rows processed by a remote service.                                                                                                                                                                                                                                                                                                                                                              |
| **gcp.spanner.query_stat.total.returned_rows_count**(count)                                   | Number of rows that the queries returned.                                                                                                                                                                                                                                                                                                                                                                   |
| **gcp.spanner.query_stat.total.scanned_rows_count**(count)                                    | Number of rows that the queries scanned excluding deleted values.                                                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.read_stat.total.bytes_returned_count**(count)                                   | Total number of data bytes that the reads returned excluding transmission encoding overhead.*Shown as byte*                                                                                                                                                                                                                                                                                                 |
| **gcp.spanner.read_stat.total.client_wait_time**(count)                                       | Number of seconds spent waiting due to throttling.*Shown as second*                                                                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.read_stat.total.cpu_time**(count)                                                | Number of seconds of CPU time Cloud Spanner spent execute the reads excluding prefetch CPU and other overhead.*Shown as second*                                                                                                                                                                                                                                                                             |
| **gcp.spanner.read_stat.total.execution_count**(count)                                         | Number of times Cloud Spanner executed the read shapesduring the interval.                                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.read_stat.total.leader_refresh_delay**(count)                                   | Number of seconds spent coordinating reads across instances in multi-regionconfigurations.*Shown as second*                                                                                                                                                                                                                                                                                                 |
| **gcp.spanner.read_stat.total.locking_delays.avg**(count)                                      | The average distribution of total time in seconds spent waiting due to locking.*Shown as second*                                                                                                                                                                                                                                                                                                            |
| **gcp.spanner.read_stat.total.locking_delays.samplecount**(count)                              | Distribution of total time in seconds spent waiting due to locking.                                                                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.read_stat.total.locking_delays.sumsqdev**(count)                                 | Distribution of total time in seconds spent waiting due to locking.                                                                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.read_stat.total.returned_rows_count**(count)                                    | Number of rows that the reads returned.                                                                                                                                                                                                                                                                                                                                                                     |
| **gcp.spanner.row_deletion_policy.deleted_rows_count**(count)                                | Count of rows deleted by the policy since the last sample.                                                                                                                                                                                                                                                                                                                                                  |
| **gcp.spanner.row_deletion_policy.processed_watermark_age**(gauge)                           | Time between now and the read timestamp of the last successful execution. An execution happens as the background task deletes eligible data in batches and is successful even when there are rows that cannot be deleted.*Shown as second*                                                                                                                                                                  |
| **gcp.spanner.row_deletion_policy.undeletable_rows**(count)                                   | Number of rows in all tables in the database that can't be deleted.*Shown as row*                                                                                                                                                                                                                                                                                                                           |
| **gcp.spanner.transaction_stat.total.bytes_written_count**(count)                             | Number of bytes written by transactions.*Shown as byte*                                                                                                                                                                                                                                                                                                                                                     |
| **gcp.spanner.transaction_stat.total.commit_attempt_count**(count)                            | Number of commit attempts for transactions.                                                                                                                                                                                                                                                                                                                                                                 |
| **gcp.spanner.transaction_stat.total.commit_retry_count**(count)                              | Number of commit attempts that are retries from previously aborted transaction attempts.                                                                                                                                                                                                                                                                                                                    |
| **gcp.spanner.transaction_stat.total.participants**(gauge)                                      | Distribution of total number of participants in each commit attempt.                                                                                                                                                                                                                                                                                                                                        |
| **gcp.spanner.transaction_stat.total.transaction_latencies**(gauge)                            | Distribution of total seconds takenfrom the first operation of the transaction to commit or abort.*Shown as second*                                                                                                                                                                                                                                                                                         |
| **gcp.spanner.quota.pending_restore_count.usage**(gauge)                                       | Current usage on quota metric spanner.googleapis.com/pending_restore_count. After sampling, data is not visible for up to 150 seconds.                                                                                                                                                                                                                                                                      |

### Events{% #events %}

The Google Cloud Spanner integration does not include any events.

### Service Checks{% #service-checks %}

The Google Cloud Spanner integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
