that feature isn’t publicly released yet, though it will be part of the upcoming v0.26.0 release, planned for this week. Keep a lookout at the releases page, though in the meantime you can compile and use k6 master, where this should work.
Also, you’ve tried to define the summaryTrendStats option inside of thresholds, but it is a global option. Here’s a complete script that demonstrates it:
import http from "k6/http";
import { Trend } from "k6/metrics";
const totalDuration = new Trend("total_duration", true);
export let options = {
iterations: 5,
summaryTrendStats: ["min", "max", "avg", "p(90)", "p(95)", "p(99)", "count"],
};
export default function () {
let responses = http.batch([
["GET", "https://test.loadimpact.com/"],
["GET", "https://test.loadimpact.com/style.css"],
["GET", "https://test.loadimpact.com/images/logo.png"]
]);
totalDuration.add(responses.reduce((acc, resp) => acc + resp.timings.duration, 0));
}
With the latest k6 master (either compiled yourself, or using the Docker master image tag), you’d get something like this:
thanks @imiric. I will take note release note in future.
@neillb
I have encountered error below:-
ERRO[0001] TypeError: Object has no member ‘reduce’
is this option available at the latest build v0.25.1?
My mistake, i just realised v0.26.0 is available to use now. The code is working perfectly fine.
However, do you have any example of just with http.get/http.post?
One more question, possible to configure the count only store the HTTP200 response time / pass through the check() function.
Or even position to track the number of pass count / number of fail count?
One more question, possible to configure the count only store the HTTP200 response time / pass through the check() function.
Or even position to track the number of pass count / number of fail count?
I’m still not sure I fully understand your question, but you should be able to achieve what you want with a combination of custom Trend (Trend) and Count (Counter) metrics and if statements based on the response.status value (Response), right?