@@ -326,6 +326,8 @@ func (r *Layer2Relayer) ProcessPendingBatches() {
326326
327327 // if backlog outgrow max size, force‐submit enough oldest batches
328328 backlogCount , err := r .batchOrm .GetFailedAndPendingBatchesCount (r .ctx )
329+ r .metrics .rollupL2RelayerBacklogCounts .Set (float64 (backlogCount ))
330+
329331 if err != nil {
330332 log .Error ("Failed to fetch pending L2 batches" , "err" , err )
331333 return
@@ -352,7 +354,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() {
352354
353355 if ! forceSubmit {
354356 // check if we should skip submitting the batch based on the fee target
355- skip , err := r .skipSubmitByFee (oldestBlockTimestamp )
357+ skip , err := r .skipSubmitByFee (oldestBlockTimestamp , r . metrics )
356358 // return if not hitting target price
357359 if skip {
358360 log .Debug ("Skipping batch submission" , "reason" , err )
@@ -503,6 +505,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() {
503505 r .metrics .rollupL2RelayerCommitThroughput .Add (float64 (totalGasUsed ))
504506 r .metrics .rollupL2RelayerProcessPendingBatchSuccessTotal .Add (float64 (len (batchesToSubmit )))
505507 r .metrics .rollupL2RelayerProcessBatchesPerTxCount .Set (float64 (len (batchesToSubmit )))
508+ r .metrics .rollupL2RelayerCommitLatency .Set (time .Since (oldestBlockTimestamp ).Seconds ())
506509
507510 log .Info ("Sent the commitBatches tx to layer1" , "batches count" , len (batchesToSubmit ), "start index" , firstBatch .Index , "start hash" , firstBatch .Hash , "end index" , lastBatch .Index , "end hash" , lastBatch .Hash , "tx hash" , txHash .String ())
508511}
@@ -1085,7 +1088,7 @@ func calculateTargetPrice(windowSec uint64, strategy StrategyParams, firstTime t
10851088// skipSubmitByFee returns (true, nil) when submission should be skipped right now
10861089// because the blob‐fee is above target and the timeout window hasn’t yet elapsed.
10871090// Otherwise returns (false, err)
1088- func (r * Layer2Relayer ) skipSubmitByFee (oldest time.Time ) (bool , error ) {
1091+ func (r * Layer2Relayer ) skipSubmitByFee (oldest time.Time , metrics * l2RelayerMetrics ) (bool , error ) {
10891092 windowSec := uint64 (r .cfg .BatchSubmission .TimeoutSec )
10901093
10911094 hist , err := r .fetchBlobFeeHistory (windowSec )
@@ -1100,6 +1103,11 @@ func (r *Layer2Relayer) skipSubmitByFee(oldest time.Time) (bool, error) {
11001103 target := calculateTargetPrice (windowSec , r .batchStrategy , oldest , hist )
11011104 current := hist [len (hist )- 1 ]
11021105
1106+ currentFloat , _ := current .Float64 ()
1107+ targetFloat , _ := target .Float64 ()
1108+ metrics .rollupL2RelayerCurrentBlobPrice .Set (currentFloat )
1109+ metrics .rollupL2RelayerTargetBlobPrice .Set (targetFloat )
1110+
11031111 // if current fee > target and still inside the timeout window, skip
11041112 if current .Cmp (target ) > 0 && time .Since (oldest ) < time .Duration (windowSec )* time .Second {
11051113 return true , fmt .Errorf (
0 commit comments