Deploy the Dynatrace GCP metric integration in GCP Cloud Function
As an alternative to the main deployment, that provides Google Cloud Platform monitoring for both metrics and logs, and where the deployment takes place in a GKE cluster, you can choose to set up monitoring for metrics only, in GCP Cloud Function. Note that the GCP Cloud Function deployment isn't recommended for large environments and doesn't support log forwarding. In this scenario, you will be able run the deployment script either in Google Cloud Shell or in bash. After installation, you'll get metrics, dashboards, and alerts for your configured services in Dynatrace.
For other deployment options, see Alternative deployment scenarios.
This page describes how to deploy version 1.0 of the Dynatrace GCP integration in GCP Cloud Function.
You can deploy the Dynatrace GCP integration in Google Cloud Shell or in bash.
If you use Google Cloud Shell, you need to install
Running the deployment script requires a list of permissions. You need to create a custom role and use it to deploy
To create a custom role
Create a YAML file named
dynatrace-gcp-function-cloud-function-deployment-role.yamlwith the following content:dynatrace-gcp-function-cloud-function-deployment-role.yamlyaml
title: Dynatrace GCP Function cloud function deployment role description: Role for Dynatrace GCP function cloud function deployment stage: GA includedPermissions: - appengine.applications.get - appengine.applications.create - cloudfunctions.functions.create - cloudfunctions.functions.get - cloudfunctions.functions.list - cloudfunctions.functions.sourceCodeSet - cloudfunctions.functions.update - cloudfunctions.functions.getIamPolicy - cloudfunctions.operations.get - cloudfunctions.operations.list - cloudscheduler.locations.list - cloudscheduler.jobs.list - cloudscheduler.jobs.create - cloudscheduler.jobs.get - cloudscheduler.jobs.delete - pubsub.topics.list - pubsub.topics.create - pubsub.topics.update - secretmanager.secrets.list - secretmanager.versions.add - secretmanager.secrets.create - secretmanager.versions.list - secretmanager.secrets.getIamPolicy - secretmanager.secrets.setIamPolicy - resourcemanager.projects.get - resourcemanager.projects.getIamPolicy - resourcemanager.projects.setIamPolicy - serviceusage.services.enable - iam.serviceAccounts.actAs - iam.serviceAccounts.list - iam.serviceAccounts.create - iam.serviceAccounts.getIamPolicy - iam.serviceAccounts.setIamPolicy - iam.roles.list - iam.roles.create - iam.roles.update - monitoring.dashboards.list - monitoring.dashboards.create
Run the command below, replacing
<your_project_ID>with the project ID where you want to deploy the Dynatrace integration.bash
gcloud iam roles create dynatrace_function.cloud_function_deployment --project=<your_project_ID> --file=dynatrace-gcp-function-cloud-function-deployment-role.yaml
Note: Be sure to add this role to your GCP user. For details, see Grant or revoke a single role.
- API v1:
- Read configuration
- Write configuration
- API v2:
- Ingest metrics
- Read extensions
- Write extensions
- Read extensions monitoring configuration
- Write extensions monitoring configuration
- Read extensions environment configuration
- Write extensions environment configuration
Determine the URL for your environment.
- For Dynatrace SaaS:
- For Dynatrace Managed:
Note: To determine
<your-environment-id>, see environment ID.
You can deploy the Dynatrace GCP integration in Google Cloud Shell or in bash. To set up integration, follow the instructions below.
Note: For bash deployment, be sure to restart the console and initialize Cloud SDK before you start installation. To initialize Cloud SDK, run
1. Download the deployment package
wget -q "https://github.com/dynatrace-oss/dynatrace-gcp-function/releases/latest/download/function-deployment-package.zip" -O function-deployment-package.zip; unzip function-deployment-package.zip; chmod a+x *.sh
2. Configure deployment
Adjust the parameters in the
activation-config.yamlfile from the deployment package.
Choose which services you want Dynatrace to monitor.
By default, the GCP integration starts monitoring a series of selected services. Uncomment any additional services you want Dynatrace to monitor in the
Note: For DDU consumption information, see Monitoring consumption.
3. Run the deployment script
Note: The integration in GCP Cloud Function uses Cloud Scheduler, which requires the App Engine application. If you don't have App Engine installed, the installer script will prompt you to create App Engine and select the region where you want the installer script to run.
The installation script will interactively prompt for additional parameters:
- GCP project ID - The ID of the Google Cloud project where you want to deploy the Dynatrace GCP Function. The default is set to the current project ID, for the gcloud CLI.
- Function size - The amount of memory that you want to allocate to the GCP Function. You can select one of the following:
[s]- Small (allocates 256 MB memory to the function). Select this option if you have up to 500 GCP service instances.
[m]- Medium (allocates 512 MB memory to the function). Select this option if you have up to 1,000 GCP service instances.
[l]- Large (allocates 2,048 MB memory to the function). Select this option if you have up to 5,000 GCP service instances.
Note: You can adjust the amount of memory after installation.
- Dynatrace tenant URI - Your Dynatrace environment URL. See Prerequisites for details.
- Dynatrace API token - Your Dynatrace API token. See Prerequisites for details.
Run the deployment script.
After deploying the integration, you can see metrics from monitored services. If you want to add services to monitoring, see Change deployment settings below.
To check whether installation was successful
- In your Google Cloud console, go to Cloud Functions and make sure that
- Select the newly deployed GCP Function and go to Logs to make sure there are no error messages.
To activate alerting, you need to enable custom events for alerting in Dynatrace.
To enable custom events
- In the Dynatrace menu, go to Settings.
- In Anomaly detection, select Custom events for alerting.
- Filter for GCP alerts and turn on On/Off for the alerts you want to activate.
View enabled services
To find the list of currently enabled services, go to Cloud Function in your GCP console, and check the
ACTIVATION_CONFIG environment variable.
Change deployment settings
To add or remove services, or to update parameters, you need to redeploy the integration.
- Apply your changes to
Note: Be sure to use the same value for the
FUNCTION_NAME parameter as before.
To investigate potential deployment and connectivity issues
All cloud services consume DDUs. The amount of DDU consumption per service instance depends on the number of monitored metrics and their dimensions (each metric dimension results in the ingestion of 1 data point; 1 data point consumes 0.001 DDUs). For details, see Extending Dynatrace (Davis data units).