From 74a602bc9c4c4aa67193260e375157c9b066faec Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 12 May 2023 23:20:59 -0700 Subject: [PATCH] wip --- latency/src/peak_ewma/mod.rs | 8 ++++++-- web3_proxy/src/rpcs/consensus.rs | 6 +++++- web3_proxy/src/rpcs/request.rs | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/latency/src/peak_ewma/mod.rs b/latency/src/peak_ewma/mod.rs index 533ff3af..a6c248d4 100644 --- a/latency/src/peak_ewma/mod.rs +++ b/latency/src/peak_ewma/mod.rs @@ -3,7 +3,7 @@ mod rtt_estimate; use std::sync::Arc; use kanal::SendError; -use log::error; +use log::{error, info, trace}; use tokio::task::JoinHandle; use tokio::time::{Duration, Instant}; @@ -70,7 +70,9 @@ impl PeakEwmaLatency { /// Should only be called from the Web3Rpc that owns it. pub fn report(&self, duration: Duration) { match self.request_tx.try_send(duration) { - Ok(true) => {} + Ok(true) => { + trace!("success"); + } Ok(false) => { // We don't want to block if the channel is full, just // report the error @@ -113,6 +115,8 @@ impl PeakEwmaLatencyTask { fn update(&mut self, rtt: Duration) { let rtt = nanos(rtt); + info!("updating rtt: {}ns", rtt); + let now = Instant::now(); debug_assert!( self.update_at <= now, diff --git a/web3_proxy/src/rpcs/consensus.rs b/web3_proxy/src/rpcs/consensus.rs index e6261412..3b0d5060 100644 --- a/web3_proxy/src/rpcs/consensus.rs +++ b/web3_proxy/src/rpcs/consensus.rs @@ -407,7 +407,11 @@ impl ConsensusFinder { { Ok(parent_block) => block_to_check = parent_block, Err(err) => { - warn!("Problem fetching parent block of {:#?} during consensus finding: {:#?}", block_to_check, err); + warn!( + "Problem fetching parent block of {:?} during consensus finding: {:#?}", + block_to_check.hash(), + err + ); break; } } diff --git a/web3_proxy/src/rpcs/request.rs b/web3_proxy/src/rpcs/request.rs index 8103b5e6..18e4ca2e 100644 --- a/web3_proxy/src/rpcs/request.rs +++ b/web3_proxy/src/rpcs/request.rs @@ -7,7 +7,7 @@ use entities::revert_log; use entities::sea_orm_active_enums::Method; use ethers::providers::ProviderError; use ethers::types::{Address, Bytes}; -use log::{debug, error, trace, warn, Level}; +use log::{debug, error, info, trace, warn, Level}; use migration::sea_orm::{self, ActiveEnum, ActiveModelTrait}; use serde_json::json; use std::fmt; @@ -374,6 +374,7 @@ impl OpenRequestHandle { } } } else if let Some(peak_latency) = &self.rpc.peak_latency { + trace!("updating peak_latency: {}", latency.as_secs_f64()); peak_latency.report(latency); } else { unreachable!("peak_latency not initialized");