Broken metrics order in HTML report
Gim6626 opened this issue · comments
Dmitrii Vinokurov commented
I've found that custom metrics printing order in report is broken. See screnshots from HTML report and test report below. max
is less than min
:) And other metrics are messed too.
Here is minimized code which reproduces this:
import http from 'k6/http';
import {Trend} from 'k6/metrics';
import {htmlReport} from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
import {textSummary} from "https://jslib.k6.io/k6-summary/0.0.1/index.js";
const url = 'https://test.k6.io/';
let durationTrend = new Trend('requests duration');
export let options = {
scenarios: {
example_scenario_public: {
executor: 'constant-arrival-rate',
maxVUs: 30,
preAllocatedVUs: 30,
rate: 10,
timeUnit: '1s',
duration: `10s`,
gracefulStop: `2s`,
exec: 'example_scenario',
},
},
summaryTrendStats: [
'min',
'avg',
'med',
'max',
'p(90)',
'p(95)',
'p(99)', // By default 99-percentile is not printed, so we explicitly say to k6 what we need to be printed and 99-percentile among these
],
thresholds: {
'requests duration{type:a}': [
'p(95) < 200',
'p(99) < 400',
],
'requests duration{type:b}': [
'p(95) < 250',
'p(99) < 450',
],
},
};
export function example_scenario() {
let response = http.get(url, {tags: {type: 'a'}});
durationTrend.add(response.timings.duration, {type: 'a'});
response = http.get(url, {tags: {type: 'b'}});
durationTrend.add(response.timings.duration, {type: 'b'});
}
export function handleSummary(data) {
return {
"summary.html": htmlReport(data),
stdout: textSummary(data, { indent: " ", enableColors: true }),
};
}
Ben Coleman commented
Yeah these were HORRIBLY broken!
Fixed in version 2.3.0 I just pushed