File tree 3 files changed +63
-2
lines changed 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,24 @@ impl OpExecutionPayloadEnvelope {
43
43
}
44
44
}
45
45
}
46
+
47
+ pub fn tx_count ( & self ) -> usize {
48
+ match self {
49
+ OpExecutionPayloadEnvelope :: V3 ( payload) => payload
50
+ . execution_payload
51
+ . payload_inner
52
+ . payload_inner
53
+ . transactions
54
+ . len ( ) ,
55
+ OpExecutionPayloadEnvelope :: V4 ( payload) => payload
56
+ . execution_payload
57
+ . payload_inner
58
+ . payload_inner
59
+ . payload_inner
60
+ . transactions
61
+ . len ( ) ,
62
+ }
63
+ }
46
64
}
47
65
48
66
impl From < OpExecutionPayloadEnvelope > for ExecutionPayload {
Original file line number Diff line number Diff line change @@ -184,6 +184,17 @@ impl RollupBoostServer {
184
184
self . probes . set_health ( Health :: Healthy ) ;
185
185
186
186
if let Ok ( Some ( builder_payload) ) = builder_payload {
187
+ // Record the delta (gas and txn) between the builder and l2 payload
188
+ let span = tracing:: Span :: current ( ) ;
189
+ span. record (
190
+ "gas_delta" ,
191
+ ( builder_payload. gas_used ( ) - l2_payload. gas_used ( ) ) . to_string ( ) ,
192
+ ) ;
193
+ span. record (
194
+ "tx_count_delta" ,
195
+ ( builder_payload. tx_count ( ) - l2_payload. tx_count ( ) ) . to_string ( ) ,
196
+ ) ;
197
+
187
198
// If execution mode is set to DryRun, fallback to the l2_payload,
188
199
// otherwise prefer the builder payload
189
200
if self . execution_mode ( ) . is_dry_run ( ) {
@@ -388,7 +399,9 @@ impl EngineApiServer for RollupBoostServer {
388
399
fields(
389
400
otel. kind = ?SpanKind :: Server ,
390
401
%payload_id,
391
- payload_source
402
+ payload_source,
403
+ gas_delta,
404
+ tx_count_delta,
392
405
)
393
406
) ]
394
407
async fn get_payload_v3 (
@@ -436,7 +449,9 @@ impl EngineApiServer for RollupBoostServer {
436
449
fields(
437
450
otel. kind = ?SpanKind :: Server ,
438
451
%payload_id,
439
- payload_source
452
+ payload_source,
453
+ gas_delta,
454
+ tx_count_delta,
440
455
)
441
456
) ]
442
457
async fn get_payload_v4 (
Original file line number Diff line number Diff line change @@ -58,6 +58,34 @@ impl SpanProcessor for MetricsSpanProcessor {
58
58
] )
59
59
. collect :: < Vec < _ > > ( ) ;
60
60
61
+ // 0 = no difference in gas build via builder vs l2
62
+ // > 0 = gas used by builder block is greater than l2 block
63
+ // < 0 = gas used by l2 block is greater than builder block
64
+ let gas_delta = span
65
+ . attributes
66
+ . iter ( )
67
+ . find ( |attr| attr. key . as_str ( ) == "gas_delta" )
68
+ . map ( |attr| attr. value . as_str ( ) . to_string ( ) ) ;
69
+
70
+ if let Some ( gas_delta) = gas_delta {
71
+ histogram ! ( "block_building_gas_delta" , & labels)
72
+ . record ( gas_delta. parse :: < u64 > ( ) . unwrap_or_default ( ) as f64 ) ;
73
+ }
74
+
75
+ // 0 = no difference in tx count build via builder vs l2
76
+ // > 0 = num txs in builder block is greater than l2 block
77
+ // < 0 = num txs in l2 block is greater than builder block
78
+ let tx_count_delta = span
79
+ . attributes
80
+ . iter ( )
81
+ . find ( |attr| attr. key . as_str ( ) == "tx_count_delta" )
82
+ . map ( |attr| attr. value . as_str ( ) . to_string ( ) ) ;
83
+
84
+ if let Some ( tx_count_delta) = tx_count_delta {
85
+ histogram ! ( "block_building_tx_count_delta" , & labels)
86
+ . record ( tx_count_delta. parse :: < u64 > ( ) . unwrap_or_default ( ) as f64 ) ;
87
+ }
88
+
61
89
histogram ! ( format!( "{}_duration" , span. name) , & labels) . record ( duration) ;
62
90
}
63
91
You can’t perform that action at this time.
0 commit comments