Skip to content

Commit

Permalink
[State Sync] Reduce logging of global data summaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLind authored and bors-libra committed Dec 22, 2021
1 parent f2481f6 commit a1db90b
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions state-sync/diem-data-client/src/diemnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use diem_config::{
};
use diem_id_generator::{IdGenerator, U64IdGenerator};
use diem_infallible::RwLock;
use diem_logger::{debug, error, info};
use diem_logger::prelude::*;
use diem_time_service::{TimeService, TimeServiceTrait};
use diem_types::{
account_state_blob::AccountStatesChunkWithProof,
Expand Down Expand Up @@ -45,8 +45,7 @@ mod state;
#[cfg(test)]
mod tests;

// TODO(philiphayes): does this belong in a different crate? I feel like we're
// accumulating a lot of tiny crates though...
const GLOBAL_DATA_LOG_FREQ_SECS: u64 = 5;

/// A [`DiemDataClient`] that fulfills requests from remote peers' Storage Service
/// over DiemNet.
Expand Down Expand Up @@ -505,13 +504,16 @@ impl DataSummaryPoller {
self.data_client.update_summary(peer, storage_summary);
self.data_client.update_global_summary_cache();

debug!(
(LogSchema::new(LogEntry::PeerStates)
.event(LogEvent::AggregateSummary)
.message(&format!(
"Global data summary: {:?}",
self.data_client.get_global_data_summary()
)))
sample!(
SampleRate::Duration(Duration::from_secs(GLOBAL_DATA_LOG_FREQ_SECS)),
debug!(
(LogSchema::new(LogEntry::PeerStates)
.event(LogEvent::AggregateSummary)
.message(&format!(
"Global data summary: {:?}",
self.data_client.get_global_data_summary()
)))
)
);
}
}
Expand Down

0 comments on commit a1db90b

Please sign in to comment.