Could anybody please tell me how to send test metrics to a prometheus remote write about each request made, or just every second? So, I ran the test from the demo script for 30 secs, it produces 23 requests, but in the prometheus chart I see only 4 dots:
And here is the cli output:
But I want to get something like this:
I found a way how to export per-request metrics to a csv file, it just works by default using
k6 run -o csv --duration 30s ./script.js:
But how to do this for prometheus, or, at least, for json?
Thanks for the ideas!
I already tried this but it just increases the sampling time from 5s to 1s, but still sends the aggregated data, so if in the one second, there were 7 requests, I will see only the average value.
If you want to export metrics to json, then you can use
I tried this too, but in the resulting json file I see only the summary data, not per-request data, like in CSV.
So, the only way for now, that I found, is to parse the CSV (it’s not easy, cuz we should filter not only columns but also rows).
And, also, do the desired output programmatically in js, like this:
console.log('\t' + i + '\t' + res.timings.waiting + '\t' + res.timings.duration);
and copy-paste it into Excel.
But I want to have fewer crutches, ideally - something out of the box!
In the json output: “* type - can have the values Metric or Point where Metric means the line is declaring a metric, and Point is an actual data point (sample) for a metric.”
And I have another idea. You can write a custom ouput extension , or you can write a custom output plugin for the xk6-output-plugin where you can get all the sample point metrics.