Skip to content

Commit

Permalink
update metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilyjjo committed Oct 1, 2024
1 parent cc3abb8 commit 98df89c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions crates/astria-sequencer/src/mempool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl Mempool {
/// Will increment logic error metrics and log error if transaction is already present.
fn add_to_contained_txs(&self, tx_hash: [u8; 32], contained_txs: &mut HashSet<[u8; 32]>) {
if !contained_txs.insert(tx_hash) {
self.metrics.increment_mempool_logic_error();
self.metrics.increment_internal_logic_error();
error!(
tx_hash = %telemetry::display::hex(&tx_hash),
"attempted to add transaction already tracked in mempool's tracked container, is logic \
Expand All @@ -178,7 +178,7 @@ impl Mempool {
/// Will increment logic error metrics and log error if transaction is not present.
fn remove_from_contained_txs(&self, tx_hash: [u8; 32], contained_txs: &mut HashSet<[u8; 32]>) {
if !contained_txs.remove(&tx_hash) {
self.metrics.increment_mempool_logic_error();
self.metrics.increment_internal_logic_error();
error!(
tx_hash = %telemetry::display::hex(&tx_hash),
"attempted to remove transaction absent from mempool's tracked container, is logic \
Expand Down Expand Up @@ -416,7 +416,7 @@ impl Mempool {
let mut contained_txs = self.contained_txs.write().await;
self.remove_from_contained_txs(tx_id, &mut contained_txs);
// this shouldn't happen
self.metrics.increment_mempool_logic_error();
self.metrics.increment_internal_logic_error();
error!(
address = %telemetry::display::base64(&address),
current_nonce,
Expand All @@ -435,7 +435,7 @@ impl Mempool {
let mut contained_txs = self.contained_txs.write().await;
self.remove_from_contained_txs(tx_id, &mut contained_txs);
// this shouldn't happen
self.metrics.increment_mempool_logic_error();
self.metrics.increment_internal_logic_error();
error!(
address = %telemetry::display::base64(&address),
current_nonce,
Expand Down
18 changes: 9 additions & 9 deletions crates/astria-sequencer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct Metrics {
transaction_in_mempool_size_bytes: Histogram,
transactions_in_mempool_total: Gauge,
mempool_recosted: Counter,
mempool_logic_error: Counter,
internal_logic_error: Counter,
}

impl Metrics {
Expand Down Expand Up @@ -156,8 +156,8 @@ impl Metrics {
self.mempool_recosted.increment(1);
}

pub(crate) fn increment_mempool_logic_error(&self) {
self.mempool_logic_error.increment(1);
pub(crate) fn increment_internal_logic_error(&self) {
self.internal_logic_error.increment(1);
}
}

Expand Down Expand Up @@ -335,9 +335,9 @@ impl telemetry::Metrics for Metrics {
)?
.register()?;

let mempool_logic_error = builder
let internal_logic_error = builder
.new_counter_factory(
MEMPOOL_LOGIC_ERROR,
INTERNAL_LOGIC_ERROR,
"The number of times a transaction has been rejected due to logic errors in the \
mempool",
)?
Expand Down Expand Up @@ -369,7 +369,7 @@ impl telemetry::Metrics for Metrics {
transaction_in_mempool_size_bytes,
transactions_in_mempool_total,
mempool_recosted,
mempool_logic_error,
internal_logic_error,
})
}
}
Expand Down Expand Up @@ -397,7 +397,7 @@ metric_names!(const METRICS_NAMES:
TRANSACTION_IN_MEMPOOL_SIZE_BYTES,
TRANSACTIONS_IN_MEMPOOL_TOTAL,
MEMPOOL_RECOSTED,
MEMPOOL_LOGIC_ERROR
INTERNAL_LOGIC_ERROR
);

#[cfg(test)]
Expand All @@ -410,7 +410,7 @@ mod tests {
CHECK_TX_REMOVED_FAILED_EXECUTION,
CHECK_TX_REMOVED_FAILED_STATELESS,
CHECK_TX_REMOVED_TOO_LARGE,
MEMPOOL_LOGIC_ERROR,
INTERNAL_LOGIC_ERROR,
MEMPOOL_RECOSTED,
PREPARE_PROPOSAL_EXCLUDED_TRANSACTIONS,
PREPARE_PROPOSAL_EXCLUDED_TRANSACTIONS_COMETBFT_SPACE,
Expand Down Expand Up @@ -483,6 +483,6 @@ mod tests {
"transactions_in_mempool_total",
);
assert_const(MEMPOOL_RECOSTED, "mempool_recosted");
assert_const(MEMPOOL_LOGIC_ERROR, "mempool_logic_error");
assert_const(INTERNAL_LOGIC_ERROR, "internal_logic_error");
}
}

0 comments on commit 98df89c

Please sign in to comment.