Skip to content

Commit

Permalink
Build error string outside of span.record
Browse files Browse the repository at this point in the history
This is a workaround for tokio-rs/tracing#1565
  • Loading branch information
asonix committed Sep 18, 2021
1 parent e425264 commit 51e7911
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/root_span_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ impl RootSpanBuilder for DefaultRootSpanBuilder {

fn handle_error(span: Span, error: &actix_web::Error) {
let response_error = error.as_response_error();
span.record(
"exception.message",
&tracing::field::display(response_error),
);
span.record("exception.details", &tracing::field::debug(response_error));
let display = format!("{}", response_error);
let debug = format!("{:?}", response_error);
span.record("exception.message", &tracing::field::display(display));
span.record("exception.details", &tracing::field::display(debug));
let status_code = response_error.status_code();
span.record("http.status_code", &status_code.as_u16());

Expand Down

0 comments on commit 51e7911

Please sign in to comment.