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

Commit 287958d

Browse files
authored
feat(eth-sender): Add transient ethereum gateway errors metric (matter-labs#2323)
Signed-off-by: tomg10 <lemures64@gmail.com>
1 parent 9985c26 commit 287958d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

core/node/eth_sender/src/error.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ pub enum EthSenderError {
1010
#[error("Token parsing error: {0}")]
1111
Parse(#[from] contract::Error),
1212
}
13+
14+
impl EthSenderError {
15+
pub fn is_transient(&self) -> bool {
16+
match self {
17+
EthSenderError::EthereumGateway(err) => err.is_transient(),
18+
_ => false,
19+
}
20+
}
21+
}

core/node/eth_sender/src/eth_tx_manager.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ impl EthTxManager {
232232
.remove_tx_history(tx_history_id)
233233
.await
234234
.unwrap();
235+
} else {
236+
METRICS.l1_transient_errors.inc();
235237
}
236238
Err(error.into())
237239
}
@@ -563,6 +565,9 @@ impl EthTxManager {
563565
// Web3 API request failures can cause this,
564566
// and anything more important is already properly reported.
565567
tracing::warn!("eth_sender error {:?}", e);
568+
if e.is_transient() {
569+
METRICS.l1_transient_errors.inc();
570+
}
566571
}
567572
}
568573

core/node/eth_sender/src/metrics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ pub(super) struct EthSenderMetrics {
107107
pub l1_blocks_waited_in_mempool: Family<ActionTypeLabel, Histogram<u64>>,
108108
/// Number of L1 batches aggregated for publishing with a specific reason.
109109
pub block_aggregation_reason: Family<AggregationReasonLabels, Counter>,
110+
pub l1_transient_errors: Counter,
110111
}
111112

112113
impl EthSenderMetrics {

0 commit comments

Comments
 (0)