fix: maybe trace layer info span will help?

This commit is contained in:
əlemi 2024-05-31 16:55:47 +02:00
parent 5b592874cb
commit 6ea6d1742e
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,11 +1,11 @@
pub mod activitypub; pub mod activitypub;
#[cfg(feature = "web")]
pub mod web;
#[cfg(feature = "mastodon")] #[cfg(feature = "mastodon")]
pub mod mastodon; pub mod mastodon;
#[cfg(feature = "web")]
pub mod web;
pub mod builders; pub mod builders;
#[cfg(not(feature = "mastodon"))] #[cfg(not(feature = "mastodon"))]
@ -26,7 +26,17 @@ pub async fn serve(ctx: upub::Context, bind: String) -> upub::Result<()> {
.ap_routes() .ap_routes()
.mastodon_routes() // no-op if mastodon feature is disabled .mastodon_routes() // no-op if mastodon feature is disabled
.layer(CorsLayer::permissive()) .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); .with_state(ctx);
// run our app with hyper, listening locally on port 3000 // run our app with hyper, listening locally on port 3000