Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions op-e2e/interop/supersystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func (s *interopE2ESystem) newL2(id string, l2Out *interopgen.L2Output) l2Set {
func (s *interopE2ESystem) prepareSupervisor() *supervisor.SupervisorService {
// Be verbose with op-supervisor, it's in early test phase
logger := testlog.Logger(s.t, log.LevelDebug).New("role", "supervisor")
cfg := supervisorConfig.Config{
cfg := &supervisorConfig.Config{
MetricsConfig: metrics.CLIConfig{
Enabled: false,
},
Expand All @@ -441,17 +441,17 @@ func (s *interopE2ESystem) prepareSupervisor() *supervisor.SupervisorService {
depSet := &depset.StaticConfigDependencySet{
Dependencies: make(map[supervisortypes.ChainID]*depset.StaticConfigDependency),
}
for id := range s.l2s {
cfg.L2RPCs = append(cfg.L2RPCs, s.l2s[id].l2Geth.UserRPC().RPC())
chainID := supervisortypes.ChainIDFromBig(s.l2s[id].chainID)
// Iterate over the L2 chain configs. The L2 nodes don't exist yet.
for _, l2Out := range s.worldOutput.L2s {
chainID := supervisortypes.ChainIDFromBig(l2Out.Genesis.Config.ChainID)
depSet.Dependencies[chainID] = &depset.StaticConfigDependency{
ActivationTime: 0,
HistoryMinTime: 0,
}
}
cfg.DependencySetSource = depSet
// Create the supervisor with the configuration
super, err := supervisor.SupervisorFromConfig(context.Background(), &cfg, logger)
super, err := supervisor.SupervisorFromConfig(context.Background(), cfg, logger)
require.NoError(s.t, err)
// Start the supervisor
err = super.Start(context.Background())
Expand Down Expand Up @@ -495,7 +495,7 @@ func (s *interopE2ESystem) prepare(t *testing.T, w worldResourcePaths) {
ctx := context.Background()
for _, l2 := range s.l2s {
err := s.SupervisorClient().AddL2RPC(ctx, l2.l2Geth.UserRPC().RPC())
require.NoError(s.t, err, "failed to add L2 RPC to supervisor", "error", err)
require.NoError(s.t, err, "failed to add L2 RPC to supervisor")
}
}

Expand Down
4 changes: 4 additions & 0 deletions op-supervisor/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type Config struct {
// MockRun runs the service with a mock backend
MockRun bool

// SynchronousProcessors disables background-workers,
// requiring manual triggers for the backend to process anything.
SynchronousProcessors bool

L2RPCs []string
Datadir string
}
Expand Down
11 changes: 6 additions & 5 deletions op-supervisor/metrics/metrics.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package metrics

import (
"github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types"
"github.com/prometheus/client_golang/prometheus"

opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types"
)

const Namespace = "op_supervisor"
Expand All @@ -18,7 +18,7 @@ type Metricer interface {
CacheAdd(chainID types.ChainID, label string, cacheSize int, evicted bool)
CacheGet(chainID types.ChainID, label string, hit bool)

RecordDBEntryCount(chainID types.ChainID, count int64)
RecordDBEntryCount(chainID types.ChainID, kind string, count int64)
RecordDBSearchEntriesRead(chainID types.ChainID, count int64)

Document() []opmetrics.DocumentedMetric
Expand Down Expand Up @@ -106,9 +106,10 @@ func NewMetrics(procName string) *Metrics {
DBEntryCountVec: factory.NewGaugeVec(prometheus.GaugeOpts{
Namespace: ns,
Name: "logdb_entries_current",
Help: "Current number of entries in the log database by chain ID",
Help: "Current number of entries in the database of specified kind and chain ID",
}, []string{
"chain",
"kind",
}),
DBSearchEntriesReadVec: factory.NewHistogramVec(prometheus.HistogramOpts{
Namespace: ns,
Expand Down Expand Up @@ -159,8 +160,8 @@ func (m *Metrics) CacheGet(chainID types.ChainID, label string, hit bool) {
}
}

func (m *Metrics) RecordDBEntryCount(chainID types.ChainID, count int64) {
m.DBEntryCountVec.WithLabelValues(chainIDLabel(chainID)).Set(float64(count))
func (m *Metrics) RecordDBEntryCount(chainID types.ChainID, kind string, count int64) {
m.DBEntryCountVec.WithLabelValues(chainIDLabel(chainID), kind).Set(float64(count))
}

func (m *Metrics) RecordDBSearchEntriesRead(chainID types.ChainID, count int64) {
Expand Down
4 changes: 2 additions & 2 deletions op-supervisor/metrics/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func (*noopMetrics) RecordUp() {}
func (m *noopMetrics) CacheAdd(_ types.ChainID, _ string, _ int, _ bool) {}
func (m *noopMetrics) CacheGet(_ types.ChainID, _ string, _ bool) {}

func (m *noopMetrics) RecordDBEntryCount(_ types.ChainID, _ int64) {}
func (m *noopMetrics) RecordDBSearchEntriesRead(_ types.ChainID, _ int64) {}
func (m *noopMetrics) RecordDBEntryCount(_ types.ChainID, _ string, _ int64) {}
func (m *noopMetrics) RecordDBSearchEntriesRead(_ types.ChainID, _ int64) {}
Loading