Skip to content

Commit 669ab99

Browse files
chore(taiko-client): add more preconfirmation metrics (#19342)
Co-authored-by: Daniel Wang <[email protected]>
1 parent 1dce498 commit 669ab99

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

packages/taiko-client/driver/preconf_blocks/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
200200
"parentHash", msg.ExecutionPayload.ParentHash.Hex(),
201201
"error", err,
202202
)
203+
metrics.DriverPreconfP2PInvalidEnvelopeCounter.Inc()
203204
return nil
204205
}
205206

@@ -209,6 +210,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
209210
return fmt.Errorf("failed to fetch head L1 origin: %w", err)
210211
}
211212
if headL1Origin != nil && uint64(msg.ExecutionPayload.BlockNumber) <= headL1Origin.BlockID.Uint64() {
213+
metrics.DriverPreconfP2POutdatedEnvelopeCounter.Inc()
212214
return fmt.Errorf(
213215
"preconfirmation block ID (%d) is less than or equal to the current head L1 origin block ID (%d)",
214216
msg.ExecutionPayload.BlockNumber,
@@ -263,6 +265,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
263265
)
264266

265267
s.payloadsCache.put(uint64(msg.ExecutionPayload.BlockNumber), msg.ExecutionPayload)
268+
metrics.DriverPreconfP2PEnvelopeCachedCounter.Inc()
266269
}
267270
return nil
268271
}

packages/taiko-client/internal/metrics/metrics.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ var (
2020
factory = opMetrics.With(registry)
2121

2222
// Driver
23-
DriverL1HeadHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l1Head_height"})
24-
DriverL2HeadHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l2Head_height"})
25-
DriverL2PreconfHeadHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_preconf_l2Head_height"})
26-
DriverL1CurrentHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l1Current_height"})
27-
DriverL2HeadIDGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l2Head_id"})
28-
DriverL2VerifiedHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l2Verified_id"})
29-
DriverPreconfP2PEnvelopeCounter = factory.NewCounter(prometheus.CounterOpts{Name: "driver_p2p_envelope"})
23+
DriverL1HeadHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l1Head_height"})
24+
DriverL2HeadHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l2Head_height"})
25+
DriverL2PreconfHeadHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_preconf_l2Head_height"})
26+
DriverL1CurrentHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l1Current_height"})
27+
DriverL2HeadIDGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l2Head_id"})
28+
DriverL2VerifiedHeightGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "driver_l2Verified_id"})
29+
DriverPreconfP2PEnvelopeCounter = factory.NewCounter(prometheus.CounterOpts{Name: "driver_p2p_envelope"})
30+
DriverPreconfP2PInvalidEnvelopeCounter = factory.NewCounter(prometheus.CounterOpts{
31+
Name: "driver_p2p_invalid_envelope",
32+
})
33+
DriverPreconfP2POutdatedEnvelopeCounter = factory.NewCounter(prometheus.CounterOpts{
34+
Name: "driver_p2p_outdated_envelope",
35+
})
36+
DriverPreconfP2PEnvelopeCachedCounter = factory.NewCounter(prometheus.CounterOpts{
37+
Name: "driver_p2p_envelope_cached",
38+
})
3039

3140
// Proposer
3241
ProposerProposeEpochCounter = factory.NewCounter(prometheus.CounterOpts{Name: "proposer_epoch"})

0 commit comments

Comments
 (0)