diff --git a/bottlecap/src/traces/trace_agent.rs b/bottlecap/src/traces/trace_agent.rs index 4035e24e8..6ad5c00cc 100644 --- a/bottlecap/src/traces/trace_agent.rs +++ b/bottlecap/src/traces/trace_agent.rs @@ -659,7 +659,7 @@ impl TraceAgent { let (parts, body) = match extract_request_body(request).await { Ok(r) => r, Err(e) => { - return error_response( + return warn_response( StatusCode::INTERNAL_SERVER_ERROR, format!("TRACE_AGENT | handle_proxy | Error extracting request body: {e}"), ); @@ -721,6 +721,13 @@ fn error_response(status: StatusCode, error: E) -> Respons (status, error.to_string()).into_response() } +/// Like [`error_response`], but logs at WARN level. Use when the failure is caused by an +/// external event (e.g. client disconnected) rather than a bug in the extension itself. +fn warn_response(status: StatusCode, error: E) -> Response { + warn!("{}", error); + (status, error.to_string()).into_response() +} + fn success_response(message: &str) -> Response { debug!("{}", message); (StatusCode::OK, json!({"rate_by_service": {}}).to_string()).into_response()