Logging is here!

Tracing Docker Applications

Enable the datadog-trace-agent in the docker-dd-agent container by passing DD_APM_ENABLED=true as an environment variable.

Note: APM is NOT available on Alpine Images

For additional information, see the Datadog docker Github repository

Tracing from the host

Tracing can be available on port 8126/tcp from anywhere by adding the options -p 8126:8126/tcp to the docker run command

To make it available from your host only, use -p instead.

For example, the following command allows the agent to receive traces from anywhere

docker run -d --name dd-agent \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v /proc/:/host/proc/:ro \
  -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
  -e API_KEY={your_api_key_here} \
  -e DD_APM_ENABLED=true \
  -p 8126:8126/tcp \

Previous instructions required binding to port 7777. This is a legacy port used by former client libraries and has been replaced by 8126.

Tracing from other containers

As with DogStatsD, traces can be submitted to the agent from other containers either using the Docker host IP or with Docker links

docker run  --name my_container           \
            --all_your_flags              \
            --link dd-agent:dd-agent    \

It expose DD_AGENT_PORT_8126_TCP_ADDR and DD_AGENT_PORT_8126_TCP_PORT as environment variables. Your application tracer can be configured to submit to this address.

An example in Python:

import os
from ddtrace import tracer

Using Docker host IP

Agent container port 8126 should be linked to the host directly. Having determined the address of the default route of this container, with ip route for example, you can configure your application tracer to report to it.

An example in python, assuming is the default route:

from ddtrace import tracer; tracer.configure(hostname="", port=8126)