Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eth-sender): Add transient ethereum gateway errors metric #2323

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -549,6 +551,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
Loading