Skip to main content

count_recent_with_status

Function count_recent_with_status 

Source
pub fn count_recent_with_status(
    connection: &mut PgConnection,
    status: &str,
    hours: i64,
) -> usize
Expand description

Counts jobs in terminal status created within the last hours — a current-state observability signal for “are jobs failing / stalling lately?”. A rolling window so the gauge auto-resolves (unlike an ever-growing total-failures counter, which would alert forever after one failure). Skew-free (windowed against the DB clock). Best-effort: 0 on error.