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.
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.
Platforms
Monitored services
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.
- Single-project monitoring: Follow the single-project configuration.
- Multi-project monitoring: Follow the multi-project monitoring configuration.
The Instana Google Cloud integration uses service account to create an API connection between Google Cloud and Instana.
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:
- Create a GCP service account.
- Create a custom role with the required permissions.
- Generate a service account key.
- Configure the Instana agent.
- 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.
-
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.
-
Click CREATE CREDENTIALS > Service account.
-
In the Create service account page, enter a unique name for the service account, and click Create and continue.
-
Click Create and close.
Create custom role
To create a custom role, complete the following steps:
- From the navigation menu, click Roles > Create custom role.
- Enter the role title and description.
- For the Role launch stage, select General Availability.
-
Click Add permissions.
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. -
-
Click Create.
Generate service account key
-
Select the account you created from the list of service accounts.
-
Select the Key tab, and click Add key.
-
Select Create new key.
-
Select the key type as JSON, and then click Create.
Note:You need to record the location of the credential file where it is saved to complete the integration.
Configure Instana agent
-
Add a field
credentials_pathto theconfiguration.yamlfile 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.
-
Open the Google Cloud IAM & Admin and select the IAM tab.
-
Open the Google Cloud Project Selector and select the folder to be monitored.
-
Click Grant access from the View by principals tab.
-
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.
-
In the Assign roles field, select the custom role that includes the required permissions described in the Create custom role section.
-
Click Save.
Granting access to individual projects
Use this procedure to enable single-project monitoring:
-
Open the IAM & Admin page, and select the IAM tab.
-
Open the Google Cloud Project Selector and select the project to be monitored.
-
Click Grant access from the View by principals tab.
-
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.
-
In the Assign roles field, select the custom role that includes the required permissions described in the Create custom role section.
-
Click Save.
Required GCP service API
Enable the following GCP service API on each monitored project:
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.
Prerequisites
- Service account was created following the Create service account procedure.
- Service account key was generated following the Generate service account key procedure.
- Access was granted by using the created custom role by following the Granting access at the folder level procedure.
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
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_idsfor precise scope: If you know exactly which projects to monitor, configure them directly inproject_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.
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 |