Commit ec20301d authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-challenger: Fix metrics (#8918)

* op-challenger: Fix metrics

* op-e2e: Enable metrics when running challenger to ensure they work.
parent bdf314a7
...@@ -45,6 +45,9 @@ type Metricer interface { ...@@ -45,6 +45,9 @@ type Metricer interface {
DecIdleExecutors() DecIdleExecutors()
} }
// Metrics implementation must implement RegistryMetricer to allow the metrics server to work.
var _ opmetrics.RegistryMetricer = (*Metrics)(nil)
type Metrics struct { type Metrics struct {
ns string ns string
registry *prometheus.Registry registry *prometheus.Registry
...@@ -70,6 +73,10 @@ type Metrics struct { ...@@ -70,6 +73,10 @@ type Metrics struct {
inflightGames prometheus.Gauge inflightGames prometheus.Gauge
} }
func (m *Metrics) Registry() *prometheus.Registry {
return m.registry
}
var _ Metricer = (*Metrics)(nil) var _ Metricer = (*Metrics)(nil)
func NewMetrics() *Metrics { func NewMetrics() *Metrics {
......
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
...@@ -134,6 +135,11 @@ func NewChallengerConfig(t *testing.T, l1Endpoint string, options ...Option) *co ...@@ -134,6 +135,11 @@ func NewChallengerConfig(t *testing.T, l1Endpoint string, options ...Option) *co
// Limit concurrency to something more reasonable when there are also multiple tests executing in parallel // Limit concurrency to something more reasonable when there are also multiple tests executing in parallel
cfg.MaxConcurrency = 4 cfg.MaxConcurrency = 4
} }
cfg.MetricsConfig = metrics.CLIConfig{
Enabled: true,
ListenAddr: "127.0.0.1",
ListenPort: 0, // Find any available port (avoids conflicts)
}
for _, option := range options { for _, option := range options {
option(&cfg) option(&cfg)
} }
......
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