Deploy OneAgent for Google App Engine apps

Google App Engine is a managed application platform that supports most modern languages. The Google App Engine "standard environment" type supports applications that run on Java, .NET, Node.js, Golang, and more. For custom Docker images, Google App Engine provides "flexible environment" support, so you can run custom Docker images in flexible environment mode.

Before you begin

You'll need to

Generate PaaS token

The first step is to get your environment ID and PaaS token for your Dynatrace environment.

Integrate OneAgent into application images

To integrate OneAgent into a container deployment with a Dockerfile in Google App Engine flexible environment and activate instrumentation of your application, add the following commands to your current Dockerfile.

ARG DT_API_URL="https://<environmentID>"
ARG DT_API_TOKEN="<token>"
ARG DT_ONEAGENT_OPTIONS="flavor=default&include=<technology1>&include=<technology2>"
ENV DT_HOME="/opt/dynatrace/oneagent"
RUN mkdir -p "$DT_HOME" && \
    wget -O "$DT_HOME/" "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_API_TOKEN&$DT_ONEAGENT_OPTIONS" && \
    unzip -d "$DT_HOME" "$DT_HOME/" && \
    rm "$DT_HOME/"
ENTRYPOINT [ "/opt/dynatrace/oneagent/" ]
CMD [ "executable", "param1", "param2" ] # the command of your application, e.g. java

Note: The commands above that use wget and unzip may fail if they aren't provided by the base image.

Regarding the code snippet above:

  • As it is shown in the code snippet, first, you need to define variables with default values using ARG instructions.

  • Technology support is enabled via include parameters. Valid options for flavor=default are all, java, apache, nginx, nodejs, dotnet, php and go. Including specific technology-support options, rather than support for all technology options, results in a smaller OneAgent package.

  • <environmentID> should be replaced with your Dynatrace environment ID. If you’re using Dynatrace Managed, you need to provide your Dynatrace Server URL (https://<YourDynatraceServerURL>/e/<environmentID>/api).

  • <token>should be replaced with the PaaS token mentioned above.

Deploy the application image

After integrating the OneAgent to the application's Dockerfile you will need to deploy the application, e.g., with the gcloud cli. For this switch to the app's directory that contains the Dockerfile and the app.yaml file, and run the following command.

$ gcloud app deploy

Google App Engine will take care of building the Docker image based on the Dockerfile provided and thereby of downloading and installing the OneAgent code-modules into the application image.