Add a metric for blob transactions nonce gaps (#9106)

This commit is contained in:
Aurélien
2024-06-25 23:30:12 +02:00
committed by GitHub
parent aa952309e8
commit 83ef1f7641
3 changed files with 21 additions and 0 deletions

View File

@ -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,
}

View File

@ -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) })
}

View File

@ -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",