fix(logging): use Display format for model_id instead of Debug (#16337)

This commit is contained in:
Simo Lin
2026-01-03 00:21:39 -08:00
committed by GitHub
parent 9a414b164c
commit 65b0b5b248
4 changed files with 46 additions and 33 deletions
@@ -86,15 +86,16 @@ impl PipelineStage for WorkerSelectionStage {
) { ) {
Some(w) => WorkerSelection::Single { worker: w }, Some(w) => WorkerSelection::Single { worker: w },
None => { None => {
let model = ctx.input.model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID);
error!( error!(
function = "WorkerSelectionStage::execute", function = "WorkerSelectionStage::execute",
mode = "Regular", mode = "Regular",
model_id = ?ctx.input.model_id, model_id = %model,
"No available workers for model" "No available workers for model"
); );
return Err(error::service_unavailable( return Err(error::service_unavailable(
"no_available_workers", "no_available_workers",
format!("No available workers for model: {:?}", ctx.input.model_id), format!("No available workers for model: {}", model),
)); ));
} }
} }
@@ -103,18 +104,16 @@ impl PipelineStage for WorkerSelectionStage {
match self.select_pd_pair(ctx.input.model_id.as_deref(), text, tokens, headers) { match self.select_pd_pair(ctx.input.model_id.as_deref(), text, tokens, headers) {
Some((prefill, decode)) => WorkerSelection::Dual { prefill, decode }, Some((prefill, decode)) => WorkerSelection::Dual { prefill, decode },
None => { None => {
let model = ctx.input.model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID);
error!( error!(
function = "WorkerSelectionStage::execute", function = "WorkerSelectionStage::execute",
mode = "PrefillDecode", mode = "PrefillDecode",
model_id = ?ctx.input.model_id, model_id = %model,
"No available PD worker pairs for model" "No available PD worker pairs for model"
); );
return Err(error::service_unavailable( return Err(error::service_unavailable(
"no_available_pd_worker_pairs", "no_available_pd_worker_pairs",
format!( format!("No available PD worker pairs for model: {}", model),
"No available PD worker pairs for model: {:?}",
ctx.input.model_id
),
)); ));
} }
} }
@@ -8,7 +8,10 @@ use super::{context::SharedComponents, pipeline::RequestPipeline};
use crate::{ use crate::{
app_context::AppContext, app_context::AppContext,
config::types::RetryConfig, config::types::RetryConfig,
core::{is_retryable_status, ConnectionMode, RetryExecutor, WorkerRegistry, WorkerType}, core::{
is_retryable_status, ConnectionMode, RetryExecutor, WorkerRegistry, WorkerType,
UNKNOWN_MODEL_ID,
},
observability::metrics::{metrics_labels, Metrics}, observability::metrics::{metrics_labels, Metrics},
protocols::{chat::ChatCompletionRequest, generate::GenerateRequest}, protocols::{chat::ChatCompletionRequest, generate::GenerateRequest},
routers::RouterTrait, routers::RouterTrait,
@@ -77,8 +80,8 @@ impl GrpcPDRouter {
model_id: Option<&str>, model_id: Option<&str>,
) -> Response { ) -> Response {
debug!( debug!(
"Processing generate request for model: {:?} (PD mode)", "Processing generate request for model: {} (PD mode)",
model_id model_id.unwrap_or(UNKNOWN_MODEL_ID)
); );
// Clone values needed for retry closure // Clone values needed for retry closure
@@ -135,8 +138,8 @@ impl GrpcPDRouter {
model_id: Option<&str>, model_id: Option<&str>,
) -> Response { ) -> Response {
debug!( debug!(
"Processing chat completion request for model: {:?} (PD mode)", "Processing chat completion request for model: {} (PD mode)",
model_id model_id.unwrap_or(UNKNOWN_MODEL_ID)
); );
// Clone values needed for retry closure // Clone values needed for retry closure
+13 -13
View File
@@ -29,7 +29,7 @@ use super::{
utils::error_type_from_status, utils::error_type_from_status,
}; };
use crate::{ use crate::{
core::WorkerRegistry, core::{WorkerRegistry, UNKNOWN_MODEL_ID},
observability::metrics::{bool_to_static_str, metrics_labels, Metrics}, observability::metrics::{bool_to_static_str, metrics_labels, Metrics},
policies::PolicyRegistry, policies::PolicyRegistry,
protocols::{ protocols::{
@@ -475,8 +475,8 @@ impl RequestPipeline {
components: Arc<SharedComponents>, components: Arc<SharedComponents>,
) -> Response { ) -> Response {
debug!( debug!(
"execute_embeddings: Starting execution for model: {:?}", "execute_embeddings: Starting execution for model: {}",
model_id model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID)
); );
let start = Instant::now(); let start = Instant::now();
@@ -485,7 +485,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS, metrics_labels::ENDPOINT_EMBEDDINGS,
bool_to_static_str(false), bool_to_static_str(false),
); );
@@ -504,7 +504,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS, metrics_labels::ENDPOINT_EMBEDDINGS,
start.elapsed(), start.elapsed(),
); );
@@ -527,7 +527,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS, metrics_labels::ENDPOINT_EMBEDDINGS,
error_type_from_status(response.status()), error_type_from_status(response.status()),
); );
@@ -548,7 +548,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS, metrics_labels::ENDPOINT_EMBEDDINGS,
start.elapsed(), start.elapsed(),
); );
@@ -581,8 +581,8 @@ impl RequestPipeline {
components: Arc<SharedComponents>, components: Arc<SharedComponents>,
) -> Response { ) -> Response {
debug!( debug!(
"execute_classify: Starting execution for model: {:?}", "execute_classify: Starting execution for model: {}",
model_id model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID)
); );
let start = Instant::now(); let start = Instant::now();
@@ -591,7 +591,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY, metrics_labels::ENDPOINT_CLASSIFY,
bool_to_static_str(false), // Classify is never streaming bool_to_static_str(false), // Classify is never streaming
); );
@@ -610,7 +610,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY, metrics_labels::ENDPOINT_CLASSIFY,
start.elapsed(), start.elapsed(),
); );
@@ -633,7 +633,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY, metrics_labels::ENDPOINT_CLASSIFY,
error_type_from_status(response.status()), error_type_from_status(response.status()),
); );
@@ -653,7 +653,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC, metrics_labels::ROUTER_GRPC,
self.backend_type, self.backend_type,
metrics_labels::CONNECTION_GRPC, metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"), model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY, metrics_labels::ENDPOINT_CLASSIFY,
start.elapsed(), start.elapsed(),
); );
+19 -8
View File
@@ -23,7 +23,7 @@ use super::{
use crate::{ use crate::{
app_context::AppContext, app_context::AppContext,
config::types::RetryConfig, config::types::RetryConfig,
core::{is_retryable_status, RetryExecutor, WorkerRegistry}, core::{is_retryable_status, RetryExecutor, WorkerRegistry, UNKNOWN_MODEL_ID},
observability::metrics::{metrics_labels, Metrics}, observability::metrics::{metrics_labels, Metrics},
protocols::{ protocols::{
chat::ChatCompletionRequest, chat::ChatCompletionRequest,
@@ -154,8 +154,9 @@ impl GrpcRouter {
HarmonyDetector::is_harmony_model_in_registry(&self.worker_registry, &body.model); HarmonyDetector::is_harmony_model_in_registry(&self.worker_registry, &body.model);
debug!( debug!(
"Processing chat completion request for model: {:?}, using_harmony={}", "Processing chat completion request for model: {}, using_harmony={}",
model_id, is_harmony model_id.unwrap_or(UNKNOWN_MODEL_ID),
is_harmony
); );
let pipeline = if is_harmony { let pipeline = if is_harmony {
@@ -212,7 +213,10 @@ impl GrpcRouter {
body: &GenerateRequest, body: &GenerateRequest,
model_id: Option<&str>, model_id: Option<&str>,
) -> Response { ) -> Response {
debug!("Processing generate request for model: {:?}", model_id); debug!(
"Processing generate request for model: {}",
model_id.unwrap_or(UNKNOWN_MODEL_ID)
);
// Clone values needed for retry closure // Clone values needed for retry closure
let request = Arc::new(body.clone()); let request = Arc::new(body.clone());
@@ -280,8 +284,9 @@ impl GrpcRouter {
if is_harmony { if is_harmony {
debug!( debug!(
"Processing Harmony responses request for model: {:?}, streaming: {:?}", "Processing Harmony responses request for model: {}, streaming: {}",
model_id, body.stream model_id.unwrap_or(UNKNOWN_MODEL_ID),
body.stream.unwrap_or(false)
); );
let harmony_ctx = HarmonyResponsesContext::new( let harmony_ctx = HarmonyResponsesContext::new(
Arc::new(self.harmony_pipeline.clone()), Arc::new(self.harmony_pipeline.clone()),
@@ -320,7 +325,10 @@ impl GrpcRouter {
body: &EmbeddingRequest, body: &EmbeddingRequest,
model_id: Option<&str>, model_id: Option<&str>,
) -> Response { ) -> Response {
debug!("Processing embedding request for model: {:?}", model_id); debug!(
"Processing embedding request for model: {}",
model_id.unwrap_or(UNKNOWN_MODEL_ID)
);
self.embedding_pipeline self.embedding_pipeline
.execute_embeddings( .execute_embeddings(
@@ -339,7 +347,10 @@ impl GrpcRouter {
body: &ClassifyRequest, body: &ClassifyRequest,
model_id: Option<&str>, model_id: Option<&str>,
) -> Response { ) -> Response {
debug!("Processing classify request for model: {:?}", model_id); debug!(
"Processing classify request for model: {}",
model_id.unwrap_or(UNKNOWN_MODEL_ID)
);
self.classify_pipeline self.classify_pipeline
.execute_classify( .execute_classify(