Skip to content

Commit

Permalink
Register tx_size metric on the actual insertion into TxPool
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-ch committed Oct 30, 2024
1 parent 800e651 commit fbb0a54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 4 additions & 0 deletions crates/services/txpool_v2/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ where
debug_assert!(!self.tx_id_to_storage_id.contains_key(&tx_id));
self.tx_id_to_storage_id.insert(tx_id, storage_id);

if self.config.metrics {
txpool_metrics().tx_size.observe(bytes_size as f64);
};

let tx =
Storage::get(&self.storage, &storage_id).expect("Transaction is set above");
self.collision_manager.on_stored_transaction(storage_id, tx);
Expand Down
5 changes: 0 additions & 5 deletions crates/services/txpool_v2/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,6 @@ where
}
};

if metrics {
let size = checked_tx.metered_bytes_size();
txpool_metrics().tx_size.observe(size as f64);
};

let tx = Arc::new(checked_tx);

let result = {
Expand Down

0 comments on commit fbb0a54

Please sign in to comment.