Fix both pool-level and filesystem metric parsing bugs
All checks were successful
Build and Release / build-and-release (push) Successful in 1m10s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m10s
1. Prevent filesystem _fs_ metrics from overwriting pool totals 2. Fix filesystem name extraction to properly parse boot/root names This resolves both the pool total display (showing 0.1GB instead of 220GB) and individual filesystem display (showing —% —GB/—GB).
This commit is contained in:
parent
006f27f7d9
commit
1da7b5f6e7
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.116"
|
||||
version = "0.1.117"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -301,7 +301,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.116"
|
||||
version = "0.1.117"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -324,7 +324,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.116"
|
||||
version = "0.1.117"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.116"
|
||||
version = "0.1.117"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.116"
|
||||
version = "0.1.117"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -185,11 +185,13 @@ impl SystemWidget {
|
||||
pool.usage_percent = Some(usage);
|
||||
pool.status = metric.status.clone();
|
||||
}
|
||||
} else if metric.name.contains("_used_gb") {
|
||||
} else if metric.name.contains("_used_gb") && !metric.name.contains("_fs_") {
|
||||
// Only use drive-level metrics for pool totals, not filesystem metrics
|
||||
if let MetricValue::Float(used) = metric.value {
|
||||
pool.used_gb = Some(used);
|
||||
}
|
||||
} else if metric.name.contains("_total_gb") {
|
||||
} else if metric.name.contains("_total_gb") && !metric.name.contains("_fs_") {
|
||||
// Only use drive-level metrics for pool totals, not filesystem metrics
|
||||
if let MetricValue::Float(total) = metric.value {
|
||||
pool.total_gb = Some(total);
|
||||
}
|
||||
@ -391,10 +393,9 @@ impl SystemWidget {
|
||||
|
||||
for suffix in known_suffixes {
|
||||
if after_fs.ends_with(suffix) {
|
||||
// Safely calculate fs_name length
|
||||
let suffix_with_underscore = suffix.len() + 1;
|
||||
if after_fs.len() > suffix_with_underscore {
|
||||
let fs_name = after_fs[..after_fs.len() - suffix_with_underscore].to_string();
|
||||
// Extract filesystem name by removing suffix and underscore
|
||||
if let Some(underscore_pos) = after_fs.rfind(&format!("_{}", suffix)) {
|
||||
let fs_name = after_fs[..underscore_pos].to_string();
|
||||
return (Some(fs_name), Some(suffix.to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.116"
|
||||
version = "0.1.117"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user