Hey I was using k6 for distributed load testing within my cluster and want to output the results to Datadog. I already have the datadog documentation with me but I am unable to send the metrics.
Here is what my Dockerfile looks->
# This Dockerfile is used to create a Docker image containing your customized k6 binary.
#
# Once built, publish the resulting image to your publicly accessible container registry, e.g. https://hub.docker.com/.
# The published image will then be used to create your container(s) within the Kubernetes cluster.
#
# Stage 1: Setup Go environment and build custom k6 from sources using xk6 (https://github.com/grafana/xk6)
FROM golang:1.21-alpine AS builder
WORKDIR $GOPATH/src/go.k6.io/k6
ADD . .
RUN apk --no-cache add git
RUN CGO_ENABLED=0 go install go.k6.io/xk6/cmd/xk6@latest
RUN CGO_ENABLED=0 xk6 build latest \
# --with github.com/grafana/xk6-output-influxdb=${PWD}/dependencies/xk6-output-influxdb \
# --with github.com/grafana/xk6-output-kafka=${PWD}/dependencies/xk6-output-kafka \
--with github.com/LeonAdato/xk6-output-statsd=${PWD}/dependencies/xk6-output-datadog \
--output /tmp/k6
# Stage 2: Create lightweight runtime environment for the custom k6 binary with browser support
FROM alpine:3.19
RUN apk add --no-cache ca-certificates chromium-swiftshader \
&& adduser -D -u 12345 -g 12345 k6
COPY --from=builder /tmp/k6 /usr/bin/k6
ENV CHROME_BIN=/usr/bin/chromium-browser
ENV CHROME_PATH=/usr/lib/chromium/
ENV K6_BROWSER_HEADLESS=true
USER 12345
WORKDIR /usr/bin
ENTRYPOINT ["k6"]
Sharing my Yaml as well
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: k6-output-datadog
spec:
parallelism: 4
script:
configMap:
name: test-scripts
file: door-buster-sale.js
arguments: --tag testid=k6-output-datadog
runner:
image: vanshulsuneja98415/k6-demo-image-datadog:datadog
env:
- name: K6_OUT
value: statsd
- name: K6_STATSD_ENABLE_TAGS
value: "true"
- name: STATSD_HOST
value: datadog-agent # Replace with the Datadog agent service name in your cluster
- name: STATSD_PORT
value: "8125"
I have the DD agent running in my cluster. The error which I am getting is
error msg="could not create the 'statsd' output: the statsd output was deprecated in k6 v0.47.0 and removed in k6 v0.55.0, please use the new xk6 statsd output extension instead. It can be found at https://github.com/LeonAdato/xk6-output-statsd and more info at https://github.com/grafana/k6/issues/2982"
Even though I have used the xk6 extension to build my docker file it isn’t showing when I am running the testrun.
further to debug I used to shell inside container
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock --entrypoint /bin/sh 12eed6b5e443
/usr/bin $ which k6
/usr/bin/k6
/usr/bin $ k6 version
k6 v0.56.0 (go1.21.13, linux/arm64)
Extensions:
GitHub - LeonAdato/xk6-output-statsd: k6 extension to output real-time test metrics using StatsD. (devel), output-statsd [output]
But still I am unable to get the output to datadog, somehow it’s not recognizing my image with the extension.
Can anyone help, stuck on this for a few days now