Some metrics are failed to send to DataDog agent

Hello,
We run K6 via AWS Batch and DataDog agent is installed in the EC2 instance.
But some metrics are failed to send from container to DataDog agent.

level=debug msg=“Error while sending metric checks” error=“write udp 127.0.0.1:48615->127.0.0.1:8125: write: connection refused” output=statsd
level=warning msg=“Couldn’t send 7 out of 77 metrics. Enable verbose logging with --verbose to see individual errors” output=statsd

Our K6 version is v0.41.0.

Do you have any idea/solutions to solve this? Thank you in advance!

Hi there, welcome to the forum :slight_smile:

Well, what is the output when you enable --verbose? Do you see any errors that could explain it?

It might be that the amount of metrics sent by k6 overloads the Datadog Agent instance. You can try passing DD_LOGS_ENABLED=true in the docker run command, and checking if you see any relevant information. See their documentation.

You could also try experimenting with the values of K6_STATSD_PUSH_INTERVAL and K6_STATSD_BUFFER_SIZE to see if increasing or decreasing this improves the performance. See the statsd output documentation.

1 Like

Thanks @imiric . When I change the value of K6_STATSD_PUSH_INTERVAL to 5, the errors are gone.
I am wondering whether the default value(1s) is a proper value.

When I change the value of K6_STATSD_PUSH_INTERVAL to 5, the errors are gone.

Good to know :+1:

I am wondering whether the default value(1s) is a proper value.

We try to set some sane defaults, but the most appropriate values will depend on each environment (hardware resources: CPU/RAM, network, etc.), which is why these are configurable. You can always export the value that works best for you, to make sure it’s always set when you run this test.