Fix filesystem metric parsing for correct mount point names
All checks were successful
Build and Release / build-and-release (push) Successful in 2m10s
All checks were successful
Build and Release / build-and-release (push) Successful in 2m10s
- Fix extract_filesystem_metric() to handle multi-underscore metric names correctly - Parse known metric suffixes (usage_percent, mount_point, available_gb, etc.) - Prevent incorrect parsing like boot_mount_point -> fs_name='boot_mount', metric_type='point' - Should now correctly show /boot and / instead of /boot/mount and /root/mount
This commit is contained in:
parent
fab6404cca
commit
9f18488752
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.104"
|
version = "0.1.105"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -301,7 +301,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.104"
|
version = "0.1.105"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -324,7 +324,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.104"
|
version = "0.1.105"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.105"
|
version = "0.1.106"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.105"
|
version = "0.1.106"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -384,11 +384,14 @@ impl SystemWidget {
|
|||||||
if let Some(fs_start) = metric_name.find("_fs_") {
|
if let Some(fs_start) = metric_name.find("_fs_") {
|
||||||
let after_fs = &metric_name[fs_start + 4..]; // Skip "_fs_"
|
let after_fs = &metric_name[fs_start + 4..]; // Skip "_fs_"
|
||||||
|
|
||||||
// Find the last underscore to separate filesystem name from metric type
|
// Look for known metric suffixes (these can contain underscores)
|
||||||
if let Some(last_underscore) = after_fs.rfind('_') {
|
let known_suffixes = ["usage_percent", "used_gb", "total_gb", "available_gb", "mount_point"];
|
||||||
let fs_name = after_fs[..last_underscore].to_string();
|
|
||||||
let metric_type = after_fs[last_underscore + 1..].to_string();
|
for suffix in known_suffixes {
|
||||||
return (Some(fs_name), Some(metric_type));
|
if after_fs.ends_with(suffix) {
|
||||||
|
let fs_name = after_fs[..after_fs.len() - suffix.len() - 1].to_string(); // Remove suffix + underscore
|
||||||
|
return (Some(fs_name), Some(suffix.to_string()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.105"
|
version = "0.1.106"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user