Commit 8ba51662 authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-challenger: Add a metric for number of l2 block numbers challenged. (#10482)

parent 3249d81e
...@@ -138,7 +138,8 @@ func (a *Agent) performAction(ctx context.Context, wg *sync.WaitGroup, action ty ...@@ -138,7 +138,8 @@ func (a *Agent) performAction(ctx context.Context, wg *sync.WaitGroup, action ty
a.metrics.RecordGameMove() a.metrics.RecordGameMove()
case types.ActionTypeStep: case types.ActionTypeStep:
a.metrics.RecordGameStep() a.metrics.RecordGameStep()
// TODO(client-pod#852): Add metrics for L2 block number challenges case types.ActionTypeChallengeL2BlockNumber:
a.metrics.RecordGameL2Challenge()
} }
actionLog.Info("Performing action") actionLog.Info("Performing action")
err := a.responder.PerformAction(ctx, action) err := a.responder.PerformAction(ctx, action)
......
...@@ -36,6 +36,7 @@ type Metricer interface { ...@@ -36,6 +36,7 @@ type Metricer interface {
RecordGameStep() RecordGameStep()
RecordGameMove() RecordGameMove()
RecordGameL2Challenge()
RecordCannonExecutionTime(t float64) RecordCannonExecutionTime(t float64)
RecordAsteriscExecutionTime(t float64) RecordAsteriscExecutionTime(t float64)
RecordClaimResolutionTime(t float64) RecordClaimResolutionTime(t float64)
...@@ -83,8 +84,9 @@ type Metrics struct { ...@@ -83,8 +84,9 @@ type Metrics struct {
highestActedL1Block prometheus.Gauge highestActedL1Block prometheus.Gauge
moves prometheus.Counter moves prometheus.Counter
steps prometheus.Counter steps prometheus.Counter
l2Challenges prometheus.Counter
claimResolutionTime prometheus.Histogram claimResolutionTime prometheus.Histogram
gameActTime prometheus.Histogram gameActTime prometheus.Histogram
...@@ -145,6 +147,11 @@ func NewMetrics() *Metrics { ...@@ -145,6 +147,11 @@ func NewMetrics() *Metrics {
Name: "steps", Name: "steps",
Help: "Number of game steps made by the challenge agent", Help: "Number of game steps made by the challenge agent",
}), }),
l2Challenges: factory.NewCounter(prometheus.CounterOpts{
Namespace: Namespace,
Name: "l2_challenges",
Help: "Number of L2 challenges made by the challenge agent",
}),
cannonExecutionTime: factory.NewHistogram(prometheus.HistogramOpts{ cannonExecutionTime: factory.NewHistogram(prometheus.HistogramOpts{
Namespace: Namespace, Namespace: Namespace,
Name: "cannon_execution_time", Name: "cannon_execution_time",
...@@ -251,6 +258,10 @@ func (m *Metrics) RecordGameStep() { ...@@ -251,6 +258,10 @@ func (m *Metrics) RecordGameStep() {
m.steps.Add(1) m.steps.Add(1)
} }
func (m *Metrics) RecordGameL2Challenge() {
m.l2Challenges.Add(1)
}
func (m *Metrics) RecordPreimageChallenged() { func (m *Metrics) RecordPreimageChallenged() {
m.preimageChallenged.Add(1) m.preimageChallenged.Add(1)
} }
......
...@@ -25,8 +25,9 @@ var NoopMetrics Metricer = new(NoopMetricsImpl) ...@@ -25,8 +25,9 @@ var NoopMetrics Metricer = new(NoopMetricsImpl)
func (*NoopMetricsImpl) RecordInfo(version string) {} func (*NoopMetricsImpl) RecordInfo(version string) {}
func (*NoopMetricsImpl) RecordUp() {} func (*NoopMetricsImpl) RecordUp() {}
func (*NoopMetricsImpl) RecordGameMove() {} func (*NoopMetricsImpl) RecordGameMove() {}
func (*NoopMetricsImpl) RecordGameStep() {} func (*NoopMetricsImpl) RecordGameStep() {}
func (*NoopMetricsImpl) RecordGameL2Challenge() {}
func (*NoopMetricsImpl) RecordActedL1Block(_ uint64) {} func (*NoopMetricsImpl) RecordActedL1Block(_ uint64) {}
......
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