Fix router keep nonzero metrics after worker is deleted (#14819)

This commit is contained in:
fzyzcjy
2025-12-10 22:29:30 +08:00
committed by GitHub
parent 5eccaf7737
commit 6634f67bd5
2 changed files with 11 additions and 1 deletions
@@ -8,6 +8,7 @@ use dashmap::DashMap;
use uuid::Uuid;
use crate::core::{ConnectionMode, RuntimeType, Worker, WorkerType};
use crate::observability::metrics::RouterMetrics;
/// Unique identifier for a worker
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
@@ -138,8 +139,8 @@ impl WorkerRegistry {
conn_workers.retain(|id| id != worker_id);
}
// TODO we may even remove it from Prometheus exports
worker.set_healthy(false);
RouterMetrics::remove_worker_metrics(worker.url());
Some(worker)
} else {