chore: move tracing to workspace deps and remove router_env as a dependency of redis_interface (#4717)

This commit is contained in:
Nishant Joshi
2024-05-21 19:48:34 +05:30
committed by GitHub
parent a917776bb8
commit fea2ea6d2c
6 changed files with 11 additions and 9 deletions

2
Cargo.lock generated
View File

@ -5420,11 +5420,11 @@ dependencies = [
"error-stack",
"fred",
"futures 0.3.30",
"router_env",
"serde",
"thiserror",
"tokio 1.37.0",
"tokio-stream",
"tracing",
]
[[package]]

View File

@ -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

View File

@ -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"] }

View File

@ -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
}
}

View File

@ -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(())
})
});

View File

@ -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"