Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
gcp_exporter_config
Overview
The gcp_exporter_config
block configures the gcp_exporter
integration, which is an embedded version of
stackdriver_exporter
. This allows for the collection of
metrics data from GCP Cloud Monitoring (formerly stackdriver). The exporter supports all metrics available via GCP’s monitoring API.
Metric names follow the template stackdriver_<monitored_resource>_<metric_type_prefix>_<metric_type>
.
The following example shows a load balancing metric:
The following list shows its attributes:
monitored_resource = https_lb_rule
metric_type_prefix = loadbalancing.googleapis.com/
metric_type = https/backend_latencies
These attributes result in a final metric name of:
stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies
Authentication
Grafana Agent must be running in an environment with access to the GCP project it is scraping. The exporter uses the Google Golang Client Library, which offers a variety of ways to provide credentials. Choose the option that works best for you.
After deciding how Agent will obtain credentials, ensure the account is set up with the IAM role roles/monitoring.viewer
.
Since the exporter gathers all of its data from GCP monitoring APIs, this is the only permission needed.
Configuration reference
Configuration Examples
The following examples show working configurations. See the Configuration Reference for a full overview of the configuration options and what they do.
Multiple prefixes
gcp_exporter:
enabled: true
project_ids:
- <project_id>
metrics_prefixes:
- run.googleapis.com/
- cloudfunctions.googleapis.com/
- compute.googleapis.com/nat
- logging.googleapis.com/billing
- logging.googleapis.com/exports
- serviceruntime.googleapis.com/quota/
- storage.googleapis.com/
- pubsub.googleapis.com/subscription
Load balancing with a filter
gcp_exporter:
enabled: true
project_ids:
- <project_id>
metrics_prefixes:
- loadbalancing.googleapis.com
extra_filters:
- loadbalancing.googleapis.com:resource.labels.backend_target_name="sample-value"
Subset of load balancing metrics with a filter
gcp_exporter:
enabled: true
project_ids:
- <project_id>
metrics_prefixes:
- loadbalancing.googleapis.com/https/request_bytes_count
- loadbalancing.googleapis.com/https/total_latencies
extra_filters:
- loadbalancing.googleapis.com:resource.labels.backend_target_name="sample-value"