This solution uses a sidecar container and Application Settings for Linux Azure App Service to instrument the application and manage its configuration.
Place the tracing library inside your project. It must be included with your deployment.
If you are using the azure-webapp-maven plugin, you can add the Java tracing library as a resource entry with type lib.
Set the environment variable JAVA_OPTS with --javaagent:/home/site/lib/dd-java-agent.jar. When your application is deployed, the Java tracer is copied to /home/site/lib/dd-java-agent.jar.
Instrumentation starts when the application is launched.
Add the ddtrace package to your project using your package manager.
Initialize the tracer by doing one of the following:
Set NODE_OPTIONS with --require=dd-trace/init
Include the tracer in your application’s entrypoint file:
Run the following script to install Datadog’s PHP tracing library:
#!/usr/bin/env bash
echo"Setting up Datadog tracing for PHP"DD_PHP_TRACER_VERSION=1.8.3
DD_PHP_TRACER_URL=https://github.com/DataDog/dd-trace-php/releases/download/${DD_PHP_TRACER_VERSION}/datadog-setup.php
echo"Installing PHP tracer from ${DD_PHP_TRACER_URL}"if curl -LO --fail "${DD_PHP_TRACER_URL}";theneval"php datadog-setup.php --php-bin=all"elseecho"Downloading the tracer was unsuccessful"returnficp /home/site/wwwroot/default /etc/nginx/sites-available/default && service nginx reload
This script is intended to run as the startup command, which installs the tracing module into PHP and then restarts the application.
Add ddtrace to your project.
Modify your startup command. Your new command should run ddtrace-run with your old command as an argument. That is: if your startup command is foo, modify it to run ddtrace-run foo.
Set your Datadog site to . Defaults to datadoghq.com.
Additional flags, like --service and --env, can be used to set the service and environment tags. For a full list of options, run datadog-ci aas instrument --help.
Configure environment variables.
In Azure, add the following key-value pairs in Settings > Configuration > Application settings:
If you are not receiving traces or custom metric data as expected, enable agent debug logging by setting DD_LOG_LEVEL in the sidecar configuration options. For tracer debugging set DD_TRACE_DEBUG to true. This generates logs additional debug logs for the sidecar and tracing library.
Be sure to enable App Service logs to receive debugging logs.