Skip to content

Commit

Permalink
Add a metric for blob transactions nonce gaps (paradigmxyz#9106)
Browse files Browse the repository at this point in the history
  • Loading branch information
leruaa authored Jun 25, 2024
1 parent aa95230 commit 83ef1f7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/transaction-pool/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ pub struct AllTransactionsMetrics {
pub(crate) all_transactions_by_id: Gauge,
/// Number of all transactions by all senders in the pool
pub(crate) all_transactions_by_all_senders: Gauge,
/// Number of blob transactions nonce gaps.
pub(crate) blob_transactions_nonce_gaps: Counter,
}
2 changes: 2 additions & 0 deletions crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,11 +1335,13 @@ impl<T: PoolTransaction> AllTransactions<T> {
if let Some(ancestor) = ancestor {
let Some(ancestor_tx) = self.txs.get(&ancestor) else {
// ancestor tx is missing, so we can't insert the new blob
self.metrics.blob_transactions_nonce_gaps.increment(1);
return Err(InsertErr::BlobTxHasNonceGap { transaction: Arc::new(new_blob_tx) })
};
if ancestor_tx.state.has_nonce_gap() {
// the ancestor transaction already has a nonce gap, so we can't insert the new
// blob
self.metrics.blob_transactions_nonce_gaps.increment(1);
return Err(InsertErr::BlobTxHasNonceGap { transaction: Arc::new(new_blob_tx) })
}

Expand Down
17 changes: 17 additions & 0 deletions etc/grafana/dashboards/reth-mempool.json
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,23 @@
"range": true,
"refId": "C",
"useBackend": false
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"disableTextWrap": false,
"editorMode": "builder",
"expr": "reth_transaction_pool_blob_transactions_nonce_gaps{instance=~\"$instance\"}",
"fullMetaSearch": false,
"hide": false,
"includeNullMetadata": true,
"instant": false,
"legendFormat": "Blob transactions nonce gaps",
"range": true,
"refId": "D",
"useBackend": false
}
],
"title": "All Transactions metrics",
Expand Down

0 comments on commit 83ef1f7

Please sign in to comment.