From fea2ea6d2cf4f3f68e4779e53b82120806748d7b Mon Sep 17 00:00:00 2001 From: Nishant Joshi Date: Tue, 21 May 2024 19:48:34 +0530 Subject: [PATCH] chore: move tracing to workspace deps and remove router_env as a dependency of redis_interface (#4717) --- Cargo.lock | 2 +- Cargo.toml | 3 +++ crates/redis_interface/Cargo.toml | 2 +- crates/redis_interface/src/commands.rs | 4 ++-- crates/redis_interface/src/lib.rs | 7 +++---- crates/router_env/Cargo.toml | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4d3175461..89a0d9d507 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5420,11 +5420,11 @@ dependencies = [ "error-stack", "fred", "futures 0.3.30", - "router_env", "serde", "thiserror", "tokio 1.37.0", "tokio-stream", + "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 82687a32ba..fc2095275d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,9 @@ package.edition = "2021" package.rust-version = "1.70" package.license = "Apache-2.0" +[workspace.dependencies] +tracing = { version = "0.1.40" } + [profile.release] strip = true lto = true diff --git a/crates/redis_interface/Cargo.toml b/crates/redis_interface/Cargo.toml index 1fb74be79d..d55ff86bce 100644 --- a/crates/redis_interface/Cargo.toml +++ b/crates/redis_interface/Cargo.toml @@ -15,10 +15,10 @@ serde = { version = "1.0.197", features = ["derive"] } thiserror = "1.0.58" tokio = "1.37.0" tokio-stream = {version = "0.1.15", features = ["sync"]} +tracing = { workspace = true } # First party crates common_utils = { version = "0.1.0", path = "../common_utils", features = ["async_ext"] } -router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] } [dev-dependencies] tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs index 46e3a35fd3..504820822c 100644 --- a/crates/redis_interface/src/commands.rs +++ b/crates/redis_interface/src/commands.rs @@ -23,7 +23,7 @@ use fred::{ }, }; use futures::StreamExt; -use router_env::{instrument, logger, tracing}; +use tracing::instrument; use crate::{ errors, @@ -379,7 +379,7 @@ impl super::RedisConnectionPool { Some(futures::stream::iter(v)) } Err(err) => { - logger::error!(?err); + tracing::error!(?err); None } } diff --git a/crates/redis_interface/src/lib.rs b/crates/redis_interface/src/lib.rs index 0ab1ea394c..df74d72833 100644 --- a/crates/redis_interface/src/lib.rs +++ b/crates/redis_interface/src/lib.rs @@ -26,7 +26,6 @@ use common_utils::errors::CustomResult; use error_stack::ResultExt; pub use fred::interfaces::PubsubInterface; use fred::{interfaces::ClientLike, prelude::EventInterface}; -use router_env::logger; pub use self::types::*; @@ -189,10 +188,10 @@ impl RedisConnectionPool { let mut error_rx = futures::stream::select_all(error_rxs); loop { if let Some(Ok(error)) = error_rx.next().await { - logger::error!(?error, "Redis protocol or connection error"); + tracing::error!(?error, "Redis protocol or connection error"); if self.pool.state() == fred::types::ClientState::Disconnected { if tx.send(()).is_err() { - logger::error!("The redis shutdown signal sender failed to signal"); + tracing::error!("The redis shutdown signal sender failed to signal"); } self.is_redis_available .store(false, atomic::Ordering::SeqCst); @@ -205,7 +204,7 @@ impl RedisConnectionPool { pub async fn on_unresponsive(&self) { let _ = self.pool.clients().iter().map(|client| { client.on_unresponsive(|server| { - logger::warn!(redis_server =?server.host, "Redis server is unresponsive"); + tracing::warn!(redis_server =?server.host, "Redis server is unresponsive"); Ok(()) }) }); diff --git a/crates/router_env/Cargo.toml b/crates/router_env/Cargo.toml index 3b95d5f22f..b9b1184fed 100644 --- a/crates/router_env/Cargo.toml +++ b/crates/router_env/Cargo.toml @@ -22,7 +22,7 @@ serde_path_to_error = "0.1.16" strum = { version = "0.26.2", features = ["derive"] } time = { version = "0.3.35", default-features = false, features = ["formatting"] } tokio = { version = "1.37.0" } -tracing = { version = "0.1.40" } +tracing = { workspace = true } tracing-actix-web = { version = "0.7.10", features = ["opentelemetry_0_19", "uuid_v7"], optional = true } tracing-appender = { version = "0.2.3" } tracing-attributes = "0.1.27"