locustio / locust

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

Option to prevent stats from being reset when all locusts are hatched #205

Closed byronh closed 7 years ago

byronh commented 9 years ago

How does one prevent the stats from being automatically reset once all locusts are hatched? I understand that this is the intended behavior of Locust, but for my particular use case I need the stats not to be reset.

What is the recommended workaround for this?

Jahaja commented 9 years ago

You could do this by overriding this block of code: https://github.com/locustio/locust/blob/master/locust/runners.py#L41-L46

heyman commented 9 years ago

I'm re-opening this issue because it keeps popping up, so it might be good to provide an option for turning off the resetting of the stats.

Until a solution has been implemented, here's a workaround that I posted in #236, that monkey patches Locust and disables stats resetting (will also make the "Reset stats" button in the web UI not work):

from locust.stats import RequestStats
def noop(*arg, **kwargs):
    print "Stats reset prevented by monkey patch!"
RequestStats.reset_all = noop
kawing-chiu commented 9 years ago

Run into the same issue today. Hope it will be fixed soon. :)

pior commented 9 years ago

I'm also in favor of this setting.

The requests in on_start() are part of what I want to measure

alexandrul commented 8 years ago

+1

jjstellr commented 8 years ago

+1

JordyvanDortmont commented 8 years ago

+1

noisyboiler commented 7 years ago

+1

alexandrul commented 7 years ago

This was implemented on master a few days ago, see the changelog and the previous commits: https://github.com/locustio/locust/commit/c61d3bbaaaaf1ae09edbc74f4524992a5821c1b0

noisyboiler commented 7 years ago

thanks @alexandrul