From a68be931f852a065990178b190c6e5ca571e9a5d Mon Sep 17 00:00:00 2001 From: ZhangShuaiyi Date: Wed, 9 Jul 2025 19:21:28 +0800 Subject: [PATCH] [router] Update metrics when request completes Signed-off-by: ZhangShuaiyi --- sgl-router/src/router.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sgl-router/src/router.rs b/sgl-router/src/router.rs index 136ed9b129a0..f04653855970 100644 --- a/sgl-router/src/router.rs +++ b/sgl-router/src/router.rs @@ -842,6 +842,8 @@ impl Router { if let Ok(mut queue) = running_queue.lock() { if let Some(count) = queue.get_mut(worker_url) { *count = count.saturating_sub(1); + gauge!("sgl_router_running_requests", "worker" => worker_url.to_string()) + .set(*count as f64); } } } @@ -874,6 +876,7 @@ impl Router { let mut locked_queue = running_queue.lock().unwrap(); let count = locked_queue.get_mut(&worker_url).unwrap(); *count = count.saturating_sub(1); + gauge!("sgl_router_running_requests", "worker" => worker_url.to_string()).set(*count as f64); debug!("Streaming is done!!") } }),