huskies: merge 1200 story Low-disk warning: the fleet tells the operator before the disk takes it down
This commit is contained in:
@@ -478,6 +478,7 @@ pub async fn run_health_check(ctx: &BotContext) -> String {
|
||||
lines.push(sync_line);
|
||||
lines.push(creds_line);
|
||||
lines.push(hash_line);
|
||||
lines.push(check_disk_space());
|
||||
|
||||
let lines = truncate_lines(lines);
|
||||
lines
|
||||
@@ -487,6 +488,26 @@ pub async fn run_health_check(ctx: &BotContext) -> String {
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
/// Report current free disk space on `/workspace` (story 1200 AC5).
|
||||
fn check_disk_space() -> HealthLine {
|
||||
match crate::service::disk_watch::io::free_space_bytes(std::path::Path::new("/workspace")) {
|
||||
Ok(free_bytes) => {
|
||||
let free_gb = free_bytes as f64 / 1_000_000_000.0;
|
||||
HealthLine {
|
||||
subsystem: "disk".to_string(),
|
||||
status: Status::Pass,
|
||||
detail: Some(format!("{free_gb:.1}GB free")),
|
||||
hint: None,
|
||||
}
|
||||
}
|
||||
Err(_) => HealthLine::warn(
|
||||
"disk",
|
||||
"unable to read free space",
|
||||
"check /workspace mount",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// ── Utilities ────────────────────────────────────────────────────────────────
|
||||
|
||||
/// Shorten a long error string to the first 60 characters for compact display.
|
||||
|
||||
Reference in New Issue
Block a user