steampipe plugin install gcp

Table: gcp_sql_database_instance_metric_connections - Query Google Cloud SQL Database Instance Connections using SQL

Google Cloud SQL is a fully-managed database service that makes it easy to set up, maintain, manage, and administer relational databases on Google Cloud Platform. The service provides a highly available and scalable cloud database environment, supporting both MySQL and PostgreSQL databases. It allows users to focus on application development, freeing them from the typical database administration tasks.

Table Usage Guide

The gcp_sql_database_instance_metric_connections table provides insights into the current client connections to a Google Cloud SQL Database Instance. As a database administrator, you can explore connection-specific details through this table, including the connection count and related metrics. Utilize it to monitor connection patterns, diagnose potential connection issues, and ensure optimal database performance.

GCP Monitoring metrics provide data about the performance of your systems. The gcp_sql_database_instance_metric_connections table provides metric statistics at 5 minute intervals for the most recent 5 days.

Examples

Basic info

Explore the performance of your Google Cloud SQL databases by analyzing the minimum, maximum, and average number of connections over time. This can help in identifying potential bottlenecks and planning for capacity upgrades.

select
instance_id,
timestamp,
minimum,
maximum,
average,
sample_count
from
gcp_sql_database_instance_metric_connections
order by
instance_id;
select
instance_id,
timestamp,
minimum,
maximum,
average,
sample_count
from
gcp_sql_database_instance_metric_connections
order by
instance_id;

Intervals averaging over 100 connections

Analyze the settings to understand instances where the average number of connections to a Google Cloud SQL database exceeds 100. This can be useful for identifying potential bottlenecks or periods of high demand in your database infrastructure.

select
instance_id,
timestamp,
round(minimum :: numeric, 2) as min_connection,
round(maximum :: numeric, 2) as max_connection,
round(average :: numeric, 2) as avg_connection,
sample_count
from
gcp_sql_database_instance_metric_connections
where
average > 100
order by
instance_id;
select
instance_id,
timestamp,
round(minimum, 2) as min_connection,
round(maximum, 2) as max_connection,
round(average, 2) as avg_connection,
sample_count
from
gcp_sql_database_instance_metric_connections
where
average > 100
order by
instance_id;

Intervals averaging fewer than 10 connections

Explore which instances in your database are operating with an average of fewer than 10 connections. This can help in optimizing resource allocation by identifying under-utilized instances.

select
instance_id,
timestamp,
round(minimum :: numeric, 2) as min_connection,
round(maximum :: numeric, 2) as max_connection,
round(average :: numeric, 2) as avg_connection,
sample_count
from
gcp_sql_database_instance_metric_connections
where
average < 10
order by
instance_id;
select
instance_id,
timestamp,
round(minimum, 2) as min_connection,
round(maximum, 2) as max_connection,
round(average, 2) as avg_connection,
sample_count
from
gcp_sql_database_instance_metric_connections
where
average < 10
order by
instance_id;

Schema for gcp_sql_database_instance_metric_connections

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
averagedouble precisionThe average of the metric values that correspond to the data point.
instance_idtextThe ID of the instance.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
maximumdouble precisionThe maximum metric value for the data point.
metadatajsonbThe associated monitored resource metadata.
metric_kindtextThe metric type.
metric_labelsjsonbThe set of label values that uniquely identify this metric.
metric_typetextThe associated metric. A fully-specified metric used to identify the time series.
minimumdouble precisionThe minimum metric value for the data point.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
resourcejsonbThe associated monitored resource.
sample_countdouble precisionThe number of metric values that contributed to the aggregate value of this data point.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
sumdouble precisionThe sum of the metric values for the data point.
timestamptimestamp with time zoneThe time stamp used for the data point.
unittextThe data points of this time series. When listing time series, points are returned in reverse time order.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp

You can pass the configuration to the command with the --config argument:

steampipe_export_gcp --config '<your_config>' gcp_sql_database_instance_metric_connections