$ pwd
/home/test/
Step 1) I started the datadog docker agent with the below Linux command:
$ docker run --name datadog -e DD_LOGS_ENABLED=true -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true -e
DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true -e DD_SITE=“datadoghq.com” -e DOCKER_CONTENT_TRUST=1
-e DD_API_KEY=<DD_API_KEY> -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1 -p 8125:8125/udp datadog/agent:latest
$ docker ps
CONTAINER ID IMAGE STATUS PORTS NAMES
58afc8d90e04 datadog/agent:latest Up 21 minutes (healthy) 0.0.0.0:8125->8125/udp, :::8125->8125/udp, 8126/tcp datadog
Step 2) However I ran the sample k6 script after k6 login cloud,
$ k6 run --out statsd samplescript.js
in standalone it captured metrics properly in the default datadog dashboard and k6 run successfully.
Step3) But when I ran the docker k6 container using the below command, even after linking K6 CONTAINER with datadog/agent
it throws below error and none of the metrics are captured in datadog but K6 ran successfully.
$ docker run -i -e “K6_DATADOG_ADDR=datadog:8125” --link datadog:datadog -e K6_CLOUD_TOKEN=<K6_CLOUD_TOKEN_AFTERLOGIN>
-v /home/test/:/test -i loadimpact/k6 run --out statsd --out cloud /test/samplescript.js
time=“2021-06-29T12:29:15Z” level=warning msg=“Couldn’t send 70266 out of 1476642 metrics. Enable debug logging to see individual errors” output=statsd
time=“2021-06-29T12:29:15Z” level=error msg=“Couldn’t flush a batch” error=“write udp 127.0.0.1:53950->127.0.0.1:8125: write: connection refused” output=statsd
time=“2021-06-29T12:29:15Z” level=warning msg=“Couldn’t send 921 out of 19366 metrics. Enable debug logging to see individual errors” output=statsd
How to fix 1)the above connection refused error and 2)the location to check logs and 3)enable debugging?