ensure that request id is consistent (#677)

* ensure that request id is consistent

* remove test debug/info statements
This commit is contained in:
Adil Hafeez 2026-01-07 08:44:41 -08:00 committed by GitHub
parent b45c7aba86
commit 57327ba667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 92 additions and 28 deletions

View file

@ -157,7 +157,26 @@ async fn handle_agent_chat(
.strip_prefix("/agents")
.unwrap()
.to_string();
let request_headers = request.headers().clone();
let request_headers = {
let mut headers = request.headers().clone();
headers.remove(common::consts::ENVOY_ORIGINAL_PATH_HEADER);
if !headers.contains_key(common::consts::REQUEST_ID_HEADER) {
let request_id = uuid::Uuid::new_v4().to_string();
info!(
"Request id not found in headers, generated new request id: {}",
request_id
);
headers.insert(
common::consts::REQUEST_ID_HEADER,
hyper::header::HeaderValue::from_str(&request_id).unwrap(),
);
}
headers
};
let chat_request_bytes = request.collect().await?.to_bytes();
debug!(