locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.11k stars 3k forks source link

feat: #2955 Allow to exclude some statistics from aggregation #2956

Open tyge68 opened 1 month ago

tyge68 commented 1 month ago

Here is a sample implementation allowing to set the --exclude-from-aggregation argument option.

locust --exclude-from-aggregation "CUSTOM"

Note:

Screenshot 2024-10-26 at 11 45 47
tyge68 commented 1 month ago

If anyone has ideas why Mypy step fails, the error seems unrelated to the change, at least the line for which the error is triggered wasn't updated by this PR at all.

cyberw commented 4 weeks ago

Does mypy (using 1.11.2) work for you locally?

tyge68 commented 4 weeks ago

@cyberw no it seems to be the same issue, it's really not clear why this tool is failing especially as those lines are not touched by this PR

cyberw commented 3 weeks ago

Not sure what the typing issue is, but passing the whole environment into the RequestsStats constructor is awkward. Maybe just pass the exclude_from_aggregation regex?

tyge68 commented 3 weeks ago

@cyberw thanks for your feedback, I have updated it now and also changed to allow setting that via command arguments. Still the same Mypy is happening which is really unclear. I am not too familiar with that tool and what is the purpose of it, why it fails etc... might be worth checking with Mypy experts.

cyberw commented 3 weeks ago

Can you try grabbing this change: https://github.com/locustio/locust/commit/74d5de457fb68a26fe49670aec98e26feccead6b

It seems to have been a "real" issue with the type hints in the code, but I still don't understand why your PR exposed it :)