diff --git a/envoyfilter/src/stream_context.rs b/envoyfilter/src/stream_context.rs index 685a42e7..5d2bdb5c 100644 --- a/envoyfilter/src/stream_context.rs +++ b/envoyfilter/src/stream_context.rs @@ -47,6 +47,8 @@ pub struct CallContext { prompt_target_name: Option, request_body: ChatCompletionsRequest, similarity_scores: Option>, + up_stream_cluster: Option, + up_stream_cluster_path: Option, } pub struct StreamContext { @@ -533,6 +535,8 @@ impl StreamContext { } }; + callout_context.up_stream_cluster = Some(endpoint.cluster); + callout_context.up_stream_cluster_path = Some(path); callout_context.response_handler_type = ResponseHandlerType::FunctionCall; if self.callouts.insert(token_id, callout_context).is_some() { panic!("duplicate token_id") @@ -542,11 +546,12 @@ impl StreamContext { fn function_call_response_handler(&mut self, body: Vec, callout_context: CallContext) { let headers = self.get_http_call_response_headers(); - debug!("response headers: {:?}", headers); if let Some(http_status) = headers.iter().find(|(key, _)| key == ":status") { if http_status.1 != StatusCode::OK.as_str() { let error_msg = format!( - "Error in function call response: status code: {}", + "Error in function call response: cluster: {}, path: {}, status code: {}", + callout_context.up_stream_cluster.unwrap(), + callout_context.up_stream_cluster_path.unwrap(), http_status.1 ); return self.send_server_error(error_msg, Some(StatusCode::BAD_REQUEST)); @@ -739,6 +744,8 @@ impl StreamContext { prompt_target_name: None, request_body: callout_context.request_body, similarity_scores: None, + up_stream_cluster: None, + up_stream_cluster_path: None, }; if self.callouts.insert(token_id, call_context).is_some() { panic!( @@ -846,6 +853,8 @@ impl HttpContext for StreamContext { prompt_target_name: None, request_body: deserialized_body, similarity_scores: None, + up_stream_cluster: None, + up_stream_cluster_path: None, }; self.get_embeddings(callout_context); return Action::Pause; @@ -867,6 +876,8 @@ impl HttpContext for StreamContext { prompt_target_name: None, request_body: deserialized_body, similarity_scores: None, + up_stream_cluster: None, + up_stream_cluster_path: None, }; self.get_embeddings(callout_context); return Action::Pause; @@ -916,6 +927,8 @@ impl HttpContext for StreamContext { prompt_target_name: None, request_body: deserialized_body, similarity_scores: None, + up_stream_cluster: None, + up_stream_cluster_path: None, }; if self.callouts.insert(token_id, call_context).is_some() { panic!( diff --git a/envoyfilter/tests/integration.rs b/envoyfilter/tests/integration.rs index 27c9fd6a..f45cde7c 100644 --- a/envoyfilter/tests/integration.rs +++ b/envoyfilter/tests/integration.rs @@ -456,7 +456,6 @@ fn request_ratelimited() { .expect_metric_increment("active_http_calls", -1) .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) .returning(Some(&body_text)) - .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Warn), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) @@ -573,7 +572,6 @@ fn request_not_ratelimited() { .expect_metric_increment("active_http_calls", -1) .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) .returning(Some(&body_text)) - .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Warn), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None)