Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include prompt and generated tokens as part of logs #574

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,15 @@ async fn generate(
let inference_time = Instant::now() - response.start;
let time_per_token = inference_time / response.generated_text.generated_tokens;

// Tracing metadata
// Rust Tracing metadata
span.record("total_time", format!("{total_time:?}"));
span.record("validation_time", format!("{validation_time:?}"));
span.record("queue_time", format!("{queue_time:?}"));
span.record("inference_time", format!("{inference_time:?}"));
span.record("time_per_token", format!("{time_per_token:?}"));
span.record("seed", format!("{:?}", response.generated_text.seed));
span.record("prompt_tokens", format!("{prompt_tokens:?}"));
span.record("generated_tokens", format!("{generated_tokens:?}"));

// Headers
let mut headers = HeaderMap::new();
Expand Down Expand Up @@ -849,6 +851,8 @@ async fn generate_stream_with_callback(
span.record("inference_time", format!("{inference_time:?}"));
span.record("time_per_token", format!("{time_per_token:?}"));
span.record("seed", format!("{:?}", generated_text.seed));
span.record("prompt_tokens", format!("{prompt_tokens:?}"));
span.record("generated_tokens", format!("{generated_tokens:?}"));

// Metrics
metrics::increment_counter!("lorax_request_success");
Expand Down
Loading