Locust: Option to ignore query parameters on stats

Created on 12 Jul 2012  Â·  2Comments  Â·  Source: locustio/locust

My load tests must include many query parameters that are close to random.

I changed the methods on_request_success and on_request_failure to use RequestStats.get(method, name.split('?')[0]) instead, so I could get the stats based on the paths without the query parameters.

I guess this could be useful for many people, so I thought about submitting a patch with an option like --ignore-query-parameters-stats or something, but I thought better to ask here for some tips about where should I add the changes. Should I just do the change as I explained, and add an option for it? Or should I do that up in the call hierarchy?

Thanks!

Most helpful comment

Hi!

You can explicitly name requests using the name parameter.
e.g:

def profile(l):
    l.client.get("/profile?some-query-params=1", name="/profile")

Is this sufficient for your use case?

All 2 comments

Hi!

You can explicitly name requests using the name parameter.
e.g:

def profile(l):
    l.client.get("/profile?some-query-params=1", name="/profile")

Is this sufficient for your use case?

Yes, this is exactly what I need! I hadn't seen that option, sorry!

Was this page helpful?
0 / 5 - 0 ratings