-
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
[1292] Fix detailed results statistics in csv reports #1297
[1292] Fix detailed results statistics in csv reports #1297
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1297 +/- ##
==========================================
+ Coverage 79.70% 79.77% +0.07%
==========================================
Files 23 23
Lines 2074 2087 +13
Branches 321 325 +4
==========================================
+ Hits 1653 1665 +12
+ Misses 340 339 -1
- Partials 81 83 +2
Continue to review full report at Codecov.
|
Lgtm, but I dont see any tests? Did you maybe miss something in the tests-commit? |
This PR does not make sense to me. Why would we be storing a dict of user counts on every StatsEntry (which corresponds to a (URL, HTTP method) pair in the case of HttpLocust)? |
I assume (guessing since there is no PR description) that the purpose of this PR is to get a user_count column in the history CSV file? That functionality makes sense, but it would need a different implementation. |
@heyman The purpose of this change is described in this issue #1292 For me, the most important is to have detailed values for percentiles and additionally also information about current amount of spawned users in csv reports. With my PR I added support for counting users in aggregated csv line. If there is better place then it would be great. I also added percentiles information, because locust doesn't report them as described in issue. The reported percentiles in PR are accumulated - it would be nice to have them calculated from current time window (configurable). I need to publish the collected metrics to other place than csv file (e. g. to influx). Do you think that publishing a list of dicts of calculated metrics from stats.py as an event would be a good idea? |
I've opened an issue for this: #1315
This should be a separate issue/PR, and the way to retrieve the current user count is through
You could listen for the request_success and request_failure events and post info to some external DB there. If you'd rather post the aggregate stats periodically (could make sense in order to not overload the external DB) you could spawn a Greenlet that does this every X second. Something like this (note: haven't tested it, just wrote it up here, so I might have missed something, but hopefully you get the idea): import gevent
from locust import events
stats_greenlet = None
@events.test_start.add_listener
def on_test_start(environment, **kw):
def stats_reporter():
while True:
# grab stats from environment.runner.stats here and push to Influx or whatever
gevent.sleep(1)
stats_greenlet = gevent.spawn(stats_reporter)
@events.test_stop.add_listener
def on_test_stop(environment, **kw):
if stats_greenlet:
stats_greenlet.kill() |
No description provided.