Skip to content

Commit

Permalink
dont disable on_failure. the log breadcrumbs can be helpful still
Browse files Browse the repository at this point in the history
  • Loading branch information
BlinkyStitt committed Jul 15, 2023
1 parent 140dc04 commit fe672b5
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions web3_proxy/src/frontend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,28 +259,25 @@ pub async fn serve(
.layer(Extension(Arc::new(response_cache)))
// request id
.layer(
TraceLayer::new_for_http()
.make_span_with(|request: &Request<Body>| {
// We get the request id from the header
// If no header, a new Ulid is created
// TODO: move this header name to config
let request_id = request
.headers()
.get("x-amzn-trace-id")
.and_then(|x| x.to_str().ok())
.map(ToString::to_string)
.unwrap_or_else(|| Ulid::new().to_string());
TraceLayer::new_for_http().make_span_with(|request: &Request<Body>| {
// We get the request id from the header
// If no header, a new Ulid is created
// TODO: move this header name to config
let request_id = request
.headers()
.get("x-amzn-trace-id")
.and_then(|x| x.to_str().ok())
.map(ToString::to_string)
.unwrap_or_else(|| Ulid::new().to_string());

// And then we put it along with other information into the `request` span
error_span!(
"request",
id = %request_id,
// method = %request.method(),
// path = %request.uri().path(),
)
})
// TODO: on failure that has the request and response body so we can debug more easily
.on_failure(()),
// And then we put it along with other information into the `request` span
error_span!(
"request",
id = %request_id,
// method = %request.method(),
// path = %request.uri().path(),
)
}), // .on_failure(|| todo!("on failure that has the request and response body so we can debug more easily")),
)
// 404 for any unknown routes
.fallback(errors::handler_404);
Expand Down

0 comments on commit fe672b5

Please sign in to comment.