Application observability via container build-time injection
Inject OneAgent code modules into a container during its build process.
This method of application instrumentation has limitations in linking Kubernetes workloads with monitored containers/processes. To achieve proper relationships and linking, consider using automatic application-only injection.
<technology>—OneAgent code module required for your application. Available options are all, java, apache, nginx, nodejs, dotnet, php, go, and sdk. You can specify several code modules, separated by hyphen (-), for example java-go. Including specific technology-support options, rather than support for all technology options, results in a smaller OneAgent package.
Dynatrace OneAgent supports Alpine Linux based environments.
Valid options here are: all, dotnet, php, java, apache, nginx, nodejs, and go.
Build your application image.
Build the Docker image from your Dockerfile to use it in your Kubernetes environment.
docker build -t yourapp .
You can monitor your application containers with a different Dynatrace environment.
For OneAgent version 1.139+, if you have an existing application image where you've already added the OneAgent code modules for a specific Dynatrace environment, you can have the OneAgent report to another Dynatrace environment without rebuilding your application image.
For this, you need to make a call to the REST endpoint of your second Dynatrace environment. Don't forget to adapt the respective placeholders <environmentID> and <token>.
In return, you get a JSON object that covers the required information that needs to be passed as an environment variable to the application container.
Make sure you set the environment variables of the application container as described below:
DT_TENANT: equals tenantUUID
DT_TENANTTOKEN: equals tenantToken
DT_CONNECTION_POINT: semi-colon separated list of communicationEndpoints
optional Configure network zones
You can configure network zones as an environment variable:
In case you run an environment with proxy, you need to set the DT_PROXY environment variable in the application container to pass the proxy credentials to OneAgent.
For Alpine Linux-based containers, you might need to update the wget shipped with the Alpine image to allow for proxy authentication for the download of OneAgent.
Define variables with optional default values using ARG instructions, as shown below.
You can override the default values within the OpenShift BuildConfig. Replace <environmentID> with your Dynatrace environment ID. If you’re using Dynatrace Managed, you need to provide your Dynatrace Server URL (https://<YourDynatraceServerURL>/e/<environmentID>/api). Replace <token> with the PaaS token mentioned above.
Technology support is enabled via include parameters. Valid options for flavor=default are all, java, apache, nginx, nodejs, dotnet, php, go, and sdk. Including specific technology-support options, rather than support for all technology options, results in a smaller OneAgent package.
OneAgent supports the flavor musl for Alpine Linux based environments. Valid options for flavor=musl are all, java, apache, nginx, and nodejs.
Add the following commands to your current Dockerfile to integrate OneAgent and activate instrumentation of your application.
You can monitor your application containers with a different Dynatrace environment.
For OneAgent version 1.139+, if you have an existing application image where you've already added the OneAgent code modules for a specific Dynatrace environment, you can have the OneAgent report to another Dynatrace environment without rebuilding your application image.
For this, you need to make a call to the REST endpoint of your second Dynatrace environment. Don't forget to adapt the respective placeholders <environmentID> and <token>.
In return, you get a JSON object that covers the required information that needs to be passed as an environment variable to the application container.
Make sure you set the environment variables of the application container as described below:
DT_TENANT: equals tenantUUID
DT_TENANTTOKEN: equals tenantToken
DT_CONNECTION_POINT: semi-colon separated list of communicationEndpoints
optional Configure network zones
You can configure network zones as an environment variable:
In case you run an environment with proxy, you need to set the DT_PROXY environment variable in the application container to pass the proxy credentials to OneAgent.
For Alpine Linux-based containers, you might need to update the wget shipped with the Alpine image to allow for proxy authentication for the download of OneAgent.
Set the following build-time variables:
$DT_API_URL (The API URL of your Dynatrace environment)
$DT_PAAS_TOKEN (The PaaS token to download the code modules)
$DT_ONEAGENT_TECHNOLOGY (The module that is downloaded, for example php)