Hello,
I am creating a load test script with Grafana k6. This script will run on CLI. I am trying add tags to my custom counter, but the tags do not seem to be added to the counter.
Here is a minimal working example:
import http from 'k6/http';
import {Counter} from 'k6/metrics';
let myCounter = new Counter('custom_counter');
export default function () {
let res = http.get('https://test.k6.io');
myCounter.add(1, {tag1: 'value1'});
myCounter.add(1, {tag1: 'value2'});
}
export function handleSummary(data) {
console.log(JSON.stringify(data.metrics.custom_counter));
}
When running via:
k6 run --summary-trend-stats "min,avg,med,p(95),p(99),p(99.99),max" k6/mwe.js
I get this output (before the general summary):
INFO[0000] {"type":"counter","contains":"default","values":{"count":2,"rate":6.073655216814307}} source=console
What I would expect here is a something like a tags
key with the value for each tag, or tag combination. How can I achieve this?
Thank you.