Hi @oleiade ,
Thank you for the quick response!
I use k6 v0.37.0 and InfluxDB v2.1.1-alpine.
I feed the data with the xk6-influxdb extension into the database. Because of that I use an custom image, which I build with k6 and xk6.
The whole setup runs in an kubernetes-cluster. The k6 clients and the InfluxDB are running in the same cluster, my test-target in another one.
My config-yaml looks like this:
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-sample
spec:
parallelism: 1
script:
configMap:
name: example-test
file: example-test.js
separate: false
arguments: --out xk6-influxdb=http://xxxxx
#--no-summary --no-thresholds
runner:
image: xxmariusb21xx/k6-influxdb:ext
env:
- name: K6_INFLUXDB_ORGANIZATION
value: "xxxx"
- name: K6_INFLUXDB_BUCKET
value: "xxxxx"
- name: K6_INFLUXDB_TOKEN
value: 'xxxxx'
My test-script like this:
import http from 'k6/http';
import { sleep } from 'k6';
import {
randomIntBetween,
randomString,
randomItem,
uuidv4,
findBetween,
} from 'https://jslib.k6.io/k6-utils/1.3.0/index.js';
var x=0; //Variable to set range for random function
var s=0.1; //sleep Time in s
var p=1; //Parallelism in int
var v=10; //VU's in int
var value=0; //Random value for writing in the sm-element
export const options = {
"duration": "1m",
"vus": v,
insecureSkipTLSVerify: true,
discardResponseBodies: true,
tags: {
HWconfig: 'xxxxx',
Test: 'xxxxxx',
Read: 'false',
Random: 'true',
VUs: ''+v,
Sleep: ''+s,
Parallelism: ''+p,
Separate: 'false',
},
};
export default function () {
x = randomIntBetween(1, 4000);
value = randomIntBetween(-2147483648, 2147483647);
const headers = { 'Content-Type': 'application/json' };
var url = ('xxxxxxxxx');
var data = value;
const res = http.put(url, JSON.stringify(data), { headers: headers });
sleep(s);
}
And as you can see I define the tags in the test-script. I use the tags to filter my test results in Grafana (which also runs in Kubernetes with K6 and the InfluxDB). For example I have got an diagram for writing tests and another one for reading-tests.
As I said that worked fine until now. The tests itself working fine, no errors or missing data, the only thing which is missing are the tags for the datapoints.