Consolidate HTTP checking and improve display formatting

- Change site latency timeout from 5s to 2s for faster error detection
- Replace curl with reqwest for external connectivity checks (consistent timeouts)
- Remove unused gitea-specific monitoring functionality
- Update dashboard: show 'unreachable' for latency > 2000ms, add arrows (→) between site and latency
- Add percentage signs to CPU metrics display
- All HTTP requests now use reqwest with 2-second timeouts
This commit is contained in:
2025-10-14 22:24:22 +02:00
parent 819ca4ad73
commit 0cb69ea8fa
2 changed files with 21 additions and 63 deletions

View File

@@ -110,9 +110,9 @@ fn render_metrics(
let service_name_with_latency = if let Some(parent) = &svc.sub_service {
if parent == "nginx" {
match &svc.latency_ms {
Some(latency) if *latency >= 5000.0 => format!("{} unreachable", svc.name), // Timeout (5s+)
Some(latency) => format!("{} {:.0}ms", svc.name, latency),
None => format!("{} unreachable", svc.name), // Connection failed
Some(latency) if *latency >= 2000.0 => format!("{} unreachable", svc.name), // Timeout (2s+)
Some(latency) => format!("{} {:.0}ms", svc.name, latency),
None => format!("{} unreachable", svc.name), // Connection failed
}
} else {
svc.name.clone()
@@ -178,9 +178,9 @@ fn format_memory_value(used: f32, quota: f32) -> String {
fn format_cpu_value(cpu_percent: f32) -> String {
if cpu_percent >= 0.1 {
format!("{:.1}", cpu_percent)
format!("{:.1}%", cpu_percent)
} else {
"0.0".to_string()
"0.0%".to_string()
}
}