How to extract the steady state test results via CLI

I want to extract the results only for the steady state duration.

For example: I am gonna run a test with below settings.

  • Ramp up - 10minutes
  • Test Duration - 1 hour
  • Ramp down - 10 minutes

Total duration will be - 1 hour and 20 minutes

I see, k6 provides an external outputs command to export the raw data into a CSV file using ‘k6 run --out csv’, how do I get only steady state duration without rampup and rampdown period?

Thanks in advance.

Hello @jabastin.patturaja,

unfortunately, k6 doesn’t support natively this use case yet. We have an open issue tracking it: Tag metrics from different stages · Issue #796 · grafana/k6 · GitHub.

In the meanwhile, you could use some workarounds:

  • Filtering the text output by timestamp: you could filtering textual outputs by timestamp excluding the ramp-up and ramp-down stages using a stream editor tool (e.g. grep, sed or jq for json).
  • Query from a data visualization tool: you could use Grafana to query a datasource where you exported your metrics.
  • Script using different scenarios: coding a script using different scenarios for your different stages. You can have 3 scenarios with a stage each, via the startTime scenario option (e.g. set gracefulStop to 0 for all scenarios and the startTime of the second scenario to 10m then the third to 1h10m) - then metrics from the different scenarios will be tagged appropriately.