From a7127e99bc5ced359c5ff78f8692cffab97eea94 Mon Sep 17 00:00:00 2001 From: Spencer Ferris <3319370+spencewenski@users.noreply.github.com> Date: Mon, 22 Jul 2024 00:16:54 -0700 Subject: [PATCH] chore: Update dependencies (#279) --- Cargo.toml | 18 +++++++++--------- examples/full/Cargo.toml | 6 +++--- examples/leptos-ssr/Cargo.toml | 1 - src/tracing/mod.rs | 27 +++++++++++++++++---------- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c1894592..370a9b67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,11 +37,11 @@ dotenvy = "0.15.5" # Tracing tracing = { workspace = true } tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] } -opentelemetry-semantic-conventions = "0.15.0" -opentelemetry = { version = "0.23.0", features = ["trace", "metrics", "logs"], optional = true } -opentelemetry_sdk = { version = "0.23.0", features = ["tokio", "rt-tokio", "metrics", "logs", "trace"], optional = true } -opentelemetry-otlp = { version = "0.16.0", features = ["metrics", "trace", "logs"], optional = true } -tracing-opentelemetry = { version = "0.24.0", features = ["metrics"], optional = true } +opentelemetry-semantic-conventions = "0.16.0" +opentelemetry = { version = "0.24.0", features = ["trace", "metrics", "logs"], optional = true } +opentelemetry_sdk = { version = "0.24.1", features = ["tokio", "rt-tokio", "metrics", "logs", "trace"], optional = true } +opentelemetry-otlp = { version = "0.17.0", features = ["metrics", "trace", "logs"], optional = true } +tracing-opentelemetry = { version = "0.25.0", features = ["metrics"], optional = true } # Controllers # `axum` is not optional because we use the `FromRef` trait pretty extensively, even in parts of @@ -98,7 +98,7 @@ chrono = { version = "0.4.34", features = ["serde"] } byte-unit = { version = "5.0.0", features = ["serde"] } convert_case = "0.6.0" const_format = "0.2.30" -typed-builder = "0.18.0" +typed-builder = "0.19.0" num-traits = "0.2.14" validator = { version = "0.18.0", features = ["derive"] } thiserror = "1.0.38" @@ -109,7 +109,7 @@ time = "0.3.36" [dev-dependencies] cargo-husky = { version = "1.5.0", default-features = false, features = ["user-hooks"] } insta = { workspace = true } -mockall = "0.12.1" +mockall = "0.13.0" mockall_double = "0.3.1" rstest = { workspace = true } @@ -130,7 +130,7 @@ schemars = "0.8.16" clap = { version = "4.3.0", features = ["derive"] } # gRPC -tonic = { version = "0.11.0" } +tonic = { version = "0.12.0" } # Sidekiq # Todo: the default `rss-stats` feature has a dependency that currently can't be satisfied (memchr: ~2.3) @@ -142,7 +142,7 @@ rstest = { version = "0.21.0" } # Others # Todo: minimize tokio features included in `roadster` -tokio = { version = "1.28.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } # For CancellationToken tokio-util = { version = "0.7.10" } anyhow = "1.0.69" diff --git a/examples/full/Cargo.toml b/examples/full/Cargo.toml index 159902b1..8610c6d2 100644 --- a/examples/full/Cargo.toml +++ b/examples/full/Cargo.toml @@ -25,8 +25,8 @@ schemars = { workspace = true } # gRPC API tonic = { workspace = true, optional = true } -tonic-reflection = { version = "0.11.0", optional = true } -prost = { version = "0.12", optional = true } +tonic-reflection = { version = "0.12.0", optional = true } +prost = { version = "0.13", optional = true } # DB entity = { path = "entity" } @@ -38,7 +38,7 @@ rusty-sidekiq = { version = "0.10.5", default-features = false } serde = { workspace = true, features = ["derive"] } [build-dependencies] -tonic-build = "0.11" +tonic-build = "0.12" vergen = { version = "8.0.0", features = ["git", "gitcl"] } [[bin]] diff --git a/examples/leptos-ssr/Cargo.toml b/examples/leptos-ssr/Cargo.toml index b0a965a9..98729779 100644 --- a/examples/leptos-ssr/Cargo.toml +++ b/examples/leptos-ssr/Cargo.toml @@ -51,7 +51,6 @@ leptos_config = { version = "0.6.3" } tower = "0.4.13" tower-http = { version = "0.5", features = ["fs"], optional = true } wasm-bindgen = "=0.2.92" -http = "1" # Defines a size-optimized profile for the WASM bundle in release mode # Commented out here because profiles are ignored for packages that aren't the workspace root diff --git a/src/tracing/mod.rs b/src/tracing/mod.rs index 4d4df190..9bb3ced0 100644 --- a/src/tracing/mod.rs +++ b/src/tracing/mod.rs @@ -4,6 +4,8 @@ use crate::app::metadata::AppMetadata; #[cfg(feature = "otel")] use convert_case::{Case, Casing}; #[cfg(feature = "otel")] +use opentelemetry::trace::TracerProvider; +#[cfg(feature = "otel")] use opentelemetry_otlp::WithExportConfig; #[cfg(feature = "otel")] use opentelemetry_sdk::metrics::reader::{DefaultAggregationSelector, DefaultTemporalitySelector}; @@ -74,15 +76,19 @@ pub fn init_tracing( } #[cfg(feature = "otel")] - let otel_resource = { - let service_name = config - .tracing - .service_name - .clone() - .or(metadata.name.clone()) - .unwrap_or(config.app.name.to_case(Case::Snake)); + let service_name = config + .tracing + .service_name + .clone() + .or(metadata.name.clone()) + .unwrap_or(config.app.name.to_case(Case::Snake)); - let mut resource_metadata = vec![opentelemetry::KeyValue::new(SERVICE_NAME, service_name)]; + #[cfg(feature = "otel")] + let otel_resource = { + let mut resource_metadata = vec![opentelemetry::KeyValue::new( + SERVICE_NAME, + service_name.clone(), + )]; if let Some(version) = metadata.version.clone() { resource_metadata.push(opentelemetry::KeyValue::new(SERVICE_VERSION, version)) @@ -102,9 +108,10 @@ pub fn init_tracing( .with_endpoint(otlp_endpoint.to_string()), ) .with_trace_config( - opentelemetry_sdk::trace::config().with_resource(otel_resource.clone()), + opentelemetry_sdk::trace::Config::default().with_resource(otel_resource.clone()), ) - .install_batch(Tokio)?; + .install_batch(Tokio)? + .tracer(service_name); // Create a tracing layer with the configured tracer Some(tracing_opentelemetry::layer().with_tracer(otlp_tracer)) } else {