I have a per vu iterator and each iterator only runs a single iteration. Now as part of the script each VU triggers a single job at application side and keeps polling it till it’s completed. I have created a custom metric (gauge) to capture that job execution time. I am also adding tags to that custom metric so that I know for which user that value is. Finally I need a summary output for each vu job time along with user details which are added as tags.
E.g.
vu 1 - user 1 - duration 10 min
vu 2 - user 2 - duration 15 min
vu 3 - user 3 - duration 5 min
output should be like:
user 1 - 10 min
user 2 - 15 min
user 3 - 5 min
I was trying to find a simple way to achieve it but could not. Can someone please help with this request. Thanks
Are u flowing the metrics into any db ? It will be easier if u r flowing metrics into influxdb and u can visualise the results in grafana by tags according to ur requirement. In k6 report u will be able only able to see the latest value of gauge which got added in your case it would be the last vuser who has completed the iteration.
I am not pushing to any DB. Adding a DB would be an additional setup which we don’t want to manage. For us 1 vu will only run 1 iteration. For 5 vu, total 5 iterations will be triggered 1 iteration for each. 5 vu’s 5 iteration each vu having only single value. Do you think this is something doable through K6. We ultimately want to push this result to slack.
You can’t reliably build a per-VU “final table” from custom metrics + tags — they are meant for aggregation, not reporting.
Simple fix
Just log the result per VU:
console.log(`user ${user} - ${duration} min`);
Best approach
Store results per VU and print in handleSummary() (or send to an external endpoint if you need structured reporting).
In short: use logs or external storage, not metrics, for this use case.