-
Notifications
You must be signed in to change notification settings - Fork 315
Closed
Milestone
Description
While trying to send traces by Unix Domain Socket, I set both environment variables DD_AGENT_HOST and DD_TRACE_AGENT_URL. The documentation for DD_TRACE_AGENT_URL says:
When set this takes precedence over DD_AGENT_HOST and DD_TRACE_AGENT_PORT.
However, the DD_AGENT_HOST environment variable still affects where traces are sent.
How to reproduce
Execute this shell script:
DD_JAVA_AGENT_VERSION=1.34.0
if [ ! -f dd-java-agent.jar ]; then
curl https://repo.maven.apache.org/maven2/com/datadoghq/dd-java-agent/$DD_JAVA_AGENT_VERSION/dd-java-agent-$DD_JAVA_AGENT_VERSION.jar --output dd-java-agent.jar
fi
cat <<EOF >HelloWorld.java
public class HelloWorld {
public static void main(String[] args) throws Exception {
java.util.concurrent.TimeUnit.SECONDS.sleep(1L);
System.out.println("Hello, World!");
}
}
EOF
export DD_AGENT_HOST=should-ignore
export DD_TRACE_AGENT_URL=unix:///var/run/datadog/apm.socket
export DD_TRACE_METHODS='HelloWorld[*]'
java -javaagent:dd-java-agent.jar HelloWorld.javaThe DATADOG TRACER CONFIGURATION output to the console includes:
"agent_url":"http://should-ignore:8126",
"agent_unix_domain_socket":"/var/run/datadog/apm.socket"The console output also includes:
[dd.trace 2024-05-15 15:06:43:904 -0700] [dd-trace-processor] WARN datadog.trace.agent.common.writer.ddagent.DDAgentApi - Error while sending 1 (size=526B) traces. Total: 1, Received: 1, Sent: 0, Failed: 1. java.net.UnknownHostException: should-ignore (Will not log warnings for 5 minutes)
Work around
If I do not set the DD_AGENT_HOST environment variable and set the DD_TRACE_AGENT_URL environment variable, then traces are sent to the intended Unix Domain Socket.