Skip to content

Commit

Permalink
remove metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr committed Nov 20, 2024
1 parent 53a1fa1 commit fee5e6d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
16 changes: 0 additions & 16 deletions crates/storage/provider/src/providers/database/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ impl Default for DurationsRecorder {
}

impl DurationsRecorder {
/// Saves the provided duration for future logging and instantly reports as a metric with
/// `action` label.
pub(crate) fn record_duration(&mut self, action: Action, duration: Duration) {
self.actions.push((action, duration));
self.current_metrics.record_duration(action, duration);
self.latest = Some(self.start.elapsed());
}

/// Records the duration since last record, saves it for future logging and instantly reports as
/// a metric with `action` label.
pub(crate) fn record_relative(&mut self, action: Action) {
Expand All @@ -56,8 +48,6 @@ pub(crate) enum Action {
InsertHeaders,
InsertHeaderNumbers,
InsertHeaderTerminalDifficulties,
InsertTransactionSenders,
InsertTransactionHashNumbers,
InsertBlockBodyIndices,
InsertTransactionBlocks,
GetNextTxNum,
Expand Down Expand Up @@ -92,10 +82,6 @@ struct DatabaseProviderMetrics {
insert_header_numbers: Histogram,
/// Duration of insert header TD
insert_header_td: Histogram,
/// Duration of insert tx senders
insert_tx_senders: Histogram,
/// Duration of insert transaction hash numbers
insert_tx_hash_numbers: Histogram,
/// Duration of insert block body indices
insert_block_body_indices: Histogram,
/// Duration of insert transaction blocks
Expand All @@ -122,8 +108,6 @@ impl DatabaseProviderMetrics {
Action::InsertHeaders => self.insert_headers.record(duration),
Action::InsertHeaderNumbers => self.insert_header_numbers.record(duration),
Action::InsertHeaderTerminalDifficulties => self.insert_header_td.record(duration),
Action::InsertTransactionSenders => self.insert_tx_senders.record(duration),
Action::InsertTransactionHashNumbers => self.insert_tx_hash_numbers.record(duration),
Action::InsertBlockBodyIndices => self.insert_block_body_indices.record(duration),
Action::InsertTransactionBlocks => self.insert_tx_blocks.record(duration),
Action::GetNextTxNum => self.get_next_tx_num.record(duration),
Expand Down
14 changes: 0 additions & 14 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ use std::{
fmt::Debug,
ops::{Deref, DerefMut, Range, RangeBounds, RangeInclusive},
sync::{mpsc, Arc},
time::{Duration, Instant},
};
use tokio::sync::watch;
use tracing::{debug, error, trace};
Expand Down Expand Up @@ -3179,33 +3178,20 @@ impl<TX: DbTxMut + DbTx + 'static, N: ProviderNodeTypes + 'static> BlockWriter
let tx_count = block.block.body.transactions().len() as u64;

// Ensures we have all the senders for the block's transactions.
let mut tx_senders_elapsed = Duration::default();
let mut tx_hash_numbers_elapsed = Duration::default();

for (transaction, sender) in
block.block.body.transactions().iter().zip(block.senders.iter())
{
let hash = transaction.tx_hash();

if self.prune_modes.sender_recovery.as_ref().is_none_or(|m| !m.is_full()) {
let start = Instant::now();
self.tx.put::<tables::TransactionSenders>(next_tx_num, *sender)?;
tx_senders_elapsed += start.elapsed();
}

if self.prune_modes.transaction_lookup.is_none_or(|m| !m.is_full()) {
let start = Instant::now();
self.tx.put::<tables::TransactionHashNumbers>(*hash, next_tx_num)?;
tx_hash_numbers_elapsed += start.elapsed();
}
next_tx_num += 1;
}
durations_recorder
.record_duration(metrics::Action::InsertTransactionSenders, tx_senders_elapsed);
durations_recorder.record_duration(
metrics::Action::InsertTransactionHashNumbers,
tx_hash_numbers_elapsed,
);

self.append_block_bodies(
vec![(block_number, Some(block.block.body))],
Expand Down

0 comments on commit fee5e6d

Please sign in to comment.