Search code examples
pythonoutputload-testinglocust

Is there a way to add columns to the data outputted to a headless Locust session?


I would like to add a column with a custom metric to the headless output of Locust. Is this possible? I am struggling to see anything in the documentation that points to modifying the output.

Just to be specific, I want to modify this output:

Type     Name                                                                          # reqs      # fails |    Avg     Min     Max    Med |   req/s  failures/s
--------|----------------------------------------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
GET      /version                                                                           3     0(0.00%) |     17      14      22     15 |    0.33        0.00
--------|----------------------------------------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
         Aggregated                                                                         3     0(0.00%) |     17      14      22     15 |    0.33        0.00


Solution

  • No built in way, but if you overwrite locust.stats.get_stats_summary (https://github.com/locustio/locust/blob/0e56a8b5d34bd8cce11983273f561044441d4ac4/locust/stats.py#L797) with your own function you can!