From 4d615a7f45434a5156c4b84204df4e357e820385 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Mon, 24 Nov 2025 19:44:37 +0100 Subject: [PATCH] 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. --- agent/src/collectors/disk.rs | 5 ++++- agent/src/collectors/memory.rs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/agent/src/collectors/disk.rs b/agent/src/collectors/disk.rs index 2394817..7d8af82 100644 --- a/agent/src/collectors/disk.rs +++ b/agent/src/collectors/disk.rs @@ -412,7 +412,7 @@ impl DiskCollector { for drive in physical_drives { let smart = smart_data.get(&drive.name); - let filesystems: Vec = drive.filesystems.iter().map(|fs| { + let mut filesystems: Vec = 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(), diff --git a/agent/src/collectors/memory.rs b/agent/src/collectors/memory.rs index 4b8bf01..36ea0c5 100644 --- a/agent/src/collectors/memory.rs +++ b/agent/src/collectors/memory.rs @@ -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(()) }