This commit is contained in:
Bryan Stitt 2023-07-21 22:14:31 -07:00
parent 185ce7a3b4
commit 39141c1e52

@ -231,7 +231,7 @@ pub async fn serve(
.layer(NormalizePathLayer::trim_trailing_slash()) .layer(NormalizePathLayer::trim_trailing_slash())
// Mark the `Authorization` request header as sensitive so it doesn't show in logs // Mark the `Authorization` request header as sensitive so it doesn't show in logs
.layer(SetSensitiveRequestHeadersLayer::new(once(AUTHORIZATION))) .layer(SetSensitiveRequestHeadersLayer::new(once(AUTHORIZATION)))
// handle cors // handle cors. we expect queries from all sorts of places
.layer(CorsLayer::very_permissive()) .layer(CorsLayer::very_permissive())
// application state // application state
.layer(Extension(app.clone())) .layer(Extension(app.clone()))
@ -261,10 +261,12 @@ pub async fn serve(
.unwrap_or_else(|| Ulid::new().to_string()); .unwrap_or_else(|| Ulid::new().to_string());
// And then we put it along with other information into the `request` span // And then we put it along with other information into the `request` span
// TODO: what other info should we attach? how can we attach an error and a tracing span here?
error_span!( error_span!(
"request", "request",
id = %request_id, id = %request_id,
// method = %request.method(), // method = %request.method(),
// // don't log the path. it often includes the RPC key!
// path = %request.uri().path(), // path = %request.uri().path(),
) )
}), // .on_failure(|| todo!("on failure that has the request and response body so we can debug more easily")), }), // .on_failure(|| todo!("on failure that has the request and response body so we can debug more easily")),