Skip to content

Commit

Permalink
[Mempool] Don't log times that are <= 0 for insertion time to block t…
Browse files Browse the repository at this point in the history
…imestamp (#9482)

### Description

This happens due to retry/duplication and should be ignored (instead of logging time 0). This cleans up the metric a bit, especially for forge tests that have enough latency that causes frequent transaction retries.
  • Loading branch information
bchocho authored Aug 4, 2023
1 parent bb9dd77 commit e104646
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mempool/src/core_mempool/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ impl Mempool {

let insertion_timestamp =
aptos_infallible::duration_since_epoch_at(&insertion_info.insertion_time);
counters::core_mempool_txn_commit_latency(
counters::COMMIT_ACCEPTED_BLOCK_LABEL,
insertion_info.submitted_by_label(),
bucket,
block_timestamp.saturating_sub(insertion_timestamp),
);
if let Some(insertion_to_block) = block_timestamp.checked_sub(insertion_timestamp) {
counters::core_mempool_txn_commit_latency(
counters::COMMIT_ACCEPTED_BLOCK_LABEL,
insertion_info.submitted_by_label(),
bucket,
insertion_to_block,
);
}
}
}

Expand Down

0 comments on commit e104646

Please sign in to comment.