Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sgl-model-gateway/src/core/worker_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions sgl-model-gateway/src/observability/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,15 @@ impl RouterMetrics {
.increment(1);
}

// TODO delete the metrics (instead of setting them to zero)
pub fn remove_worker_metrics(worker_url: &str) {
gauge!("sgl_router_cb_state","worker" => worker_url.to_string()).set(0.0);
gauge!("sgl_router_worker_health","worker" => worker_url.to_string()).set(0.0);
gauge!("sgl_router_worker_load","worker" => worker_url.to_string()).set(0.0);
gauge!("sgl_router_running_requests","worker" => worker_url.to_string()).set(0.0);
gauge!("sgl_router_tree_size","worker" => worker_url.to_string()).set(0.0);
}

pub fn set_job_queue_depth(depth: usize) {
gauge!("sgl_router_job_queue_depth").set(depth as f64);
}
Expand Down
Loading