Skip to content
Merged
Changes from all commits
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
9 changes: 8 additions & 1 deletion bottlecap/src/traces/trace_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"),
);
Expand Down Expand Up @@ -721,6 +721,13 @@ fn error_response<E: std::fmt::Display>(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<E: std::fmt::Display>(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()
Expand Down
Loading