From fe672b5189a7e8b3b0797e8bb0462e63a7a8ccc3 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 14 Jul 2023 23:04:24 -0700 Subject: [PATCH] dont disable on_failure. the log breadcrumbs can be helpful still --- web3_proxy/src/frontend/mod.rs | 39 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/web3_proxy/src/frontend/mod.rs b/web3_proxy/src/frontend/mod.rs index 6c5a074a..1e2727e0 100644 --- a/web3_proxy/src/frontend/mod.rs +++ b/web3_proxy/src/frontend/mod.rs @@ -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| { - // 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| { + // 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);