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

View File

@@ -86,15 +86,16 @@ impl PipelineStage for WorkerSelectionStage {
) {
Some(w) => WorkerSelection::Single { worker: w },
None => {
let model = ctx.input.model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID);
error!(
function = "WorkerSelectionStage::execute",
mode = "Regular",
model_id = ?ctx.input.model_id,
model_id = %model,
"No available workers for model"
);
return Err(error::service_unavailable(
"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) {
Some((prefill, decode)) => WorkerSelection::Dual { prefill, decode },
None => {
let model = ctx.input.model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID);
error!(
function = "WorkerSelectionStage::execute",
mode = "PrefillDecode",
model_id = ?ctx.input.model_id,
model_id = %model,
"No available PD worker pairs for model"
);
return Err(error::service_unavailable(
"no_available_pd_worker_pairs",
format!(
"No available PD worker pairs for model: {:?}",
ctx.input.model_id
),
format!("No available PD worker pairs for model: {}", model),
));
}
}

View File

@@ -8,7 +8,10 @@ use super::{context::SharedComponents, pipeline::RequestPipeline};
use crate::{
app_context::AppContext,
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},
protocols::{chat::ChatCompletionRequest, generate::GenerateRequest},
routers::RouterTrait,
@@ -77,8 +80,8 @@ impl GrpcPDRouter {
model_id: Option<&str>,
) -> Response {
debug!(
"Processing generate request for model: {:?} (PD mode)",
model_id
"Processing generate request for model: {} (PD mode)",
model_id.unwrap_or(UNKNOWN_MODEL_ID)
);
// Clone values needed for retry closure
@@ -135,8 +138,8 @@ impl GrpcPDRouter {
model_id: Option<&str>,
) -> Response {
debug!(
"Processing chat completion request for model: {:?} (PD mode)",
model_id
"Processing chat completion request for model: {} (PD mode)",
model_id.unwrap_or(UNKNOWN_MODEL_ID)
);
// Clone values needed for retry closure

View File

@@ -29,7 +29,7 @@ use super::{
utils::error_type_from_status,
};
use crate::{
core::WorkerRegistry,
core::{WorkerRegistry, UNKNOWN_MODEL_ID},
observability::metrics::{bool_to_static_str, metrics_labels, Metrics},
policies::PolicyRegistry,
protocols::{
@@ -475,8 +475,8 @@ impl RequestPipeline {
components: Arc<SharedComponents>,
) -> Response {
debug!(
"execute_embeddings: Starting execution for model: {:?}",
model_id
"execute_embeddings: Starting execution for model: {}",
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID)
);
let start = Instant::now();
@@ -485,7 +485,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS,
bool_to_static_str(false),
);
@@ -504,7 +504,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS,
start.elapsed(),
);
@@ -527,7 +527,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS,
error_type_from_status(response.status()),
);
@@ -548,7 +548,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_EMBEDDINGS,
start.elapsed(),
);
@@ -581,8 +581,8 @@ impl RequestPipeline {
components: Arc<SharedComponents>,
) -> Response {
debug!(
"execute_classify: Starting execution for model: {:?}",
model_id
"execute_classify: Starting execution for model: {}",
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID)
);
let start = Instant::now();
@@ -591,7 +591,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY,
bool_to_static_str(false), // Classify is never streaming
);
@@ -610,7 +610,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY,
start.elapsed(),
);
@@ -633,7 +633,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY,
error_type_from_status(response.status()),
);
@@ -653,7 +653,7 @@ impl RequestPipeline {
metrics_labels::ROUTER_GRPC,
self.backend_type,
metrics_labels::CONNECTION_GRPC,
model_id.as_deref().unwrap_or("unknown"),
model_id.as_deref().unwrap_or(UNKNOWN_MODEL_ID),
metrics_labels::ENDPOINT_CLASSIFY,
start.elapsed(),
);

View File

@@ -23,7 +23,7 @@ use super::{
use crate::{
app_context::AppContext,
config::types::RetryConfig,
core::{is_retryable_status, RetryExecutor, WorkerRegistry},
core::{is_retryable_status, RetryExecutor, WorkerRegistry, UNKNOWN_MODEL_ID},
observability::metrics::{metrics_labels, Metrics},
protocols::{
chat::ChatCompletionRequest,
@@ -154,8 +154,9 @@ impl GrpcRouter {
HarmonyDetector::is_harmony_model_in_registry(&self.worker_registry, &body.model);
debug!(
"Processing chat completion request for model: {:?}, using_harmony={}",
model_id, is_harmony
"Processing chat completion request for model: {}, using_harmony={}",
model_id.unwrap_or(UNKNOWN_MODEL_ID),
is_harmony
);
let pipeline = if is_harmony {
@@ -212,7 +213,10 @@ impl GrpcRouter {
body: &GenerateRequest,
model_id: Option<&str>,
) -> 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
let request = Arc::new(body.clone());
@@ -280,8 +284,9 @@ impl GrpcRouter {
if is_harmony {
debug!(
"Processing Harmony responses request for model: {:?}, streaming: {:?}",
model_id, body.stream
"Processing Harmony responses request for model: {}, streaming: {}",
model_id.unwrap_or(UNKNOWN_MODEL_ID),
body.stream.unwrap_or(false)
);
let harmony_ctx = HarmonyResponsesContext::new(
Arc::new(self.harmony_pipeline.clone()),
@@ -320,7 +325,10 @@ impl GrpcRouter {
body: &EmbeddingRequest,
model_id: Option<&str>,
) -> 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
.execute_embeddings(
@@ -339,7 +347,10 @@ impl GrpcRouter {
body: &ClassifyRequest,
model_id: Option<&str>,
) -> 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
.execute_classify(