Hi Team,
On K6 Is there any configuration or option to store all the result data save along with run ID or something on InfluxDB or any other DBs’.
Hi Team,
On K6 Is there any configuration or option to store all the result data save along with run ID or something on InfluxDB or any other DBs’.
Hi @Gerard,
Let me try to help you!
The k6 has different external outputs and for sure InfluxDB. From the box, k6 currently supports InfluxDB v1. If you need the support of version 2, then there is an xk6 extension GitHub - grafana/xk6-output-influxdb: k6 extension to output real-time test metrics to an InfluxDB 2.x database..
There is no conception of the run ID inside the k6 (it exits in the k6 cloud). But it’s not a big deal to externally manage it with a workaround of passing something (e.g., UUID) as an environment variable and use test wide tags.
For example, using the docker-compose from the repo above. And slightly modify the script http_2.js like:
import http from "k6/http";
import { check } from "k6";
export const options = {
tags: {
RunID: __ENV.RUN_ID,
},
};
export default function () {
console.log(__ENV.RUN_ID)
check(http.get("https://test-api.k6.io/"), {
"status is 200": (r) => r.status == 200,
"protocol is HTTP/2": (r) => r.proto == "HTTP/2.0",
});
}
I can run (I’m using Linux, and that defines the way of the getting UUID):
docker-compose run -e RUN_ID=$(cat /proc/sys/kernel/random/uuid) k6 run -<scripts/http_2.js
And in the InfluxDB:
Let me know if that helps,
Cheers