---
title: Google Cloud SQL monitoring integration
source: https://docs.newrelic.com/docs/infrastructure/google-cloud-platform-integrations/gcp-integrations-list/google-cloud-sql-monitoring-integration
---

[New Relic integrations](https://docs.newrelic.com/docs/infrastructure/introduction-infra-monitoring) with the [Google Cloud Platform (GCP)](https://cloud.google.com/) include one that reports [Google Cloud SQL](https://cloud.google.com/sql/docs/) data to New Relic. This document explains how to activate the GCP Cloud SQL integration and describes the data it reports.

## Features

Cloud SQL is Google Cloud's fully managed database service for MySQL, PostgreSQL, and SQL Server. New Relic Cloud SQL integration collects CPU, memory, disk, connection, replication, and database-level metrics for each Cloud SQL instance and its databases.

## Activate integration [#activate]

To enable the integration, follow standard procedures to [connect your GCP service to New Relic](https://docs.newrelic.com/docs/connect-google-cloud-platform-services-infrastructure):

-   [Connect with Workload Identity Federation (recommended)](https://docs.newrelic.com/docs/connect-google-cloud-platform-services-infrastructure)
-   [Connect with service account or user account](https://docs.newrelic.com/docs/connect-google-cloud-platform-services-infrastructure)

## Polling frequency [#polling]

New Relic integrations query your GCP services according to a polling interval that varies by integration. The polling frequency for Google Cloud SQL is 5 minutes. The resolution is 1 data point every minute.

## Workload Identity Federation [#wif]

### Find and use data [#find-data-wif]

After you enable the integration, your Cloud SQL resources appear as entities in the New Relic entity explorer. To see dashboards and manage services, go to [one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Infrastructure > GCP.

All Cloud SQL metrics available in GCP Cloud Monitoring are collected as dimensional metrics in the `Metric` event type. Additional metrics beyond this table are collected automatically. See [Google's Cloud SQL metrics documentation](https://cloud.google.com/monitoring/api/metrics_gcp#gcp-cloudsql) for the complete list.

#### Entities

**Cloud SQL entities**

| Entity            | Entity type                   | Resource type                |
| ----------------- | ----------------------------- | ---------------------------- |
| Database          | `GCPCLOUDSQL`                 | `cloudsql_database`          |
| Instance Database | `GCPCLOUDSQLINSTANCEDATABASE` | `cloudsql_instance_database` |

### Metric data [#metrics-wif]

#### Key metrics — Database

| Metric name                                     | Unit    | Description                                                             |
| ----------------------------------------------- | ------- | ----------------------------------------------------------------------- |
| `gcp.cloudsql.database.cpu.utilization`         | Percent | Fraction of CPU currently in use by the Cloud SQL database.             |
| `gcp.cloudsql.database.memory.utilization`      | Percent | Fraction of memory currently in use by the Cloud SQL database.          |
| `gcp.cloudsql.database.disk.utilization`        | Percent | Fraction of disk currently in use by the Cloud SQL database.            |
| `gcp.cloudsql.database.disk.bytes_used`         | Bytes   | Disk bytes currently in use by the Cloud SQL database.                  |
| `gcp.cloudsql.database.disk.write_ops_count`    | Count   | Number of disk write operations against the Cloud SQL database.         |
| `gcp.cloudsql.database.disk.read_ops_count`     | Count   | Number of disk read operations against the Cloud SQL database.          |
| `gcp.cloudsql.database.network.connections`     | Count   | Number of client connections to the Cloud SQL database.                 |
| `gcp.cloudsql.database.uptime`                  | Seconds | Uptime of the Cloud SQL database since it last started.                 |
| `gcp.cloudsql.database.replication.replica_lag` | Seconds | Replication lag between primary and replica for the Cloud SQL database. |

#### Key metrics — Instance Database

| Metric name                                          | Unit  | Description                                                                    |
| ---------------------------------------------------- | ----- | ------------------------------------------------------------------------------ |
| `gcp.cloudsql.database.postgresql.num_backends`      | Count | Number of PostgreSQL backends on the instance database.                        |
| `gcp.cloudsql.database.mysql.queries`                | Count | Number of queries served by the MySQL instance database.                       |
| `gcp.cloudsql.database.postgresql.transaction_count` | Count | Number of PostgreSQL transactions on the instance database, faceted by result. |

For the complete list of Cloud SQL metrics, see [Google's Cloud SQL metrics documentation](https://cloud.google.com/monitoring/api/metrics_gcp#gcp-cloudsql).

## Service account or user account [#service-account]

### Find and use data [#find-data]

After activating the integration and waiting a few minutes (based on the [polling frequency](#polling)), data will appear in the New Relic UI. To [find and use your data](https://docs.newrelic.com/docs/infrastructure/integrations/find-use-infrastructure-integration-data), including links to your dashboards and alert settings, go to [one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Infrastructure > GCP > (select an integration).

To view [metric data](https://docs.newrelic.com/docs/telemetry-data-platform/understand-data/new-relic-data-types/#metrics) for your GCP SQL integration in New Relic, [create NRQL queries](https://docs.newrelic.com/docs/integrations/new-relic-integrations/getting-started/use-integration-data-new-relic-insights#nrql) for `GcpCloudSqlSample` [events](https://docs.newrelic.com/docs/data-apis/understand-data/new-relic-data-types/#event-data) and their related attributes.

### GcpCloudSqlSample [#gcp-app-cloud-sql-sample]

Query `GcpCloudSqlSample` events in New Relic to view data for the following attributes:

| Attribute                                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `database.AutoFailoverRequestCount`              | Delta of number of instance auto-failover requests.                                                                                                                                                                                                                                                                                                                                                                        |
| `database.AvailableForFailover`                  | This is over `0` if the failover operation is available on the instance.                                                                                                                                                                                                                                                                                                                                                   |
| `database.cpu.ReservedCores`                     | Number of cores reserved for the database.                                                                                                                                                                                                                                                                                                                                                                                 |
| `database.cpu.UsageTime`                         | Cumulative CPU usage time in seconds.                                                                                                                                                                                                                                                                                                                                                                                      |
| `database.cpu.Utilization`                       | The fraction of the reserved CPU that is currently in use.                                                                                                                                                                                                                                                                                                                                                                 |
| `database.disk.BytesUsed`                        | Data utilization in bytes.                                                                                                                                                                                                                                                                                                                                                                                                 |
| `database.disk.Quota`                            | Maximum data disk size in bytes.                                                                                                                                                                                                                                                                                                                                                                                           |
| `database.disk.ReadOps`                          | Delta count of data disk read IO operations.                                                                                                                                                                                                                                                                                                                                                                               |
| `database.disk.Utilization`                      | The fraction of the disk quota that is currently in use.                                                                                                                                                                                                                                                                                                                                                                   |
| `database.disk.WriteOps`                         | Delta count of disk write IO operations.                                                                                                                                                                                                                                                                                                                                                                                   |
| `database.memory.Quota`                          | Maximum RAM size in bytes.                                                                                                                                                                                                                                                                                                                                                                                                 |
| `database.memory.Usage`                          | RAM usage in bytes.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `database.memory.Utilization`                    | The fraction of the memory quota that is currently in use.                                                                                                                                                                                                                                                                                                                                                                 |
| `database.mysql.InnodbBufferPoolPagesDirty`      | The fraction of the memory quota that is currently in use.                                                                                                                                                                                                                                                                                                                                                                 |
| `database.mysql.InnodbBufferPoolPagesFree`       | Number of unused pages in the InnoDB buffer pool.                                                                                                                                                                                                                                                                                                                                                                          |
| `database.mysql.InnodbBufferPoolPagesTotal`      | Total number of pages in the InnoDB buffer pool.                                                                                                                                                                                                                                                                                                                                                                           |
| `database.mysql.InnodbDataFsyncs`                | Delta count of InnoDB fsync() calls.                                                                                                                                                                                                                                                                                                                                                                                       |
| `database.mysql.InnodbOsLogFsyncs`               | Delta count of InnoDB fsync() calls to the log file.                                                                                                                                                                                                                                                                                                                                                                       |
| `database.mysql.InnodbPagesRead`                 | Delta count of InnoDB pages read.                                                                                                                                                                                                                                                                                                                                                                                          |
| `database.mysql.InnodbPagesWritten`              | Delta count of InnoDB pages written.                                                                                                                                                                                                                                                                                                                                                                                       |
| `database.mysql.Queries`                         | Delta count of statements executed by the server.                                                                                                                                                                                                                                                                                                                                                                          |
| `database.mysql.Questions`                       | Delta count of statements executed by the server sent by the client.                                                                                                                                                                                                                                                                                                                                                       |
| `database.mysql.ReceivedBytesCount`              | Delta count of bytes received by MySQL process.                                                                                                                                                                                                                                                                                                                                                                            |
| `database.mysql.replication.SecondsBehindMaster` | Number of seconds the read replica is behind its master (approximation).                                                                                                                                                                                                                                                                                                                                                   |
| `database.mysql.replication.SlaveIoRunning`      | Indicates whether the I/O thread for reading the master's binary log is running. Possible values are `Yes`, `No`, and `Connecting`.                                                                                                                                                                                                                                                                                        |
| `database.mysql.replication.SlaveSqlRunning`     | Indicates whether the I/O thread for reading the master's binary log is running. Possible values are `Yes`, `No`, and `Connecting`.                                                                                                                                                                                                                                                                                        |
| `database.mysql.SentBytesCount`                  | Indicates whether the I/O thread for reading the master's binary log is running. Possible values are `Yes`, `No`, and `Connecting`.                                                                                                                                                                                                                                                                                        |
| `database.network.Connections`                   | Number of connections to the Cloud SQL MySQL instance.                                                                                                                                                                                                                                                                                                                                                                     |
| `database.network.ReceivedBytesCount`            | Delta count of bytes received through the network.                                                                                                                                                                                                                                                                                                                                                                         |
| `database.network.SentBytesCount`                | Delta count of bytes sent through the network.                                                                                                                                                                                                                                                                                                                                                                             |
| `database.postgresql.NumBackends`                | Number of connections to the Cloud SQL PostgreSQL instance.                                                                                                                                                                                                                                                                                                                                                                |
| `database.postgresql.replication.ReplicaByteLag` | Replication lag in bytes. Reported from the master per replica.                                                                                                                                                                                                                                                                                                                                                            |
| `database.postgresql.TransactionCount`           | Delta count of number of transactions.                                                                                                                                                                                                                                                                                                                                                                                     |
| `database.State`                                 | The current serving state of the Cloud SQL instance. This can be one of the following: - `RUNNABLE`: The instance is running, or is ready to run when accessed. - `SUSPENDED`: The instance is not available, for example due to problems with billing. - `PENDING_CREATE`: The instance is being created. - `MAINTENANCE`: The instance is down for maintenance. - `UNKNOWN_STATE`: The state of the instance is unknown. |
| `database.Up`                                    | Indicates if the server is up or not. On-demand instances are spun down if no connections are made for a sufficient amount of time.                                                                                                                                                                                                                                                                                        |
| `database.Uptime`                                | Delta count of the time in seconds the instance has been running.                                                                                                                                                                                                                                                                                                                                                          |
