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

feat(swapusage): add swapusage beacon (complements memusage beacon) #59460

Merged

Conversation

myii
Copy link
Contributor

@myii myii commented Feb 9, 2021

What does this PR do?

Adds a swapusage beacon to use alongside the existing memusage beacon.

What issues does this PR fix or reference?

N/A.

Merge requirements satisfied?

Implementation, docs and tests based on the memusage beacon (with obvious changes made).

Commits signed with GPG?

Yes

@myii myii requested a review from a team as a code owner February 9, 2021 08:00
@myii myii requested review from krionbsd and removed request for a team February 9, 2021 08:00
@myii myii force-pushed the feat/add-swapusage-beacon-to-complement-memusage branch from 862a4b8 to ad364e2 Compare February 9, 2021 08:06
"""
Beacon to monitor swap usage.

.. versionadded:: 3003
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumed 3003.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3003.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did discuss this in the open hour, but there is not a SEP currently to actually change this. I'll bring it up again to see which release we want to start implementing this and when we can get a SEP prepped. For now you can keep it at 3003 and we can change later if needed.

@myii myii force-pushed the feat/add-swapusage-beacon-to-complement-memusage branch 2 times, most recently from 3e73c49 to 6f4e290 Compare February 9, 2021 08:26
krionbsd
krionbsd previously approved these changes Feb 9, 2021
@@ -0,0 +1,66 @@
# Python libs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a new test module would you mind migrating it to pytest? tests/pytests/unit/beacons

Copy link
Contributor Author

@myii myii Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ch3LL Done. Since this was based on memusage, I've migrated that to pytest as well. If there are any changes that need to be made, I'll apply them to both test files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!!!!

@Ch3LL Ch3LL added the Aluminium Release Post Mg and Pre Si label Feb 9, 2021
@Ch3LL Ch3LL requested a review from garethgreenaway February 9, 2021 19:00
@myii myii force-pushed the feat/add-swapusage-beacon-to-complement-memusage branch 2 times, most recently from 9199d05 to e1852f3 Compare February 10, 2021 08:25
@myii myii requested a review from Ch3LL February 10, 2021 08:27
@myii
Copy link
Contributor Author

myii commented Feb 10, 2021

Actually, won't 3003 actually be released as 3003.0? I recall it being discussed in the Open Hour. If that's the case, I'll need to fix the .. versionadded:: 3003 line.

If so, https://docs.saltproject.io/en/master/topics/releases/version_numbers.html should also be updated for Aluminium.

"""
Beacon to monitor swap usage.

.. versionadded:: 3003
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did discuss this in the open hour, but there is not a SEP currently to actually change this. I'll bring it up again to see which release we want to start implementing this and when we can get a SEP prepped. For now you can keep it at 3003 and we can change later if needed.

import salt.beacons.memusage as memusage
from tests.support.mock import MagicMock, patch

STUB_MEMORY_USAGE = namedtuple(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid module level variables in tests now since this has caused hard to find issues in the test suite if they clash with other testing modules.

Copy link
Contributor Author

@myii myii Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import salt.beacons.swapusage as swapusage
from tests.support.mock import MagicMock, patch

STUB_SWAP_USAGE = namedtuple("sswap", "total used free percent sin sout")(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well

Copy link
Contributor Author

@myii myii Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@myii myii force-pushed the feat/add-swapusage-beacon-to-complement-memusage branch from e1852f3 to 6f695b6 Compare February 10, 2021 12:39
@myii myii requested a review from Ch3LL February 10, 2021 12:43
@Ch3LL Ch3LL merged commit dba6ec2 into saltstack:master Feb 11, 2021
@myii myii deleted the feat/add-swapusage-beacon-to-complement-memusage branch February 11, 2021 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aluminium Release Post Mg and Pre Si
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants