Skip to content

Commit 33f55e8

Browse files
authored
Add metrics and message log to track number of flashblocks used (#367)
1 parent 0a3fe42 commit 33f55e8

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

crates/rollup-boost/src/flashblocks/metrics.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use metrics::{Counter, Gauge};
1+
use metrics::{Counter, Gauge, Histogram};
22
use metrics_derive::Metrics;
33

44
#[derive(Metrics, Clone)]
@@ -27,4 +27,7 @@ pub struct FlashblocksServiceMetrics {
2727

2828
#[metric(describe = "Number of messages processed by the service")]
2929
pub messages_processed: Counter,
30+
31+
#[metric(describe = "Number of flashblocks used to build a block")]
32+
pub flashblocks_used: Histogram,
3033
}

crates/rollup-boost/src/flashblocks/service.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ impl FlashblocksService {
228228
// consume the best payload and reset the builder
229229
let payload = {
230230
let mut builder = self.best_payload.write().await;
231+
let flashblocks_number = builder.flashblocks.len();
232+
self.metrics
233+
.flashblocks_used
234+
.record(flashblocks_number as f64);
235+
tracing::Span::current().record("flashblocks_count", flashblocks_number);
231236
// Take payload and place new one in its place in one go to avoid double locking
232237
std::mem::replace(&mut *builder, FlashblockBuilder::new()).into_envelope(version)?
233238
};

crates/rollup-boost/src/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ where
438438
gas_delta,
439439
tx_count_delta,
440440
builder_has_payload,
441+
flashblocks_count,
441442
)
442443
)]
443444
async fn get_payload_v3(

0 commit comments

Comments
 (0)