Commit bd65ee51 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-node: Add transactions sequenced metric (#3162)

This will allow us to measure opnode throughput.
parent a1842698
...@@ -44,6 +44,8 @@ type Metrics struct { ...@@ -44,6 +44,8 @@ type Metrics struct {
DerivationErrorsTotal prometheus.Counter DerivationErrorsTotal prometheus.Counter
Heads *prometheus.GaugeVec Heads *prometheus.GaugeVec
TransactionsSequencedTotal prometheus.Counter
registry *prometheus.Registry registry *prometheus.Registry
} }
...@@ -147,6 +149,12 @@ func NewMetrics(procName string) *Metrics { ...@@ -147,6 +149,12 @@ func NewMetrics(procName string) *Metrics {
"type", "type",
}), }),
TransactionsSequencedTotal: promauto.With(registry).NewGauge(prometheus.GaugeOpts{
Namespace: ns,
Name: "transactions_sequenced_total",
Help: "Count of total transactions sequenced",
}),
registry: registry, registry: registry,
} }
} }
......
...@@ -244,6 +244,7 @@ func (s *state) createNewL2Block(ctx context.Context) error { ...@@ -244,6 +244,7 @@ func (s *state) createNewL2Block(ctx context.Context) error {
s.l2Head = newUnsafeL2Head s.l2Head = newUnsafeL2Head
s.log.Info("Sequenced new l2 block", "l2Head", s.l2Head, "l1Origin", s.l2Head.L1Origin, "txs", len(payload.Transactions), "time", s.l2Head.Time) s.log.Info("Sequenced new l2 block", "l2Head", s.l2Head, "l1Origin", s.l2Head.L1Origin, "txs", len(payload.Transactions), "time", s.l2Head.Time)
s.metrics.TransactionsSequencedTotal.Add(float64(len(payload.Transactions)))
if s.network != nil { if s.network != nil {
if err := s.network.PublishL2Payload(ctx, payload); err != nil { if err := s.network.PublishL2Payload(ctx, payload); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment