-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to write csv stats files #612
Conversation
Hi! As I understand one row will write in csv per 2 seconds? Why not per one second? It will be great for some TSDB like InfluxDB. |
@mambusskruj I copied the interval here: https://github.com/locustio/locust/blob/master/locust/stats.py#L519 I'd actually be more inclined to decrease the frequency given that it's blocking IO for locust and on slower systems that might affect your loadtest performance. |
@aldenpeterson-wf well, if locust used in master-slave mode, this is not a big issue I think. |
@mambusskruj I could make it a user defined option but I'm not sure that it's worth the added complexity. I'd be curious what other people think. I could also define the time at the module level so anyone who really wanted to could set the timeframe for both the printing/csv save. |
locust/web.py
Outdated
@@ -15,7 +15,8 @@ | |||
from . import runners | |||
from .cache import memoize | |||
from .runners import MasterLocustRunner | |||
from locust.stats import median_from_dict | |||
from .stats import sort_stats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the 2 different imports from .stats
and then locust.stats
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. no reason, will fix this
I think 2 secs for a writing interval sounds good for the initial implementation. Once we gauge impact of this change on performance, we can revisit or make it configurable. First pass at a review LGTM, but I haven't tested it. Also, can something be added to the docs or README that describes stats output? |
@cgoldberg will update the docs. I also might just make the sleep time to be constants in that file, so someone can change them it if they want since.. python. |
I'm not 100% sure where to put this in the docs. There's not really a good section detailing all the flags but I added them, given activity on GH it seems an option like this would be very commonly used. Also @mambusskruj I added the ability to easily customize how frequently the stats CSV is written. |
@cgoldberg this is updated and ready for review |
@cgoldberg bump :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I started reviewing #445 but found that it had enough problems that it'd be just easier to rewrite the entire PR.
This:
I also fixed #598 because that issue has been annoying me for a while.