locust_exporter icon indicating copy to clipboard operation
locust_exporter copied to clipboard

Fix "locust_slave_count" query

Open manthang opened this issue 5 years ago • 0 comments

Here is an example of response in json format when querying the locust (version 0.11.0) HTTP endpoint (/stats/requests):

....
"slaves": [
    {
      "id": "ip-10-30-41-5_c934ac121c8044829aea4617657920e9", 
      "state": "running", 
      "user_count": 25
    }, 
    {
      "id": "ip-10-30-41-140_de51336098954e1dbb197b3d0249109d", 
      "state": "running", 
      "user_count": 25
    }
  ],
....

So, we need to change the way to count the length of "slaves" list correctly.

len(response['slaves'])

Test passed well.

Please kindly review and merge this PR when you have free time. Thanks!

manthang avatar Aug 15 '19 10:08 manthang