Skip to content

Commit

Permalink
use only tracing (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci authored Apr 10, 2024
1 parent ef1c524 commit 6ea24ab
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enumflags2 = "0.7.7"
futures = "0.3.25"
http = "0.2"
hyper = "0.14"
log = "0.4.17"
moka = { version = "0.12", features = ["future"] }
opentelemetry = { version = "0.21.0" }
opentelemetry-datadog = { version = "0.9.0", features = ["reqwest-client"] }
Expand All @@ -39,9 +38,9 @@ serde_yaml = "0.9.17"
tokio = { version = "1.24.2", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
tower-http = { version = "0.4", features = ["full"] }
tracing = "0.1.37"
tracing = "0.1.40"
tracing-serde = "0.1.3"
tracing-subscriber = { version = "0.3.16", features = ["env-filter", "json"] }
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }

jsonrpsee = { path = "./vendor/jsonrpsee/jsonrpsee", features = ["full"] }
governor = { path = "./vendor/governor/governor" }
Expand Down
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub fn read_config() -> Result<Config, String> {
let mut config: Config = config.into();

if let Ok(endpoints) = std::env::var("ENDPOINTS") {
log::debug!("Override endpoints with env.ENDPOINTS");
tracing::debug!("Override endpoints with env.ENDPOINTS");
let endpoints = endpoints
.split(',')
.map(|x| x.trim().to_string())
Expand All @@ -171,7 +171,7 @@ pub fn read_config() -> Result<Config, String> {
}

if let Ok(env_port) = std::env::var("PORT") {
log::debug!("Override port with env.PORT");
tracing::debug!("Override port with env.PORT");
let port = env_port.parse::<u16>();
if let Ok(port) = port {
config
Expand Down
6 changes: 3 additions & 3 deletions src/extensions/client/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ impl Health {
return;
}
self.score.store(new_score, Ordering::Relaxed);
log::trace!(
tracing::trace!(
"Endpoint {:?} score updated from: {current_score} to: {new_score}",
self.url
);

// Notify waiters if the score has dropped below the threshold
if current_score >= THRESHOLD && new_score < THRESHOLD {
log::warn!("Endpoint {:?} became unhealthy", self.url);
tracing::warn!("Endpoint {:?} became unhealthy", self.url);
self.unhealthy.notify_waiters();
}
}

pub fn on_error(&self, err: &jsonrpsee::core::Error) {
log::warn!("Endpoint {:?} responded with error: {err:?}", self.url);
tracing::warn!("Endpoint {:?} responded with error: {err:?}", self.url);
match err {
jsonrpsee::core::Error::RequestTimeout => {
self.update(Event::RequestTimeout);
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Telemetry {

pub fn setup_telemetry(options: &TelemetryConfig) -> Result<Option<Tracer>, TraceError> {
global::set_error_handler(|e| {
log::warn!("OpenTelemetry error: {}", e);
tracing::warn!("OpenTelemetry error: {}", e);
})
.expect("failed to set OpenTelemetry error handler");

Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/methods/block_tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl BlockTagMiddleware {
};

if let Some(value) = maybe_value {
log::trace!(
tracing::trace!(
"Replacing params {:?} updated with {:?}",
request.params,
(self.index, &value),
Expand Down

0 comments on commit 6ea24ab

Please sign in to comment.