Monitoring Google Cloud Platform (GCP)

To provide visibility and insights of Google Cloud Platform cloud-based environments, you can use the Instana host agent to automatically discover and monitor GCP services by:

  • Providing real-time insights into metadata, configuration, and metrics.
  • Monitoring the health of each service and configuring alerts for issues that might occur.
Note:
To remotely monitor GCP in a Kubernetes or Red Hat OpenShift cluster, do not install the Instana host agent on each node of the cluster. Install the host agent on a dedicated host machine.

Supported information

To make sure that the GCP sensor is compatible with your current setup, check the following support information sections.

Supported operating systems

The supported operating systems of the GCP sensor are consistent with the host agent requirements. For more information, see Agent requirements.

Sensor versions and the GCP project monitoring capabilities

The GCP sensor version determines whether a single Instana agent can monitor one or multiple GCP projects. To check your current sensors version, see Sensors version.

Sensor version Project monitoring support Description
1.2.x and earlier Single GCP project Monitors resources within a single GCP project
1.3.x and later Multiple GCP projects Monitors resources across multiple GCP projects

Installing Instana host agent

Instana agent can be installed in multiple hosts. For more information, see Installing host agents.

Configuring GCP monitoring (single-project monitoring)

Install the Instana host agent on a host inside or outside your GCP environment. A single Instana agent instance supports both single-project and multi-project monitoring for GCP services.

The Instana Google Cloud integration uses service account to create an API connection between Google Cloud and Instana.

Note:
Depending on the number of monitored entities in your cloud environment, you might need to increase the maximum amount of available memory to your host agent. You can increase the agent memory by setting the environment variable INSTANA_AGENT_MAX_MEM to a value that is greater than the default value of 544 MB. For example, to set the agent memory to 1 GB, you can set INSTANA_AGENT_MAX_MEM=1024m. For more information, see Setting agent memory limits.

After you install the Instana agent, complete the following steps:

  1. Create a GCP service account.
  2. Create a custom role with the required permissions.
  3. Generate a service account key.
  4. Configure the Instana agent.
  5. Grant the service account access.

Create service account

The following steps create a service account and provide Instana with the credentials it needs to make API calls on your behalf.

  1. Access the Google Cloud credentials page for the project where you want to set up the Instana integration.

    For multi-project monitoring, you can create the service account in any GCP project you manage. The project where the service account is created is automatically included to other monitored projects.

  2. Click CREATE CREDENTIALS > Service account.

    SelectServiceAccount

  3. In the Create service account page, enter a unique name for the service account, and click Create and continue.

  4. Click Create and close.

Create custom role

To create a custom role, complete the following steps:

  1. From the navigation menu, click Roles > Create custom role.
  2. Enter the role title and description.
  3. For the Role launch stage, select General Availability.
  4. Click Add permissions.

    gcprolecreation

    Assign the following minimal set of permissions:

    • monitoring.timeSeries.list
    • pubsub.subscriptions.list
    • pubsub.topics.list
    • resourcemanager.projects.get
    • cloudsql.instances.list
    • storage.buckets.list
    • run.revisions.list
    • run.services.list

    For multi-project monitoring, the following additional permissions are required:

    • resourcemanager.projects.list
    • resourcemanager.folders.list
    • serviceusage.services.use
    Note:
    To enable single-project monitoring, grant the custom role access at the individual project level. For more information, see Granting access to individual projects.
    Note:
    To enable multi-project monitoring, grant the custom role access at the folder level so all permissions are inherited by all child folders and projects. For more information, see Granting the service account access to folders or projects.
  5. Click Create.

Generate service account key

  1. Select the account you created from the list of service accounts.

  2. Select the Key tab, and click Add key.

  3. Select Create new key.

  4. Select the key type as JSON, and then click Create.

    serviceaccountkey

    Note:
    You need to record the location of the credential file where it is saved to complete the integration.

Configure Instana agent

  1. Add a field credentials_path to the configuration.yaml file with the path to the credentials file. See the following example:

    com.instana.plugin.gcp:
      poll_rate: 60 # How often Google's monitoring API is polled in seconds
      credentials_path: '/opt/instana/credentials/cred-gcp.json' # Path to service account credentials
      exclude_tags: ''
      include_tags: ''
    

Grant the service account access to folders or projects

After creating the service account, assign it the required IAM roles at the appropriate scope, either at the GCP folder level (to enable multi-project monitoring) or at the individual project level (for single-project monitoring). Repeat the following steps for each additional folder or project you want to grant the service account access to.

Granting access at the folder level

Use this procedure when the folder_ids or project_ids configuration property is configured to enable multi-project monitoring. Roles granted at the folder level allows it to be inherited by all child folders and projects automatically.

  1. Open the Google Cloud IAM & Admin and select the IAM tab.

  2. Open the Google Cloud Project Selector and select the folder to be monitored.

  3. Click Grant access from the View by principals tab.

  4. In the Add principals field, enter your principal identifier.

    The selected principal must be the service account that you created following the Create service account procedure, in one of the child projects of the folder to be monitored.

  5. In the Assign roles field, select the custom role that includes the required permissions described in the Create custom role section.

  6. Click Save.

Note:
The IAM role assignment is inherited by all child folders and projects within the selected folder.

Granting access to individual projects

Use this procedure to enable single-project monitoring:

  1. Open the IAM & Admin page, and select the IAM tab.

  2. Open the Google Cloud Project Selector and select the project to be monitored.

  3. Click Grant access from the View by principals tab.

  4. In the Add principals field, enter your principal identifier.

    The principal must be the service account that you created following the Create service account procedure.

  5. In the Assign roles field, select the custom role that includes the required permissions described in the Create custom role section.

  6. Click Save.

