-
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
Save stats to file with --statfile option #445
Conversation
There are a few ways of doing this being discussed. The question is whether we want to expose a file with summary stats at the end, all stats over time, or both. |
locust/stats.py
Outdated
# need to add try - except block if one of the value is None | ||
try: | ||
f.write("%s,%s,%d,%d,%d,%d,%d\n" % (r.name,r.method,r.num_requests,r.num_failures,r.min_response_time,r.max_response_time,r.avg_response_time)); | ||
except: |
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.
This should not be a catch-all exception.
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.
@justiniso fixed it for only for TypeError
@@ -416,6 +426,9 @@ def main(): | |||
if not options.only_summary and (options.print_stats or (options.no_web and not options.slave)): | |||
# spawn stats printing greenlet | |||
gevent.spawn(stats_printer) | |||
|
|||
if options.statsfile: | |||
gevent.spawn(stats_persist, options.statsfile) |
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.
Requires from stats import stats_persist.
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.
@jamiemul add import for stats_persist
thanks @justiniso we should raise exception for only TypeError
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.
please check the fixes for comments
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.
may someone review this?
locust/stats.py
Outdated
# need to add try - except block if one of the value is None | ||
try: | ||
f.write("%s,%s,%d,%d,%d,%d,%d\n" % (r.name,r.method,r.num_requests,r.num_failures,r.min_response_time,r.max_response_time,r.avg_response_time)); | ||
except: |
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.
@justiniso fixed it for only for TypeError
Anything I can do to move this along? |
this would be swell. looking forward to having it merged |
Would also really like to see this get merged. |
It'd be nice to see this in the 0.8 release, we would definitely use this functionality too. |
When running with stop_timeout, the statsfile is empty after the run. Essentially, towards the end of the run (when all locusts die due to the timeout), there are no stats to report and thus, an empty file. Is that expected? |
I rewrote this PR into this - #612 I was looking at modifying this to fix the issues @prince-mishra pointed out but eventually just decided it would be easier to rewrite it. |
Closed in favor of #612 (merged) - Thank you! |
No description provided.