Skip to content

Commit 7590f52

Browse files
authored
[router] Update metrics when request completes (sgl-project#7899)
1 parent f9df11a commit 7590f52

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sgl-router/src/router.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ impl Router {
842842
if let Ok(mut queue) = running_queue.lock() {
843843
if let Some(count) = queue.get_mut(worker_url) {
844844
*count = count.saturating_sub(1);
845+
gauge!("sgl_router_running_requests", "worker" => worker_url.to_string())
846+
.set(*count as f64);
845847
}
846848
}
847849
}
@@ -874,6 +876,7 @@ impl Router {
874876
let mut locked_queue = running_queue.lock().unwrap();
875877
let count = locked_queue.get_mut(&worker_url).unwrap();
876878
*count = count.saturating_sub(1);
879+
gauge!("sgl_router_running_requests", "worker" => worker_url.to_string()).set(*count as f64);
877880
debug!("Streaming is done!!")
878881
}
879882
}),

0 commit comments

Comments
 (0)