Improve dashboard display and fix service issues
- Remove unreachable descriptions from failed nginx sites - Show complete site URLs instead of truncating at first dot - Implement service-specific disk quotas (docker: 4GB, immich: 4GB, others: 1-2GB) - Truncate process names to show only executable name without full path - Display only highest C-state instead of all C-states for cleaner output - Format system RAM as xxxMB/GB (totalGB) to match services format
This commit is contained in:
@@ -109,12 +109,8 @@ fn render_metrics(
|
||||
// Add latency information for nginx sites if available
|
||||
let service_name_with_latency = if let Some(parent) = &svc.sub_service {
|
||||
if parent == "nginx" {
|
||||
// Extract subdomain part for shorter display
|
||||
let short_name = if let Some(dot_pos) = svc.name.find('.') {
|
||||
&svc.name[..dot_pos]
|
||||
} else {
|
||||
&svc.name
|
||||
};
|
||||
// Use full site name instead of truncating at first dot
|
||||
let short_name = &svc.name;
|
||||
|
||||
match &svc.latency_ms {
|
||||
Some(latency) if *latency >= 2000.0 => format!("{} → unreachable", short_name), // Timeout (2s+)
|
||||
|
||||
@@ -68,14 +68,10 @@ fn render_metrics(
|
||||
// Use agent-provided C-states and logged-in users as description
|
||||
let mut description_lines = Vec::new();
|
||||
|
||||
// Add C-states with prefix on first line, indent subsequent lines
|
||||
// Add C-state (now only highest C-state from agent)
|
||||
if let Some(cstates) = &summary.cpu_cstate {
|
||||
for (i, cstate_line) in cstates.iter().enumerate() {
|
||||
if i == 0 {
|
||||
description_lines.push(format!("C-State: {}", cstate_line));
|
||||
} else {
|
||||
description_lines.push(format!(" {}", cstate_line));
|
||||
}
|
||||
for cstate_line in cstates.iter() {
|
||||
description_lines.push(cstate_line.clone()); // Agent already includes "C-State:" prefix
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +101,7 @@ fn render_metrics(
|
||||
overall_status.clone(),
|
||||
description_lines,
|
||||
vec![
|
||||
format!("{:.1} / {:.1} GB", summary.memory_used_mb / 1000.0, summary.memory_total_mb / 1000.0),
|
||||
format_system_memory_value(summary.memory_used_mb, summary.memory_total_mb),
|
||||
format!("{:.2} • {:.2} • {:.2}", summary.cpu_load_1, summary.cpu_load_5, summary.cpu_load_15),
|
||||
format_optional_metric(summary.cpu_temp_c, "°C"),
|
||||
],
|
||||
@@ -122,3 +118,22 @@ fn format_optional_metric(value: Option<f32>, unit: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn format_bytes(mb: f32) -> String {
|
||||
if mb < 0.1 {
|
||||
"<1MB".to_string()
|
||||
} else if mb < 1.0 {
|
||||
format!("{:.0}kB", mb * 1000.0)
|
||||
} else if mb < 1000.0 {
|
||||
format!("{:.0}MB", mb)
|
||||
} else {
|
||||
format!("{:.1}GB", mb / 1000.0)
|
||||
}
|
||||
}
|
||||
|
||||
fn format_system_memory_value(used_mb: f32, total_mb: f32) -> String {
|
||||
let used_value = format_bytes(used_mb);
|
||||
let total_gb = total_mb / 1000.0;
|
||||
// Format total as GB without decimals
|
||||
format!("{} ({}GB)", used_value, total_gb as u32)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user