In my Github Actions workflow I am running a k6 script that’s supposed to write metrics to Datadog. However I am getting the error
level=error msg="Couldn't flush a batch" error="write udp 127.0.0.1:33547->127.0.0.1:8125: write: connection refused"
This is the step in my workflow, it first runs the datadog/agent
Docker container exposing port 8125/udp
to which k6 then tries to send the metrics to:
- name: Run k6 script
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
run: |
DOCKER_CONTENT_TRUST=1
docker run -d
--name datadog-k6
-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 DD_SITE="datadoghq.eu"
-e DD_API_KEY=${{ secrets.DD_API_KEY }}
-e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1
-e DD_TAGS="env:development version:foo"
-p 8125:8125/udp
datadog/agent:latest
k6 run ./k6/test.js
-e K6_STATSD_ENABLE_TAGS=true
-e K6_STATSD_ADDR="0.0.0.0:8125"
-o statsd
--verbose
docker stop datadog-k6
docker rm datadog-k6
I am using a self-hosted runner on Github Actions so it might be a docker-inside-docker issue?
I noticed that the statsd
output option is deprecated but I am expecting it to still work
Would it work to send the k6 metrics via HTTP to datadog and does someone have an example for that?
Thanks!