Grafana Cloud

GCP Metrics integration for Grafana Cloud

Google Cloud Platform (GCP), offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail, Google Drive, and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning.

The GCP Metrics integration enables you to send metrics from your GCP projects to Grafana Cloud.

This integration includes 1 pre-built dashboard to help monitor and visualize GCP Metrics metrics.

Before you begin

To export metrics from GCP, the Google Stackdriver Exporter is used. That exporter uses the Google Golang Client Library, which offers a variety of ways to provide credentials.

Please refer to the Google Application Default Credentials documentation to see how the credentials can be provided.

If you are using IAM roles, the roles/monitoring.viewer IAM role contains the required permissions. See the Access Control Guide for more information.

If you are still using the legacy Access scopes, the scope is required.

Install GCP Metrics integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find GCP Metrics and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send GCP Metrics metrics to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboard to your Grafana Cloud instance, and you can start monitoring your GCP Metrics setup.

Configuration snippets for Grafana Alloy

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape resource metrics within your GCP projects, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced integrations snippets

prometheus.exporter.gcp "integrations_gcp" {
        project_ids = [

        metrics_prefixes = [

prometheus.scrape "integrations_gcp" {
    targets    = prometheus.exporter.gcp.integrations_gcp.targets
    forward_to = [prometheus.remote_write.metrics_service.receiver]
    job_name   = "integrations/gcp"

This integration is configured to work with the GCP metrics exporter, which is embedded in the Grafana Agent. Enable the integration by adding the code block in the above section to your agent configuration.

For a full list of configuration values, refer to the component documentation.

Below are the most common arguments:


Google Cloud project ID from where we want to scrape metrics from.


Google Monitoring Metric Type prefixes. In configuration, you must specify the prefixes you want to scrape metrics from, each prefix represents a specific GCP resource, potentially followed by the metric types you want to scrape. These can be as targeted or loose as needed. As an example with pubsub metrics:

All metrics:


All snapshot specific metrics:


All snapshot specific metrics and a few subscription metrics:



Additional filters you can put on top of the metrics described above, to further refine the resources you would like to collect metrics from. The structure for these filters is <targeted_metric_prefix>:<filter_query>. The targeted_metric_prefix is used to ensure the filter is only applied to the metric_prefix(es) where it makes sense.

As an example with pubsub metrics:


targeted_metric_prefix options would be:

  • (apply to all defined prefixes)
  • (apply to only snapshot metrics)
  • (apply to only subscription metrics)


The time range used when querying for metrics. Defaults to 5m when not set.


Offset for the Google Monitoring Metrics interval into the past by the ingest delay from the metric metadata. When enabled this automatically adjusts the time range used when querying for metrics backwards based on the metadata GCP has published for how long the data can take to be ingested. Defaults to false when not set.


Offset for the Google Monitoring Metrics interval into the past. Defaults to 0s when not set.


Drop metrics from attached projects and fetch project_id only. Defaults to false when not set.


How long should the collector wait for a result from the API. Defaults to 15s when not set.

Grafana Agent static configuration (deprecated)

The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.


The GCP Metrics integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • GCP Metrics Overview




# 0.0.1 - April 2023

* Initial release


By connecting your GCP Metrics instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.