Locust: Retrieving stats when running with --no-web

Created on 2 Jun 2015  Â·  16Comments  Â·  Source: locustio/locust

What is the recommended way of retrieving stats from locust when running with '--no-web'?

I am currently running a load test programmatically and with the web interface disabled, I am unable to poll stats/requests/csv while the test is running.

I tried using the log file with '--print-stats' but the stats are not printed to the log.

Thanks!

Most helpful comment

@rktbear you must mean this pull request: #291

:+1: on this idea! I like that I can save a csv file of results from the web interface. I'd love it if locust could save the csv file automatically when you run it with --no-web.

All 16 comments

If you have set the --loglevel greater than info , you will not be able to capture the stats !

Thanks

I'm using the following command line which I'm assuming uses the default log level of INFO:

locust --no-web -c 100 -r 100 -f scripts/main.py --logfile=./test.log

I see no stats in test.log :(

i see '--print-stats ' option missing .. try below command

locust --no-web -c 100 -r 100 -f scripts/main.py --logfile=./test.log --print-stats

Yeah I tried that but sadly nothing is written to the log file :( This was the reason I created a pull request to allow you to print out stats to a separate file.

@rktbear you must mean this pull request: #291

:+1: on this idea! I like that I can save a csv file of results from the web interface. I'd love it if locust could save the csv file automatically when you run it with --no-web.

This has become an issue for me too. I'd like to run locust with pytest and capture the stats in a usable format. Any progress on this PR? Anything I can help with?

I have been using this pull request locally for all my load testing at work and it's been super useful especially when passed through a matplotlib script for plotting an analysis.

@rktbear Any chance you can share that matplotlib script? I foresee having to do a similar thing and it would be great to see your approach.

@robcowie I made a slight mistake in my last message, I've actually been using a slightly different approach to pull out requests data that is different to the pull request.

You can find my docker file and associated matplotlib script here https://github.com/rktbear/docker-locust.

It would probably be easy to retrofit the script to work with my pull requests too!

Hope this helps :)

Up up pl

@robcowie https://github.com/robcowie I made a slight mistake in my last
message, I've actually been using a slightly different approach to pull out
requests data that is different to the pull request.

You can find my docker file and associated matplotlib script here
https://github.com/rktbear/docker-locust.

It would probably be easy to retrofit the script to work with my pull
requests too!

Hope this helps :)

—
Reply to this email directly or view it on GitHub
https://github.com/locustio/locust/issues/290#issuecomment-121064450.

:+1: for this PR, can't wait to see it in the production code

There are at least couple PRs regarding to retrieving CSV files when using --no-web option. Any news about when that kind of feature might be coming to release version? It is quite useful when doing automated tests and trying to do trend graphing with that data. In this kind of scenarios CSV import option in console is very critical feature.

Any updates ?

At the moment there is following work around what we have used in test automation purposes.

nohup locust -f test.py &
LOCUST_PID=$!
echo $LOCUST_PID
sleep 2
curl --data "hatch_rate=5&locust_count=60" http://localhost:8089/swarm
sleep 60
curl localhost:8089/stats/requests/csv -o requests_stats.csv
kill -9 $LOCUST_PID

I've been using Jenkins to run the Locust command and that will print out the console results to a log for me. Then I ship the metrics using logstash (using a logstash pattern) to elasticsearch to be visualized in Kibana in near real time.

Shouldn't this issue be closed now that --only-summary and --csv=outputName flags are present?

Was this page helpful?
0 / 5 - 0 ratings