No results for ""

Powered byAlgolia

Datadog

You can also store your k6 metrics into the Datadog platform.

According to Datadog: "The easiest way to get your custom application metrics into Datadog is to send them to DogStatsD". You can run the service as a Docker container with a command like:

DOCKER_CONTENT_TRUST=1 \
docker run -d \
    --name datadog \
    -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.com" \
    -e DD_API_KEY=<YOUR_DATADOG_API_KEY> \
    -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1 \
    -p 8125:8125/udp \
    datadog/agent:latest

Remember to replace <YOUR_DATADOG_API_KEY> with your actual Datadog API key. Also note that if your account is registered with Datadog EU, the value of DD_SITE should be datadoghq.eu.

See the documentation for additional details.

Once you have the DogStatsD service running, you can run your load test and push the metrics with:

k6 run --out datadog script.js

The Datadog plugin works like the StatsD plugin, but Datadog has a concept of metric tags, the key-value metadata pairs that will allow you to distinguish between requests for different URLs, response statuses, different groups, etc. These options can be configured:

Name Value
K6_DATADOG_ADDR Address of the DogsStatsD service, currently only UDP is supported. The default value is localhost:8125.
K6_DATADOG_NAMESPACE The namespace used as a prefix for all the metric names. The default value is k6.
K6_DATADOG_PUSH_INTEVAL Configure how often data batches are sent. The default value is 1s.
K6_DATADOG_BUFFER_SIZE The buffer size. The default value is 20.
K6_DATADOG_TAG_BLACKLIST This is a comma-separated list of tags that should NOT be sent to Datadog. All other metric tags that k6 emits will be sent. The default value is empty.

For an expanded tutorial, check out the blog post: "How to send k6 metrics to Datadog".