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

metrics: collect disk usage from internal metrics #21062

Merged

Conversation

tomasmatus
Copy link
Member

use mount.total and mount.used from internal metrics instead of parsing df output.

@jelly
Copy link
Member

jelly commented Oct 1, 2024

Fun times, you forget one important detail, the JS code filters mount points (loopback, flatpak, and? tmpfs?)

@tomasmatus tomasmatus force-pushed the port-mountpoints-internal-metrics branch from ad6a56d to e692d9d Compare October 3, 2024 12:44
path = line.split()[1]
split_line = line.split()
# Skip read-only loop mounts
if '/loop' in split_line[0] and 'ro' in split_line[3].split(','):
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be nicer to properly decompose this

mounts = open('/proc/mounts').read()
fs_spec, fs_file, fs_vfstype, fs_mntopts, *_rest  = mounts.splitlines()[0].split()

Not sure if one can remove *_rest, field definitions comes from https://man.archlinux.org/man/fstab.5

src/cockpit/samples.py Show resolved Hide resolved
use `mount.total` and `mount.used` from internal metrics
instead of parsing `df` output.
@tomasmatus tomasmatus force-pushed the port-mountpoints-internal-metrics branch from e692d9d to b1511a7 Compare October 7, 2024 08:33
@tomasmatus tomasmatus requested a review from jelly October 7, 2024 11:58
Copy link
Member

@jelly jelly left a comment

Choose a reason for hiding this comment

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

Nice cleanup!

@jelly
Copy link
Member

jelly commented Oct 8, 2024

The anaconda test failures are unrelated and already fixed in anaconda-webui

@jelly jelly merged commit 8b687a1 into cockpit-project:main Oct 8, 2024
87 of 88 checks passed
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