Tiny fix missing record_router_upstream_response (#15811)

This commit is contained in:
fzyzcjy
2025-12-25 15:20:43 +08:00
committed by GitHub
parent b9af8d2eb9
commit ccf2330b28

View File

@@ -213,8 +213,18 @@ impl Router {
&self.retry_config,
// operation per attempt
|_: u32| async {
self.route_typed_request_once(headers, typed_req, route, model_id, is_stream, &info)
.await
let res = self
.route_typed_request_once(headers, typed_req, route, model_id, is_stream, &info)
.await;
// Need to be outside `route_typed_request_once` because that function has multiple return paths
Metrics::record_router_upstream_response(
metrics_labels::ROUTER_HTTP,
res.status().as_u16(),
extract_error_code_from_response(&res),
);
res
},
// should_retry predicate
|res, _attempt| is_retryable_status(res.status()),
@@ -686,6 +696,8 @@ fn convert_reqwest_error(e: reqwest::Error) -> Response {
use async_trait::async_trait;
use crate::routers::error::extract_error_code_from_response;
#[async_trait]
impl RouterTrait for Router {
fn as_any(&self) -> &dyn std::any::Any {