Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat(eth-sender): Add transient ethereum gateway errors metric (matte…
Browse files Browse the repository at this point in the history
…r-labs#2323)

Signed-off-by: tomg10 <lemures64@gmail.com>
  • Loading branch information
tomg10 authored Jun 27, 2024
1 parent 9985c26 commit 287958d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/node/eth_sender/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ pub enum EthSenderError {
#[error("Token parsing error: {0}")]
Parse(#[from] contract::Error),
}

impl EthSenderError {
pub fn is_transient(&self) -> bool {
match self {
EthSenderError::EthereumGateway(err) => err.is_transient(),
_ => false,
}
}
}
5 changes: 5 additions & 0 deletions core/node/eth_sender/src/eth_tx_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ impl EthTxManager {
.remove_tx_history(tx_history_id)
.await
.unwrap();
} else {
METRICS.l1_transient_errors.inc();
}
Err(error.into())
}
Expand Down Expand Up @@ -563,6 +565,9 @@ impl EthTxManager {
// Web3 API request failures can cause this,
// and anything more important is already properly reported.
tracing::warn!("eth_sender error {:?}", e);
if e.is_transient() {
METRICS.l1_transient_errors.inc();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions core/node/eth_sender/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pub(super) struct EthSenderMetrics {
pub l1_blocks_waited_in_mempool: Family<ActionTypeLabel, Histogram<u64>>,
/// Number of L1 batches aggregated for publishing with a specific reason.
pub block_aggregation_reason: Family<AggregationReasonLabels, Counter>,
pub l1_transient_errors: Counter,
}

impl EthSenderMetrics {
Expand Down

0 comments on commit 287958d

Please sign in to comment.