locustio / locust

Write scalable load tests in plain Python 🚗💨
MIT License
24.64k stars 2.96k forks source link

Would love a swarm_complete event #26

Closed nstielau closed 9 years ago

nstielau commented 12 years ago

Hey,

What I really want is to output a JSON representation of the swarm (and nothing else) to STDOUT upon completion. It doesn't seem like the hooks support this at present. Perhaps a swarm_complete hook could accomplish this.

Thanks! Great stuff!

Jahaja commented 12 years ago

Hi nstielau, Not sure I follow, how would this swarm representation look like?

nstielau commented 12 years ago

Hey,

I want the stats info as JSON. So this final output

INFO:locust.core:All locusts dead

 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
 /news                                                              2     0(0.00%)      45      44      46  |      44    0.00
 /tour                                                              3     0(0.00%)     626      42    1411  |     430    0.10
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              5     0(0.00%)                                       0.10

Percentage of the requests completed within given times
 Name                                                           # reqs    50%    66%    75%    80%    90%    95%    98%    99%   100%
--------------------------------------------------------------------------------------------------------------------------------------------
 /news                                                               2     45     45     45     45     45     45     45     45     46
 /tour                                                               3    430    740    915   1012   1206   1302   1361   1380   1400
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                               5     46    291    430    624   1012   1205   1322   1361   1400

could look something like (ignore the numbers, just the basic idea)

{
  "paths": {
    "/tour": {
      "num_requests": 2,
      "num_fails": 0,
      "avg": 45,
      "min": 44,
      "max": 46,
      "median": 44,
      "rps": 0.00,
      "50_percent_duration": 45,
      "66_percent_duration": 45,
      "75_percent_duration": 45,
      "90_percent_duration": 45,
      "95_percent_duration": 45,
      "98_percent_duration": 45,
      "99_percent_duration": 45,
      "100_percent_duration": 45
    },
    "/news": {
      "num_requests": 3,
      "num_fails": 0,
      "avg": 45,
      "min": 42,
      "max": 626,
      "median": 44,
      "rps": 0.10,
      "50_percent_duration": 145,
      "66_percent_duration": 145,
      "75_percent_duration": 145,
      "90_percent_duration": 145,
      "95_percent_duration": 145,
      "98_percent_duration": 145,
      "99_percent_duration": 145,
      "100_percent_duration": 45
    }
  }
}