[mode;-gateway] add back fixes of incorrect metrics after worker removal (#15624)

This commit is contained in:
fzyzcjy
2025-12-23 18:50:03 -08:00
committed by GitHub
parent aef7ca7cf2
commit 4d64f15086
2 changed files with 20 additions and 1 deletions
@@ -1032,6 +1032,21 @@ impl Metrics {
)
.increment(1);
}
// ========================================================================
// Worker cleanup
// ========================================================================
pub fn remove_worker_metrics(worker_url: &str) {
gauge!("smg_worker_cb_consecutive_failures", "worker" => worker_url.to_string()).set(0.0);
gauge!("smg_worker_cb_consecutive_successes", "worker" => worker_url.to_string()).set(0.0);
gauge!("smg_worker_requests_active", "worker" => worker_url.to_string()).set(0.0);
// Zero for these metrics have special valid meaning, thus we set to -1 temporarily
// (and will remove them completely after https://github.com/metrics-rs/metrics/issues/653)
gauge!("smg_worker_cb_state", "worker" => worker_url.to_string()).set(-1.0);
gauge!("smg_worker_health","worker" => worker_url.to_string()).set(-1.0);
}
}
#[cfg(test)]