Hey all. I have been using the K6 grafana dashboard created a few years ago by user dcadwallader found here:
Now, this is a good dashboard and saved us a ton of time in setting one up, but one thing that has been bothering me is the “XXX per second” widgets. Both RPS and Checks per second are a misrepresentation as neither actually shows “per second” but rather “per arbitrary time window depending on how narrow your tie range is”.
Initially I just changed these to
GROUP BY time(1s) but the grafana page performance is pretty terrible while attempting to render that.
In the end, a subquery worked:
SELECT mean(rps) FROM (select sum("value") as rps FROM "http_reqs" WHERE $timeFilter GROUP BY time(1s)) WHERE $timeFilter GROUP BY time($__interval) fill(none)
SELECT mean(cps) FROM (select sum("value") as cps FROM "checks" WHERE $timeFilter GROUP BY time(1s)) WHERE $timeFilter GROUP BY time($__interval), "check" fill(none)
If you want to know actual xPS for any time range I suggest these queries. Note, however, that if you use the “total” in the legend, this number won’t be accurate as the total count has been abstracted by averaging these.