From b11ff18b7bfd168d46df5ebf787a33641ca16cfd Mon Sep 17 00:00:00 2001 From: Magdy Saleh <17618143+magdyksaleh@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:32:18 -0500 Subject: [PATCH] add num inputs to metrics (#615) --- router/src/server.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/router/src/server.rs b/router/src/server.rs index 7195ed532..4f3033c6b 100644 --- a/router/src/server.rs +++ b/router/src/server.rs @@ -1560,6 +1560,7 @@ async fn classify_batch( let start_time = Instant::now(); metrics::increment_counter!("lorax_request_count"); tracing::debug!("Inputs: {:?}", req.inputs); + let num_inputs = req.inputs.len(); let responses = infer.classify_batch(req).await?; // Timings @@ -1581,6 +1582,7 @@ async fn classify_batch( // Rust Tracing metadata span.record("total_time", format!("{total_time:?}")); + span.record("num_inputs", num_inputs); span.record("validation_time", format!("{validation_time:?}")); span.record("queue_time", format!("{queue_time:?}")); span.record("inference_time", format!("{inference_time:?}")); @@ -1608,6 +1610,7 @@ async fn classify_batch( // Metrics metrics::increment_counter!("lorax_request_success"); metrics::histogram!("lorax_request_duration", total_time.as_secs_f64()); + metrics::histogram!("lorax_request_input_count", num_inputs as f64); metrics::histogram!( "lorax_request_validation_duration", validation_time.as_secs_f64()