Fix mount point ordering consistency

- Sort filesystems by mount point in disk collector for consistent display
- Sort tmpfs mounts by mount point in memory collector
- Eliminates random swapping of / and /boot order between refreshes
- Eliminates random swapping of tmpfs mount order in RAM section

Ensures predictable, alphabetical ordering for all mount points.
This commit is contained in:
Christoffer Martinsson 2025-11-24 19:44:37 +01:00
parent fd7ad23205
commit 4d615a7f45
2 changed files with 7 additions and 1 deletions

View File

@ -412,7 +412,7 @@ impl DiskCollector {
for drive in physical_drives {
let smart = smart_data.get(&drive.name);
let filesystems: Vec<FilesystemData> = drive.filesystems.iter().map(|fs| {
let mut filesystems: Vec<FilesystemData> = drive.filesystems.iter().map(|fs| {
FilesystemData {
mount: fs.mount_point.clone(), // This preserves "/" and "/boot" correctly
usage_percent: fs.usage_percent,
@ -420,6 +420,9 @@ impl DiskCollector {
total_gb: fs.total_bytes as f32 / (1024.0 * 1024.0 * 1024.0),
}
}).collect();
// Sort filesystems by mount point for consistent display order
filesystems.sort_by(|a, b| a.mount.cmp(&b.mount));
agent_data.system.storage.drives.push(DriveData {
name: drive.name.clone(),

View File

@ -153,6 +153,9 @@ impl MemoryCollector {
});
}
// Sort tmpfs mounts by mount point for consistent display order
agent_data.system.memory.tmpfs.sort_by(|a, b| a.mount.cmp(&b.mount));
Ok(())
}