Skip to content
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

Allow to exclude some statistics from aggregation #2955

Open
2 tasks done
tyge68 opened this issue Oct 26, 2024 · 1 comment
Open
2 tasks done

Allow to exclude some statistics from aggregation #2955

tyge68 opened this issue Oct 26, 2024 · 1 comment

Comments

@tyge68
Copy link
Contributor

tyge68 commented Oct 26, 2024

Prerequisites

Description

Currently if our locust script track additional statistics via custom type event, it cannot be excluded from the aggregated line.

Ideally it should be possible to define via script somewhere (via annotation etc...) which metrics are ignored for the aggregation computation, or via ui (similarly to the columns selector).

The reason is that those metrics are mainly to track statistic like "cache missed etc..." detected from CDN response header and so shouldn't be part of the aggregated statistic line data.

Note: the solution is pretty trivial if we hack in the code as it's mainly to add an condition on this line to exclude specific method or name
https://github.com/locustio/locust/blob/master/locust/stats.py#L221

What is not trivial is to do it the locust way for me (using annotations or any means to make it configurable)
So if someone have more experience in that, it could be good to have some suggestions.

Possible options I see:

  • having a command line config (which could be also part of the "locust.conf" file, environment variables)
  • having a mean to set this up during script loading via "@events." syntax etc..

What could be filtered out from aggregation are then obviously the following 2 options:

  • method matching regular expression
  • name matching regular expression
tyge68 added a commit to tyge68/locust that referenced this issue Oct 26, 2024
fix: expected environment param default types

fix: using Optional syntax
@tyge68
Copy link
Contributor Author

tyge68 commented Oct 26, 2024

note it's not clear why Mypy check does the error

locust/stats.py:199: error: Argument 3 to "StatsEntry" has incompatible type "None"; expected "str"  [arg-type]
locust/stats.py:201: error: Need type annotation for "history" (hint: "history: list[<type>] = ...")  [var-annotated]

those lines are not even touched in this PR.

@locustio locustio deleted a comment Oct 29, 2024
tyge68 added a commit to tyge68/locust that referenced this issue Nov 1, 2024
tyge68 added a commit to tyge68/locust that referenced this issue Nov 1, 2024
tyge68 added a commit to tyge68/locust that referenced this issue Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant