[router] consolidate worker get loads (#10880)

This commit is contained in:
Simo Lin
2025-09-24 22:13:31 -04:00
committed by GitHub
parent fe531d6f4e
commit e738703547
10 changed files with 157 additions and 280 deletions

View File

@@ -508,30 +508,6 @@ impl RouterTrait for RouterManager {
}
}
async fn get_worker_loads(&self) -> Response {
let workers = self.worker_registry.get_all();
let loads: Vec<serde_json::Value> = workers
.iter()
.map(|w| {
serde_json::json!({
"url": w.url(),
"model": w.model_id(),
"load": w.load(),
"is_healthy": w.is_healthy()
})
})
.collect();
(
StatusCode::OK,
serde_json::json!({
"workers": loads
})
.to_string(),
)
.into_response()
}
fn router_type(&self) -> &'static str {
"manager"
}