Skip to content

Commit

Permalink
feature: add Blob pool metrics (paradigmxyz#6373)
Browse files Browse the repository at this point in the history
Signed-off-by: jsvisa <[email protected]>
  • Loading branch information
jsvisa authored Feb 3, 2024
1 parent 72b7caa commit 57eef7e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions crates/transaction-pool/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ pub struct TxPoolMetrics {
/// Total amount of memory used by the transactions in the queued sub-pool in bytes
pub(crate) queued_pool_size_bytes: Gauge,

/// Number of transactions in the blob sub-pool
pub(crate) blob_pool_transactions: Gauge,
/// Total amount of memory used by the transactions in the blob sub-pool in bytes
pub(crate) blob_pool_size_bytes: Gauge,

/// Number of all transactions of all sub-pools: pending + basefee + queued
pub(crate) total_transactions: Gauge,

Expand Down
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 @@ -463,6 +463,8 @@ impl<T: TransactionOrdering> TxPool<T> {
self.metrics.basefee_pool_size_bytes.set(stats.basefee_size as f64);
self.metrics.queued_pool_transactions.set(stats.queued as f64);
self.metrics.queued_pool_size_bytes.set(stats.queued_size as f64);
self.metrics.blob_pool_transactions.set(stats.blob as f64);
self.metrics.blob_pool_size_bytes.set(stats.blob_size as f64);
self.metrics.total_transactions.set(stats.total as f64);
}

Expand Down
5 changes: 4 additions & 1 deletion docs/design/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ The main difference between metrics and traces is therefore that metrics are sys

### How to add a metric

To add metrics use the [`metrics`][metrics] crate.
To add metrics use the [`metrics`][metrics] crate.

1. Add the code emitting the metric.
2. Add the metrics description in the crate's metrics describer module, e.g.: [stages metrics describer](https://github.com/paradigmxyz/reth/blob/main/crates/stages/src/metrics.rs).
3. Document the metric in this file.
Expand Down Expand Up @@ -83,6 +84,8 @@ This list may be non-exhaustive.
- `transaction_pool.basefee_pool_size_bytes`: Total amount of memory used by the transactions in the basefee sub-pool in bytes
- `transaction_pool.queued_pool_transactions`: Number of transactions in the queued sub-pool
- `transaction_pool.queued_pool_size_bytes`: Total amount of memory used by the transactions in the queued sub-pool in bytes
- `transaction_pool.blob_pool_transactions`: Number of transactions in the blob sub-pool
- `transaction_pool.blob_pool_size_bytes`: Total amount of memory used by the transactions in the blob sub-pool in bytes

#### Component: Network

Expand Down
22 changes: 22 additions & 0 deletions etc/grafana/dashboards/overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -3499,6 +3499,17 @@
"legendFormat": "Queued pool size",
"range": true,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "builder",
"expr": "reth_transaction_pool_blob_pool_size_bytes{instance=~\"$instance\"}",
"legendFormat": "Blob pool size",
"range": true,
"refId": "D"
}
],
"title": "Subpool sizes in bytes",
Expand Down Expand Up @@ -3616,6 +3627,17 @@
"legendFormat": "Queued pool transactions",
"range": true,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "builder",
"expr": "reth_transaction_pool_blob_pool_transactions{instance=~\"$instance\"}",
"legendFormat": "Blob pool transactions",
"range": true,
"refId": "D"
}
],
"title": "Subpool transaction count",
Expand Down

0 comments on commit 57eef7e

Please sign in to comment.