Monitor Google Cloud Run managed

Google Cloud Run managed is a compute platform for running containers in a serverless environment. To monitor services running on Google Cloud Run managed using Dynatrace, you need to integrate OneAgent within your containerized application.

Support for Cloud Run managed in the first generation and second generation execution environments is currently limited to Java and Node.js.

Integrate Dynatrace into your containers

There are several ways to build and deploy containers to Cloud Run, such as with Cloud Build.

While the instructions to integrate Dynatrace may differ depending on the technology stack used to build and deploy, the integration of Dynatrace independently follows the same approach:

  1. Add necessary OneAgent binaries to your container image (for example, by either downloading from REST API or copying from the OneAgent image layer).
  2. Configure OneAgent with the necessary connection parameters and additional options such as custom tags.
  3. Enable process injection for automatic instrumentation of your workloads.

Prerequisites

Before you begin, you need to take care of the following:

  • Get an access token to download the Dynatrace OneAgent with InstallerDownload scope. For details on access tokens, see Dynatrace API - Tokens and authentication.

    In the procedures that follow, replace <DT_TOKEN> with your actual access token.

  • Get the environment ID. For details on environment IDs, see What is a monitoring environment?.

    In the procedures that follow, replace <DT_ENV_ID> with your actual environment ID.

  • Get your Dynatrace API endpoint as defined by your Environment URL or alternatively an ActiveGate address.

    In the procedures that follow, replace <DT_ENV_FQDN> with the actual Dynatrace API endpoint.

  • Install gcloud CLI

After you have completed the above prerequisites, follow one of these procedures (select a tab) to integrate Dynatrace into your containers.

Additional configuration

You can use additional environment variables to configure, for example, troubleshooting or advanced networking settings.

Name
Description
Networking
DT_NETWORK_ZONE
Specifies to use a network zone. For details, see Network zones.
DT_PROXY
When using a proxy, use this environment variable to pass proxy credentials. For details, see Set up OneAgent on containers for application-only monitoring
Additional metadata for Process Grouping / Service Detection
DT_LOCALTOVIRTUALHOSTNAME
Multiple containers are sometimes detected as a single instance (localhost), leading to various problems in, for example, service detection or availability alerts. Use this environment variable to define a unique name for your container instance. For details, see Service detection and naming
DT_APPLICATIONID
Some technologies don't provide unique application names. In such cases, use this environment variable to provide a unique name. For details, see Service detection and naming
DT_TAGS
Applies custom tags to your process group
DT_CUSTOM_PROP
Applies custom metadata to your process group
DT_CLUSTER_ID
If the process group detection rules won't work for your use-case, use this environment variable to group all processes with the same value.
DT_NODE_ID
If the process group detection rules won't work for your use-case, use this environment variable to separate process group instances
Troubleshooting
DT_LOGSTREAM
Set this variable with stdout to configure agent to log errors into console. To see additional agent logs set the log level with DT_LOGLEVELCON as below.
DT_LOGLEVELCON
Use this environment variable to define the console log level. Valid options are NONE, INFO, WARNING, SEVERE in order to increase log level.
DT_AGENTACTIVE
true or false to enable or disable OneAgent.

Verify that the integration was successful

After the build and deploy, you should start seeing your Cloud Run service in Dynatrace.

Verify via service overview

Check your service's overview within Dynatrace for your instrumented application.

The service will show up in Dynatrace after running the newly built version and calling it at least once via, for example, a webrequest.

Verify via host overview

You can filter for containers in the host overview to filter by Monitoring Mode with Standalone/PaaS.

Known limitations

  • No host metrics for Gen1

    The first generation of the GCR execution environment, also referred to as Gen1, comes with intentionally increased security limitations. As a consequence, some OneAgent functionalities cannot work in this runtime and are not available. For example, metrics on the Hosts page such as CPU Usage and Memory Usage are not available.

  • GCR instances detected as hosts

    GCR execution environments are currently displayed on the Hosts page, with proper detection of GCP properties and the memory limit of each of these runtime (container) instances, not on the Container groups page. Container metrics are not available.

  • Possible startup overhead

    Because each revision of Google Cloud Run scales automatically to the number of container instances needed to handle incoming requests, such cold starts might appear more often than on other environments, thus increasing overall startup overhead.

Update OneAgent

Each time you want to leverage a new version of Dynatrace OneAgent, you must rebuild and redeploy.

If you've specified a default OneAgent installation version for new hosts and applications using OneAgent update settings, your application will be automatically monitored by the defined default version of OneAgent.

Uninstall OneAgent

To uninstall OneAgent from application-only monitoring, remove references from your application or Docker image and redeploy the application.