fix: use total_rps instead of current_rps in HTML report and navbar stats#3384
Conversation
The stats endpoint used current_rps (a ~10-second sliding-window average) for the report's total_rps and total_fail_per_sec fields. This made the HTML report inconsistent with the final console summary, which correctly uses total_rps (total requests / elapsed time) since the fix in locustio#1152. As the HTML report is a post-test artifact representing the entire run, it should always show the aggregate rate, not a stale snapshot of activity during the last few seconds of the test. Also fix total_fail_per_sec for the same reason. Fixes locustio#3355
|
Added some context: I traced this through |
|
Nice! The fix looks good. No need for the code comments, and would love to see a test case too! Funny how I wasn’t able to reproduce it.. |
|
Thanks for the feedback, @cyberw! I've pushed two changes:
The test follows the same pattern as the existing |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4701459 to
350e011
Compare
|
Thanks, great stuff! |
|
Thanks @juliosuas for the fix! |
Summary
Fixes #3355.
The stats API endpoint used
current_rps(a ~10-second sliding-window average) to populatetotal_rpsandtotal_fail_per_secin the report payload. This made the HTML report inconsistent with the final console summary, which correctly usestotal_rps(total requests ÷ elapsed time) since #1152.Root Cause
Fix
Since the HTML report is a post-test artifact representing the entire run, it should always show the aggregate rate — not whatever the last ~10 seconds happened to look like.