From cf74b7bad8e6ab807819332eb9066081a7c09f7e Mon Sep 17 00:00:00 2001 From: jrconlin Date: Tue, 8 Aug 2023 14:18:46 -0700 Subject: [PATCH 1/2] chore: Update to 0.8.0 Update all sub crates to same core version. Update library crates to latest version. Address clippy issues in middleware. --- Cargo.toml | 5 +++++ actix-web-location/Cargo.toml | 11 ++++++----- mozsvc-common/Cargo.toml | 6 +++--- tracing-actix-web-mozlog/Cargo.toml | 10 +++++----- tracing-actix-web-mozlog/src/middleware.rs | 12 ++++++------ 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3c6312b..5cdce48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,8 @@ members = [ "tracing-actix-web-mozlog", "actix-web-location", ] + +[workspace.package] +version = "0.8.0" +license = "MPL-2.0" +edition = "2021" \ No newline at end of file diff --git a/actix-web-location/Cargo.toml b/actix-web-location/Cargo.toml index 728fd76..5aad708 100644 --- a/actix-web-location/Cargo.toml +++ b/actix-web-location/Cargo.toml @@ -1,12 +1,13 @@ [package] + name = "actix-web-location" -version = "0.7.0" description = "A extensible crate to provide location determination for actix-web, using GeoIP or other techniques" -license = "MPL-2.0" -edition = "2021" documentation = "https://docs.rs/actix-web-location" repository = "https://github.com/mozilla-services/common-rs" homepage = "https://github.com/mozilla-services/common-rs/tree/master/actix-web-location" +version.workspace = true +edition.workspace = true +license.workspace = true [package.metadata.docs.rs] # features that docs.rs will build with @@ -22,7 +23,7 @@ thiserror = "1" anyhow = "1" async-trait = "0.1" lazy_static = "1" -maxminddb = { version = "0.22", optional = true} +maxminddb = { version = "0.23", optional = true} cadence = { version = "0.29", optional = true} [features] @@ -34,7 +35,7 @@ actix-web-v4 = ["actix-web-4"] [dev_dependencies] actix-rt = "2.2" actix-web-4 = { package = "actix-web", version = "4" } -maxminddb = "0.22" +maxminddb = "0.23" [[example]] name = "maxmind" diff --git a/mozsvc-common/Cargo.toml b/mozsvc-common/Cargo.toml index 35320fc..a7168eb 100644 --- a/mozsvc-common/Cargo.toml +++ b/mozsvc-common/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "mozsvc-common" -version = "0.2.0" authors = ["Philip Jenvey "] description = "Common utilities for Mozilla server side apps" repository = "https://github.com/mozilla-services/common-rs/" homepage = "https://github.com/mozilla-services/common-rs/" -license = "MPL-2.0" -edition = "2021" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] lazy_static = "1.0" diff --git a/tracing-actix-web-mozlog/Cargo.toml b/tracing-actix-web-mozlog/Cargo.toml index d08e6cd..590fd96 100644 --- a/tracing-actix-web-mozlog/Cargo.toml +++ b/tracing-actix-web-mozlog/Cargo.toml @@ -1,22 +1,22 @@ [package] name = "tracing-actix-web-mozlog" description = "Support for tracing in actix-web apps that target Mozilla's MozLog" -license = "MPL-2.0" version = "0.5.0" -edition = "2021" documentation = "https://docs.rs/tracing-actix-web-mozlog" repository = "https://github.com/mozilla-services/common-rs" homepage = "https://github.com/mozilla-services/common-rs/tree/master/tracing-actix-web-mozlog" +license.workspace = true +edition.workspace = true [dependencies] -gethostname = "^0.2" +gethostname = "^0.4" serde = { version = "^1", features = ["derive"] } serde_json = "^1" tracing = "^0.1" tracing-bunyan-formatter = "^0.3" tracing-subscriber = "^0.3" actix-web = { version = "4", default-features = false } -tracing-actix-web = { version = "0.5", default-features = false } +tracing-actix-web = { version = "0.7", default-features = false } futures-util = "^0.3" tracing-futures = { version = "^0.2", features = ["std-future"] } @@ -24,6 +24,6 @@ tracing-futures = { version = "^0.2", features = ["std-future"] } actix-web = { version = "4", default-features = false, features = ["macros"] } maplit = "^1" pretty_assertions = "^1.2" -jsonschema = "^0.15" +jsonschema = "^0.17" lazy_static = "^1.4" actix-rt = "^2.2.0" diff --git a/tracing-actix-web-mozlog/src/middleware.rs b/tracing-actix-web-mozlog/src/middleware.rs index d7db4a8..5df5d25 100644 --- a/tracing-actix-web-mozlog/src/middleware.rs +++ b/tracing-actix-web-mozlog/src/middleware.rs @@ -172,7 +172,7 @@ impl RootSpanBuilder for MozLogRootSpanBuilder { ); if let Some(user_agent) = request.headers().get("User-Agent") { - span.record("agent", &user_agent.to_str().unwrap_or("")); + span.record("agent", user_agent.to_str().unwrap_or("")); } span @@ -183,14 +183,14 @@ impl RootSpanBuilder for MozLogRootSpanBuilder { Ok(response) => { if let Some(req_start) = response.request().extensions().get::() { let elapsed = req_start.0.elapsed(); - span.record("t", &(elapsed.as_millis() as u32)); - span.record("t_ns", &(elapsed.as_nanos() as u64)); + span.record("t", elapsed.as_millis() as u32); + span.record("t_ns", elapsed.as_nanos() as u64); } if let Some(error) = response.response().error() { handle_error(span, error); } else { - span.record("code", &response.response().status().as_u16()); + span.record("code", response.response().status().as_u16()); response.status(); } } @@ -205,7 +205,7 @@ impl RootSpanBuilder for MozLogRootSpanBuilder { fn handle_error(span: Span, error: &actix_web::Error) { let response_error = error.as_response_error(); let status = response_error.status_code(); - span.record("errno", &1); + span.record("errno", 1); span.record("msg", &tracing::field::display(response_error)); - span.record("code", &status.as_u16()); + span.record("code", status.as_u16()); } From 3d30a69a707183a7ae48c6722a202ee16d172070 Mon Sep 17 00:00:00 2001 From: jrconlin Date: Tue, 8 Aug 2023 14:38:55 -0700 Subject: [PATCH 2/2] f revert single version --- actix-web-location/Cargo.toml | 2 +- mozsvc-common/Cargo.toml | 2 +- tracing-actix-web-mozlog/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actix-web-location/Cargo.toml b/actix-web-location/Cargo.toml index 5aad708..76918b7 100644 --- a/actix-web-location/Cargo.toml +++ b/actix-web-location/Cargo.toml @@ -5,7 +5,7 @@ description = "A extensible crate to provide location determination for actix-we documentation = "https://docs.rs/actix-web-location" repository = "https://github.com/mozilla-services/common-rs" homepage = "https://github.com/mozilla-services/common-rs/tree/master/actix-web-location" -version.workspace = true +version = "0.8.0" edition.workspace = true license.workspace = true diff --git a/mozsvc-common/Cargo.toml b/mozsvc-common/Cargo.toml index a7168eb..2a65b30 100644 --- a/mozsvc-common/Cargo.toml +++ b/mozsvc-common/Cargo.toml @@ -4,7 +4,7 @@ authors = ["Philip Jenvey "] description = "Common utilities for Mozilla server side apps" repository = "https://github.com/mozilla-services/common-rs/" homepage = "https://github.com/mozilla-services/common-rs/" -version.workspace = true +version = "0.2.0" edition.workspace = true license.workspace = true diff --git a/tracing-actix-web-mozlog/Cargo.toml b/tracing-actix-web-mozlog/Cargo.toml index 590fd96..1eac1b8 100644 --- a/tracing-actix-web-mozlog/Cargo.toml +++ b/tracing-actix-web-mozlog/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tracing-actix-web-mozlog" description = "Support for tracing in actix-web apps that target Mozilla's MozLog" -version = "0.5.0" +version = "0.5.1" documentation = "https://docs.rs/tracing-actix-web-mozlog" repository = "https://github.com/mozilla-services/common-rs" homepage = "https://github.com/mozilla-services/common-rs/tree/master/tracing-actix-web-mozlog"