Repository navigation
Conversation
… report
In distributed mode the master only sees errors as strings, so
StatsError.to_name() unwraps "CatchResponseError(...)" by slicing off the
class name. What is left is the repr() of the message, so the console
error report shows response.failure("boom") as 'boom' on a master, while a
standalone run shows boom.
Parse the unwrapped text as a Python literal and use it when it is a
string, so both modes print the same name. Anything that isn't a plain
string literal is left as before.
Collaborator
|
Probably a good fix, but it needs a test case actually testing a distributed run. |
Contributor
Author
|
Added one in a52a506: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Taltal · project thread
The console error report names a
response.failure("boom")differently depending on the run mode:GET /x: boomGET /x: 'boom'In distributed mode the master only has the error as a string,
CatchResponseError('boom'), andStatsError.to_name()slices offCatchResponseError(and). What remains is the repr of the message, quotes and escapes included (it's "bad"comes out as'it\'s "bad"'). #2712 removed one extra layer of quoting here; this is the layer that was left.The fix parses the unwrapped text with
ast.literal_evaland uses the result when it is a string. Anything else (several args, a non-literal repr) is printed as before.test_error_name_same_in_standalone_and_distributed_modechecks both modes give the same name for a plain message and one with quotes. It fails on master and passes with the fix.locust/test/test_stats.py: 72 passed.locust/test/test_runners.py: 112 passed, 3 skipped (test_undefined_custom_messagefailed once in a combined run and passed on rerun, also on master in isolation; it looks timing related).ruff check .,ruff format --checkandmypy locust/stats.pyare clean.I used Claude Code to help find and write this fix. I reviewed and tested the change.