Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdeveloper-portal%2Finfrastructure-as-code%2Fterraform-provider%2Fintegrations%2Fgcp-metrics-collector.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdeveloper-portal%2Finfrastructure-as-code%2Fterraform-provider%2Fintegrations%2Fgcp-metrics-collector.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# GCP metrics

## Overview[​](#overview "Direct link to Overview")

Google Cloud Platform provides built-in monitoring and observability tools that allow users to collect and analyze metrics and traces from their GCP resources. Send Google Cloud [metrics](https://cloud.google.com/monitoring/api/metrics_gcp) and [traces](https://cloud.google.com/trace/docs/overview) seamlessly to Coralogix. Search, analyze, and visualize your data, gaining insights into application behavior, identifying errors, and troubleshooting problems.

For more information about this integration, [click here](https://coralogix.com/docs/docs/integrations/gcp/gcp-metrics/.md).

## How to use with Terraform[​](#how-to-use-with-terraform "Direct link to How to use with Terraform")

To deploy this integration using Terraform, you can use the [`coralogix_integration`](https://registry.terraform.io/providers/coralogix/coralogix/latest/docs/resources/integration) resource provided by the Coralogix Terraform provider. Below is an example configuration:

```
resource "coralogix_integration" "gcp-metrics-collector" {

  integration_key = "gcp-metrics-collector"

  version         = "1.7.0"



  parameters = {

    IntegrationName   = "<IntegrationName>"

    MetricPrefixes    = [ "compute.googleapis.com", "cloudsql.googleapis.com" ]

    ServiceAccountKey = "<ServiceAccountKey>"

  }

}
```

Replace the placeholder values with your actual configuration parameters. Refer to the parameter table below for required fields and their descriptions.

## Revisions[​](#revisions "Direct link to Revisions")

1.7.0

Adds two opt-in labels and removes one option. Enable **Add instance\_name label for metrics with instance\_id label** to attach an `instance_name` label to `gce_instance` metrics that already have an `instance_id` (requires the `roles/compute.viewer` permission). Enable **Add cloud.region label** to attach a `cloud.region` label, derived from the resource zone, to all metrics. The `IncludeSystemLabels` option is removed, as it was not adding labels effectively.

| Name                          | Type    | Required | Description                                                                                                                                                                                                                                                                                                                                |
| ----------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IntegrationName               | String  | Yes      |                                                                                                                                                                                                                                                                                                                                            |
| MetricPrefixes                | List    | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix.                                                                                                                                                 |
| ApplicationLabels             | List    | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                                                                                                                                                                          |
| ApplicationName               | String  | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                                                                                                                                                                               |
| BillingProjectId              | String  | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                                                                                                                                                                     |
| EnableCloudRegion             | Boolean | No       | Add a `cloud.region` label, derived from the resource zone, to all collected metrics across every namespace.                                                                                                                                                                                                                               |
| EnableInstanceName            | Boolean | No       | Requires `roles/compute.viewer` permission. Add an `instance_name` label to metric on a gce\_instance.                                                                                                                                                                                                                                     |
| IncludeUserLabels             | Boolean | No       | Include user-defined labels in resource metrics. Those metrics will be prefixed with `user` string.                                                                                                                                                                                                                                        |
| ProjectId                     | String  | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                                                                                                                                                                          |
| ServiceAccountKey             | String  | No       |                                                                                                                                                                                                                                                                                                                                            |
| ServiceAccountTargetPrincipal | String  | No       | Email of the created Service Account.                                                                                                                                                                                                                                                                                                      |
| SubsystemLabels               | List    | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                                                                                                                                                                            |
| SubsystemName                 | String  | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                                                                                                                                                                 |
| UseRawUserLabels              | Boolean | No       | Emit user-defined labels with their original GCP names instead of prefixing them with `user` (`user.` or `user_`, depending on the metric format). If a raw user-defined label conflicts with an existing metric, resource, system, application, or subsystem label, the existing label is kept and the user-defined label is not emitted. |
| UserLabelsResources           | List    | No       | Choose which GCP resources should have user-defined labels included in their metrics. Ensure your account has the necessary permissions. Typically, the `list` permission is required for each selected resource.                                                                                                                          |

1.6.0

Adds the `UseRawUserLabels` option to emit user-defined labels with their original GCP names instead of the `user.` / `user_` prefix. If a raw label conflicts with an existing metric, resource, system, application, or subsystem label, the existing label is kept.

| Name                          | Type    | Required | Description                                                                                                                                                                                                                                                                                                                                |
| ----------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IntegrationName               | String  | Yes      |                                                                                                                                                                                                                                                                                                                                            |
| MetricPrefixes                | List    | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix.                                                                                                                                                 |
| ApplicationLabels             | List    | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                                                                                                                                                                          |
| ApplicationName               | String  | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                                                                                                                                                                               |
| BillingProjectId              | String  | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                                                                                                                                                                     |
| IncludeSystemLabels           | Boolean | No       | Include GCP system labels in resource metrics. Those metrics will be prefixed with `system` string.                                                                                                                                                                                                                                        |
| IncludeUserLabels             | Boolean | No       | Include user-defined labels in resource metrics. Those metrics will be prefixed with `user` string.                                                                                                                                                                                                                                        |
| ProjectId                     | String  | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                                                                                                                                                                          |
| ServiceAccountKey             | String  | No       |                                                                                                                                                                                                                                                                                                                                            |
| ServiceAccountTargetPrincipal | String  | No       | Email of the created Service Account.                                                                                                                                                                                                                                                                                                      |
| SubsystemLabels               | List    | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                                                                                                                                                                            |
| SubsystemName                 | String  | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                                                                                                                                                                 |
| UseRawUserLabels              | Boolean | No       | Emit user-defined labels with their original GCP names instead of prefixing them with `user` (`user.` or `user_`, depending on the metric format). If a raw user-defined label conflicts with an existing metric, resource, system, application, or subsystem label, the existing label is kept and the user-defined label is not emitted. |
| UserLabelsResources           | List    | No       | Choose which GCP resources should have user-defined labels included in their metrics. Ensure your account has the necessary permissions. Typically, the `list` permission is required for each selected resource.                                                                                                                          |

1.5.0

Fixes user-defined label enrichment for Cloud SQL per-database metrics (`cloudsql.googleapis.com/per_database/*`), which previous releases skipped. No new permissions or configuration are required.

| Name                          | Type    | Required | Description                                                                                                                                                                                                       |
| ----------------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IntegrationName               | String  | Yes      |                                                                                                                                                                                                                   |
| MetricPrefixes                | List    | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix.                        |
| ApplicationLabels             | List    | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                                                 |
| ApplicationName               | String  | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                                                      |
| BillingProjectId              | String  | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                                            |
| IncludeSystemLabels           | Boolean | No       | Include GCP system labels in resource metrics. Those metrics will be prefixed with `system` string.                                                                                                               |
| IncludeUserLabels             | Boolean | No       | Include user-defined labels in resource metrics. Those metrics will be prefixed with `user` string.                                                                                                               |
| ProjectId                     | String  | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                                                 |
| ServiceAccountKey             | String  | No       |                                                                                                                                                                                                                   |
| ServiceAccountTargetPrincipal | String  | No       | Email of the created Service Account.                                                                                                                                                                             |
| SubsystemLabels               | List    | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                                                   |
| SubsystemName                 | String  | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                                        |
| UserLabelsResources           | List    | No       | Choose which GCP resources should have user-defined labels included in their metrics. Ensure your account has the necessary permissions. Typically, the `list` permission is required for each selected resource. |

1.4.0

Extends user-defined label enrichment to Memorystore (Valkey, Redis, Redis Cluster, and Memcached) and AlloyDB clusters and instances. Each added resource type requires its own `list` permission.

| Name                          | Type    | Required | Description                                                                                                                                                                                                       |
| ----------------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IntegrationName               | String  | Yes      |                                                                                                                                                                                                                   |
| MetricPrefixes                | List    | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix.                        |
| ApplicationLabels             | List    | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                                                 |
| ApplicationName               | String  | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                                                      |
| BillingProjectId              | String  | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                                            |
| IncludeSystemLabels           | Boolean | No       | Include GCP system labels in resource metrics. Those metrics will be prefixed with `system` string.                                                                                                               |
| IncludeUserLabels             | Boolean | No       | Include user-defined labels in resource metrics. Those metrics will be prefixed with `user` string.                                                                                                               |
| ProjectId                     | String  | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                                                 |
| ServiceAccountKey             | String  | No       |                                                                                                                                                                                                                   |
| ServiceAccountTargetPrincipal | String  | No       | Email of the created Service Account.                                                                                                                                                                             |
| SubsystemLabels               | List    | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                                                   |
| SubsystemName                 | String  | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                                        |
| UserLabelsResources           | List    | No       | Choose which GCP resources should have user-defined labels included in their metrics. Ensure your account has the necessary permissions. Typically, the `list` permission is required for each selected resource. |

1.3.0

Introduces a new method for retrieving user-defined labels via the `UserLabelsResources` selector, supporting Cloud SQL instances (`cloudsql.instances.list`) and Cloud Storage buckets (`storage.buckets.list`). Replaces the method Google deprecated.

| Name                          | Type    | Required | Description                                                                                                                                                                                                       |
| ----------------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IntegrationName               | String  | Yes      |                                                                                                                                                                                                                   |
| MetricPrefixes                | List    | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix.                        |
| ApplicationLabels             | List    | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                                                 |
| ApplicationName               | String  | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                                                      |
| BillingProjectId              | String  | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                                            |
| IncludeSystemLabels           | Boolean | No       | Include GCP system labels in resource metrics. Those metrics will be prefixed with `system` string.                                                                                                               |
| IncludeUserLabels             | Boolean | No       | Include user-defined labels in resource metrics. Those metrics will be prefixed with `user` string.                                                                                                               |
| ProjectId                     | String  | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                                                 |
| ServiceAccountKey             | String  | No       |                                                                                                                                                                                                                   |
| ServiceAccountTargetPrincipal | String  | No       | Email of the created Service Account.                                                                                                                                                                             |
| SubsystemLabels               | List    | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                                                   |
| SubsystemName                 | String  | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                                        |
| UserLabelsResources           | List    | No       | Choose which GCP resources should have user-defined labels included in their metrics. Ensure your account has the necessary permissions. Typically, the `list` permission is required for each selected resource. |

1.2.0

Adds the `IncludeUserLabels` and `IncludeSystemLabels` options to include user-defined and GCP system labels in resource metrics.

| Name                          | Type    | Required | Description                                                                                                                                                                                |
| ----------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IntegrationName               | String  | Yes      |                                                                                                                                                                                            |
| MetricPrefixes                | List    | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix. |
| ApplicationLabels             | List    | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                          |
| ApplicationName               | String  | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                               |
| BillingProjectId              | String  | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                     |
| IncludeSystemLabels           | Boolean | No       | Include GCP system labels in resource metrics. Those metrics will be prefixed with `system` string.                                                                                        |
| IncludeUserLabels             | Boolean | No       | Include user-defined labels in resource metrics. Those metrics will be prefixed with `user` string.                                                                                        |
| ProjectId                     | String  | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                          |
| ServiceAccountKey             | String  | No       |                                                                                                                                                                                            |
| ServiceAccountTargetPrincipal | String  | No       | Email of the created Service Account.                                                                                                                                                      |
| SubsystemLabels               | List    | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                            |
| SubsystemName                 | String  | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                 |

1.1.0

Adds service account impersonation as an authentication method, removing the need to upload a service account key. `ServiceAccountKey` is now optional; the key-based flow is still supported.

| Name                          | Type   | Required | Description                                                                                                                                                                                |
| ----------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IntegrationName               | String | Yes      |                                                                                                                                                                                            |
| MetricPrefixes                | List   | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix. |
| ApplicationLabels             | List   | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                          |
| ApplicationName               | String | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                               |
| BillingProjectId              | String | No       | A caller-specified project for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.                                                     |
| ProjectId                     | String | No       | The ID of the GCP project from which metrics should be collected.                                                                                                                          |
| ServiceAccountKey             | String | No       |                                                                                                                                                                                            |
| ServiceAccountTargetPrincipal | String | No       | Email of the created Service Account.                                                                                                                                                      |
| SubsystemLabels               | List   | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                            |
| SubsystemName                 | String | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                 |

1.0.0

**Breaking change:** DELTA-type metrics are now processed as deltas and published as counters, and metric names follow Prometheus naming guidelines (unit suffix, `_total` for counters). Update your queries when upgrading from an earlier version.

| Name              | Type   | Required | Description                                                                                                                                                                                |
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IntegrationName   | String | Yes      |                                                                                                                                                                                            |
| MetricPrefixes    | List   | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix. |
| ServiceAccountKey | String | Yes      |                                                                                                                                                                                            |
| ApplicationLabels | List   | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                          |
| ApplicationName   | String | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                               |
| ProjectId         | String | No       | The ID of the GCP project from which metrics should be collected. If not provided, the project ID of the service account will be used.                                                     |
| SubsystemLabels   | List   | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                            |
| SubsystemName     | String | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                 |

0.0.2

Adds the `ProjectId` parameter, which lets a service account collect metrics from a different project (given the necessary permissions).

| Name              | Type   | Required | Description                                                                                                                                                                                |
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IntegrationName   | String | Yes      |                                                                                                                                                                                            |
| MetricPrefixes    | List   | Yes      | To limit unnecessary API calls that fetch no data but count towards the quota limit, specify only the GCP prefixes of the metrics that actually exist and you want to pull into Coralogix. |
| ServiceAccountKey | String | Yes      |                                                                                                                                                                                            |
| ApplicationLabels | List   | No       | Select labels whose values will be used as the Application Name. If more than one label can be matched, the first match in the list will be used.                                          |
| ApplicationName   | String | No       | The default name of the application that the integration will be used with. This is used as a fallback when no labels match.                                                               |
| ProjectId         | String | No       | The ID of the GCP project from which metrics should be collected. If not provided, the project ID of the service account will be used.                                                     |
| SubsystemLabels   | List   | No       | Select labels whose values will be used as the Subsystem Name. If more than one label can be matched, the first match in the list will be used.                                            |
| SubsystemName     | String | No       | The default name of the subsystem that the integration will be used with. This is used as a fallback when no labels match.                                                                 |
