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

new events for heartbeat and usage monitor #2777

Merged
merged 4 commits into from
Jul 1, 2024

Conversation

mgor
Copy link
Contributor

@mgor mgor commented Jun 27, 2024

when troubleshooting a problem where workers did not receive a heartbeat from master within locust.runners.MASTER_HEARTBEAT_TIMEOUT (not a locust problem) i created two new events which made it possible to easily update our statistics listener to send that information influxdb.

  • heartbeat_sent: fired when master sent heartbeat to a worker
  • heartbeat_received: fired when worker received said heartbeat
  • usage_monitor: fired with information about current CPU and memory usage every locust.runners.CPU_MONITOR_INTERVAL

i did considered creating a custom on_master_report to add worker CPU and memory usage there, but that would leave out master. i also considered using the heartbeat event, since CPU and memory is part of the heartbeat RPC message sent, but that would also leave out master usage.

changes regarding imports organization and format is due to ruff check and/or ruff format complaining and failing the tests (in my fork).

@cyberw
Copy link
Collaborator

cyberw commented Jun 27, 2024

Looks very useful, but needs tests and an example (https://github.com/locustio/locust/blob/master/examples/test_data_management.py is where we dump all event examples I right now I guess :)

Have you considered using separate events (heartbeat_sent and heartbeat_received). To me that kind of makes more sense.

@mgor
Copy link
Contributor Author

mgor commented Jun 27, 2024

ah, i was looking through locust/tests/ and docs/ to see if there was something for events, guess i didn't look close enough.

i'll fix something!

added event examples in `test_data_management.py`.

splitted `heartbeat` event into `heartbeat_sent` and `heartbeat_received`, renamed `time` argument to `timestamp`.

corrected type of `Runner.current_cpu_usage` which is a `float`.

some additional formatting changed by `ruff format .`.
mgor added 2 commits June 27, 2024 15:12
...in vscode and terminal+venv and tox env (and hence github workflow).

formatting should be fixed now.
@cyberw
Copy link
Collaborator

cyberw commented Jul 1, 2024

Lgtm. Can you update the PR description to match the final solution?

@mgor mgor changed the title two new events for heartbeat and usage monitor new events for heartbeat and usage monitor Jul 1, 2024
@cyberw cyberw merged commit 11908ef into locustio:master Jul 1, 2024
14 checks passed
@mgor mgor deleted the feature/monitor_events branch July 1, 2024 07:39
@mgor mgor restored the feature/monitor_events branch July 1, 2024 07:40
@mgor mgor deleted the feature/monitor_events branch July 1, 2024 09:01
apereocas-bot referenced this pull request in apereo/cas Aug 1, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [locust](https://locust.io/) ([source](https://togithub.com/locustio/locust)) | `==2.29.1` -> `==2.30.0` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/locust/2.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/locust/2.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/locust/2.29.1/2.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/locust/2.29.1/2.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>locustio/locust (locust)</summary>

### [`v2.30.0`](https://togithub.com/locustio/locust/releases/tag/2.30.0)

[Compare Source](https://togithub.com/locustio/locust/compare/2.29.1...2.30.0)

#### What's Changed

-   FastHttpSession: Enable passing json as a positional argument for post() and stop converting response times to int by [@&#8203;tdadela](https://togithub.com/tdadela) in [https://github.com/locustio/locust/pull/2772](https://togithub.com/locustio/locust/pull/2772)
-   Remove Line Chart Default Zoom by [@&#8203;andrewbaldwin44](https://togithub.com/andrewbaldwin44) in [https://github.com/locustio/locust/pull/2774](https://togithub.com/locustio/locust/pull/2774)
-   FastHttpSession requests typing  by [@&#8203;tdadela](https://togithub.com/tdadela) in [https://github.com/locustio/locust/pull/2775](https://togithub.com/locustio/locust/pull/2775)
-   new events for heartbeat and usage monitor by [@&#8203;mgor](https://togithub.com/mgor) in [https://github.com/locustio/locust/pull/2777](https://togithub.com/locustio/locust/pull/2777)
-   dispatch benchmark test improvements by [@&#8203;tdadela](https://togithub.com/tdadela) in [https://github.com/locustio/locust/pull/2780](https://togithub.com/locustio/locust/pull/2780)
-   SequentialTaskSet: Allow weighted tasks and dict in .tasks by [@&#8203;bakhtos](https://togithub.com/bakhtos) in [https://github.com/locustio/locust/pull/2742](https://togithub.com/locustio/locust/pull/2742)
-   Fix StatsEntry docstring by [@&#8203;tdadela](https://togithub.com/tdadela) in [https://github.com/locustio/locust/pull/2784](https://togithub.com/locustio/locust/pull/2784)
-   Implement Poetry build system (mainly so we don't have to commit dynamically generated front end bundles to git) by [@&#8203;mquinnfd](https://togithub.com/mquinnfd) in [https://github.com/locustio/locust/pull/2725](https://togithub.com/locustio/locust/pull/2725)
-   Typing: strict optional in dispatch.py by [@&#8203;tdadela](https://togithub.com/tdadela) in [https://github.com/locustio/locust/pull/2779](https://togithub.com/locustio/locust/pull/2779)
-   Correctly set version from Poetry in published builds by [@&#8203;mquinnfd](https://togithub.com/mquinnfd) in [https://github.com/locustio/locust/pull/2791](https://togithub.com/locustio/locust/pull/2791)
-   Fix Extend Webui Example by [@&#8203;andrewbaldwin44](https://togithub.com/andrewbaldwin44) in [https://github.com/locustio/locust/pull/2800](https://togithub.com/locustio/locust/pull/2800)
-   Provide warning for local installs where yarn is not present by [@&#8203;mquinnfd](https://togithub.com/mquinnfd) in [https://github.com/locustio/locust/pull/2801](https://togithub.com/locustio/locust/pull/2801)
-   Fix tests on windows by [@&#8203;mquinnfd](https://togithub.com/mquinnfd) in [https://github.com/locustio/locust/pull/2803](https://togithub.com/locustio/locust/pull/2803)
-   Add example of a bottlenecked server and use that test to make a new graph for the docs by [@&#8203;cyberw](https://togithub.com/cyberw) in [https://github.com/locustio/locust/pull/2805](https://togithub.com/locustio/locust/pull/2805)
-   Replace total avg response time with 50 percentile (avg was broken) by [@&#8203;andrewbaldwin44](https://togithub.com/andrewbaldwin44) in [https://github.com/locustio/locust/pull/2806](https://togithub.com/locustio/locust/pull/2806)
-   Avoid deadlock in gevent/urllib3 connection pool (fixes occasional worker heartbeat timeouts) by [@&#8203;tdadela](https://togithub.com/tdadela) in [https://github.com/locustio/locust/pull/2813](https://togithub.com/locustio/locust/pull/2813)
-   Fix Dockerfile style warning by [@&#8203;mehrdadbn9](https://togithub.com/mehrdadbn9) in [https://github.com/locustio/locust/pull/2814](https://togithub.com/locustio/locust/pull/2814)
-   Fix pypy gc.freeze() AttributeError by [@&#8203;jimoleary](https://togithub.com/jimoleary) in [https://github.com/locustio/locust/pull/2819](https://togithub.com/locustio/locust/pull/2819)
-   Update poetry windows tests by [@&#8203;mquinnfd](https://togithub.com/mquinnfd) in [https://github.com/locustio/locust/pull/2821](https://togithub.com/locustio/locust/pull/2821)

#### New Contributors

-   [@&#8203;bakhtos](https://togithub.com/bakhtos) made their first contribution in [https://github.com/locustio/locust/pull/2742](https://togithub.com/locustio/locust/pull/2742)
-   [@&#8203;mquinnfd](https://togithub.com/mquinnfd) made their first contribution in [https://github.com/locustio/locust/pull/2725](https://togithub.com/locustio/locust/pull/2725)
-   [@&#8203;mehrdadbn9](https://togithub.com/mehrdadbn9) made their first contribution in [https://github.com/locustio/locust/pull/2814](https://togithub.com/locustio/locust/pull/2814)
-   [@&#8203;jimoleary](https://togithub.com/jimoleary) made their first contribution in [https://github.com/locustio/locust/pull/2819](https://togithub.com/locustio/locust/pull/2819)

**Full Changelog**: locustio/locust@2.29.1...2.30.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 10pm every weekday,before 6am every weekday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/apereo/cas).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbIkJvdCIsIlJlbm92YXRlIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants