Skip to content

Commit 50fca62

Browse files
authored
chore: Improve trace agent error message (#900)
# This PR Add some details to trace agent error messages. # Motivation #899 mentions the error log: ``` DD_EXTENSION | ERROR | Failed to buffer the request body: length limit exceeded ``` This error message is probably from Rust, not from our extension, and it's hard to pinpoint where it's logged. My hypothesis is it's from the two places touched by this PR. Let's add details to the log messages so if someone sees the same error again, we know where it's from.
1 parent ac00d97 commit 50fca62

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

bottlecap/src/traces/trace_agent.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,12 @@ impl TraceAgent {
433433
) -> Response {
434434
let (parts, body) = match extract_request_body(request).await {
435435
Ok(r) => r,
436-
Err(e) => return error_response(StatusCode::INTERNAL_SERVER_ERROR, e),
436+
Err(e) => {
437+
return error_response(
438+
StatusCode::INTERNAL_SERVER_ERROR,
439+
format!("TRACE_AGENT | handle_traces | Error extracting request body: {e}"),
440+
);
441+
}
437442
};
438443

439444
if let Some(content_length) = parts
@@ -551,7 +556,12 @@ impl TraceAgent {
551556
debug!("TRACE_AGENT | Proxied request for {context}");
552557
let (parts, body) = match extract_request_body(request).await {
553558
Ok(r) => r,
554-
Err(e) => return error_response(StatusCode::INTERNAL_SERVER_ERROR, e),
559+
Err(e) => {
560+
return error_response(
561+
StatusCode::INTERNAL_SERVER_ERROR,
562+
format!("TRACE_AGENT | handle_proxy | Error extracting request body: {e}"),
563+
);
564+
}
555565
};
556566

557567
let target_url = format!("https://{}.{}{}", backend_domain, config.site, backend_path);

0 commit comments

Comments
 (0)