Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

gunesmes
Copy link

No description provided.

@justiniso
Copy link
Member

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.

@justiniso justiniso changed the title fixing --statfile option if value is None Save stats to file with --statfile option Feb 14, 2017
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:
Copy link
Member

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.

Copy link
Author

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)
Copy link

@jamiemul jamiemul Feb 22, 2017

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.

Copy link
Author

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
Copy link
Author

@gunesmes gunesmes left a 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

Copy link
Author

@gunesmes gunesmes left a 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:
Copy link
Author

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

@naveensrinivasan
Copy link
Contributor

Anything I can do to move this along?

@jvautour
Copy link

this would be swell. looking forward to having it merged

@AXington
Copy link

Would also really like to see this get merged.

@aldenpeterson-wf
Copy link
Contributor

It'd be nice to see this in the 0.8 release, we would definitely use this functionality too.

@prince-mishra
Copy link

prince-mishra commented May 24, 2017

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?

@aldenpeterson-wf
Copy link
Contributor

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.

@mbeacom
Copy link
Member

mbeacom commented Sep 8, 2017

Closed in favor of #612 (merged) - Thank you!

@mbeacom mbeacom closed this Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants