diff --git a/Cargo.toml b/Cargo.toml index 2c747b654..e2d355323 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tracing-actix-web" -version = "0.1.0" +version = "0.1.1" authors = ["Luca Palmieri "] edition = "2018" @@ -20,6 +20,7 @@ actix-web = "2" tracing = "0.1.19" tracing-futures = "0.2.4" futures = "0.3.5" +uuid = { version = "0.8.1", features = ["v4"] } [dev-dependencies] tracing-subscriber = { version = "0.2.12", features = ["registry", "env-filter"] } diff --git a/src/lib.rs b/src/lib.rs index a5c3b27b7..c9ba28fe7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,7 @@ use std::future::Future; use std::pin::Pin; use tracing::Span; use tracing_futures::Instrument; +use uuid::Uuid; /// `TracingLogger` is a middleware to log request and response info in a structured format. /// @@ -136,6 +137,7 @@ where request_path = %req.path(), user_agent = %user_agent, client_ip_address = %req.connection_info().remote().unwrap_or(""), + request_id = %Uuid::new_v4(), status_code = tracing::field::Empty, ); let fut = self.service.call(req);