From 6ea6d1742e600eafca81c33069de75926d84ee5b Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 31 May 2024 16:55:47 +0200 Subject: [PATCH] fix: maybe trace layer info span will help? --- upub/routes/src/lib.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/upub/routes/src/lib.rs b/upub/routes/src/lib.rs index 9904917..c62454d 100644 --- a/upub/routes/src/lib.rs +++ b/upub/routes/src/lib.rs @@ -1,11 +1,11 @@ pub mod activitypub; -#[cfg(feature = "web")] -pub mod web; - #[cfg(feature = "mastodon")] pub mod mastodon; +#[cfg(feature = "web")] +pub mod web; + pub mod builders; #[cfg(not(feature = "mastodon"))] @@ -26,7 +26,17 @@ pub async fn serve(ctx: upub::Context, bind: String) -> upub::Result<()> { .ap_routes() .mastodon_routes() // no-op if mastodon feature is disabled .layer(CorsLayer::permissive()) - .layer(TraceLayer::new_for_http()) + .layer( + TraceLayer::new_for_http() + .make_span_with(|req: &axum::http::Request<_>| { + tracing::span!( + tracing::Level::INFO, + "request", + uri = %req.uri(), + status_code = tracing::field::Empty, + ) + }) + ) .with_state(ctx); // run our app with hyper, listening locally on port 3000