Note:
Complete steps 1–5 for each additional project to be monitored.

Configuring GCP multi-project monitoring (public preview)

Instana supports monitoring GCP services across multiple projects with a single host agent, providing visibility across your entire GCP environment without a separate agent for each project.

Configuration options for multiple projects

To specify which projects to monitor, use the following agent configuration settings:

  • folder_ids: A comma-separated list of GCP folder IDs. The agent discovers all projects within those folders by traversing the folder hierarchy recursively.
  • project_ids: A comma-separated list of explicit GCP project IDs to monitor directly.

Both parameters are optional and can be used independently or together. The project ID embedded in the service account credentials file is always monitored regardless of these settings.

To enable multi-project monitoring for all GCP sensors, add folder_ids or project_ids (or both) to the global configuration block in the /opt/instana/agent/etc/instana/configuration.yaml file:

com.instana.plugin.gcp:
  poll_rate: 60
  credentials_path: '/opt/instana/credentials/cred-gcp.json'
  folder_ids: '125026347226,203778264789'   # Comma-separated GCP folder numeric IDs
  project_ids: 'my-project-1,my-project-2' # Comma-separated GCP project IDs
  exclude_tags: '' # Optional: omit if not filtering resources by label
  include_tags: '' # Optional: omit if not filtering resources by label
Note:
Changes to folder_ids or project_ids in configuration.yaml are picked up automatically when adding entries. Removing entries requires an agent restart to clear the corresponding entities from the Instana UI.

After the agent starts, discovered projects and their resources appear in the Instana UI under Infrastructure within the first poll cycle.

GCP folder hierarchy

GCP folders can contain child folders and projects. When you configure folder_ids, the agent discovers all projects by traversing the folder hierarchy recursively, up to 3 levels of nesting from each configured root folder. Projects and folders beyond that depth are not discovered automatically and must be added directly to project_ids or folder_ids to include them.

Per-sensor override configuration

You can override the global folder_ids and project_ids settings for individual GCP sensors. Each property is overridden independently. For example, a sensor-specific project_ids setting overrides only the global project_ids value and does not affect the global folder_ids value. Duplicate projects are removed automatically.

# Global configuration — applies to all GCP sensors unless overridden
com.instana.plugin.gcp:
  credentials_path: '/opt/instana/credentials/cred-gcp.json'
  folder_ids: '125026347226,203778264789'
  project_ids: 'my-project-1,my-project-2'

# Per-sensor override — Cloud SQL uses its own project_ids
# The global folder_ids ('125026347226,203778264789') still applies to Cloud SQL
com.instana.plugin.gcp.sql:
  credentials_path: '/opt/instana/credentials/cred-gcp.json'
  project_ids: 'sql-prod-project-1,sql-prod-project-2'

The following table lists the plugin configuration name for each GCP sensor:

GCP service Plugin configuration name
Global (all GCP services) com.instana.plugin.gcp
Cloud SQL com.instana.plugin.gcp.sql
Cloud Pub/Sub com.instana.plugin.gcp.pubsub
Cloud Run com.instana.plugin.gcp.run
Cloud Storage com.instana.plugin.gcp.storage
Cloud Datastore com.instana.plugin.gcp.datastore
Google Compute Engine com.instana.plugin.gce

Best practices for multi-project monitoring

  • Use project_ids for precise scope: If you know exactly which projects to monitor, configure them directly in project_ids. This approach prevents newly added projects within a folder from being included automatically.
  • Ensure billing and APIs are enabled: All monitored projects must have billing enabled and the Cloud Monitoring API activated. Projects that do not meet these requirements do not return metrics. For more information, see Required GCP service API.

Filtering resources within a project

The include_tags and exclude_tags fields filter individual GCP resources within a project based on their GCP labels. For example, use these fields to monitor only resources labeled env:prod or to exclude resources labeled env:dev.

These fields apply only at the resource level and cannot be used to filter which projects or folders are monitored. To monitor a specific set of projects, configure those project IDs directly in project_ids instead of relying on folder discovery.

Observations on agent sizing and resource scalability for multi-project monitoring

The following observations outline the validated performance limits for the Instana agent when monitoring GCP resources. These results are based on load testing with 50 GCP projects (~1,200 total service instances) on a GCE e2-small instance (2 vCPUs, 2 GB RAM) with the default agent heap of 160 MB, sustained over a 24-hour period.

Note:
At 50 projects and approximately 1,200 monitored resources, peak heap usage reached approximately 150 MB, which is around 87% of the default 160 MB heap allocation. To maintain a safe operational headroom and accommodate transient spikes during discovery cycles, a minimum heap of 256 MB is suggested for deployments targeting 50 or more GCP projects.

Validated load test results

The following table lists the validated and projected thresholds. Values beyond 50 projects are theoretical projections and require validation in your specific environment before use in production.

GCE machine type Hardware specs Agent max heap (INSTANA_AGENT_MAX_MEM) Max GCP projects Estimated total resources Status
e2-small (minimum) 2 vCPU, 2 GB RAM 256 MB 50 ~1,200 Validated
e2-medium (recommended) 2 vCPU, 4 GB RAM 256 MB ~120 ~2,880 Theoretical
e2-medium 2 vCPU, 4 GB RAM 512 MB ~300 ~7,200 Theoretical

GCP cloud monitoring API quota

Note:
At 50 projects, the agent consumed approximately 6% of the available GCP Cloud Monitoring API quota (360 queries per minute out of 6,000 per project). No rate-limiting errors were observed during testing. GCP API quota is not expected to be a limiting factor at this scale. To request the service quota limit increase, follow the Monitor API quotas guideline.