Add 99, 99.5 percentile stats to built-in HTTP trend metrics

Hi, Can I add/remove statistics (for example add 99, 99.9 percentiles and remove min, max) to the built-in HTTP Trend metrics (for example http_req_duration) which I eventually want to push in the influxdb and see in the grafana dashboard?


k6 doesn’t send 99 percentile or min/max to influxdb or … anywhere really. It only sends values (+ timestamps, tags and other data to distinguish between data points).

The calculation of percentiles, min, max and so on in k6 is for the summary on the end and (more importantly) thresholds.
Grafana through influxdb has ways to than calculate min, max, percentiles and others from that data.

If what you want is to add additional metrics you can use custom metrics.

Thanks @mstoykov, is there a way to customize built-in metrics (for example http_req_duration) to show additional percentile i.e. 99th and 99.9 in K6 run smmary output.

@vishalcdac07, yes, you can use something like this to specify different summary trend statistics: k6 run --summary-trend-stats="min,med,avg,max,p(99),p(99.9),p(99.99)" script.js

You can also specify the same option via the K6_SUMMARY_TREND_STATS environment variable or via the summaryTrendStats exported script option, like this:

import http from 'k6/http';
import { sleep } from "k6";

export let options = {
    summaryTrendStats: ["med", "p(99)", "p(99.50)"],

export default function () {

Is there a way for these to be exported in --summary-export ? From my testing, only default trend stats are exported whatever specified with --summary-trend-stats. I am using k6 v0.27.1

@phramusca, unfortunately that’s a know bug in k6, follow Summary report in json format is missing fields defined in summaryTrendStats · Issue #1611 · grafana/k6 · GitHub for updates

Thanks. I guess I have to wait for 0.30 and find a worakaround meantime