diff --git a/reconciler/example/main.go b/reconciler/example/main.go index ce553cf..682f66f 100644 --- a/reconciler/example/main.go +++ b/reconciler/example/main.go @@ -131,7 +131,7 @@ var Hive = hive.New( ), ) -func NewReconcilerConfig(ops reconciler.Operations[*Memo], m reconciler.Metrics) reconciler.Config[*Memo] { +func NewReconcilerConfig(ops reconciler.Operations[*Memo], m *reconciler.ExpVarMetrics) reconciler.Config[*Memo] { return reconciler.Config[*Memo]{ Metrics: m, FullReconcilationInterval: 10 * time.Second, diff --git a/reconciler/metrics.go b/reconciler/metrics.go index 609aacb..8987d6c 100644 --- a/reconciler/metrics.go +++ b/reconciler/metrics.go @@ -70,7 +70,15 @@ func (m *ExpVarMetrics) IncrementalReconciliationErrors(moduleID cell.FullModule var _ Metrics = &ExpVarMetrics{} -func NewExpVarMetrics(publish bool) *ExpVarMetrics { +func NewExpVarMetrics() *ExpVarMetrics { + return newExpVarMetrics(true) +} + +func NewUnpublishedExpVarMetrics() *ExpVarMetrics { + return newExpVarMetrics(false) +} + +func newExpVarMetrics(publish bool) *ExpVarMetrics { newMap := func(name string) *expvar.Map { if publish { return expvar.NewMap(name) diff --git a/reconciler/reconciler.go b/reconciler/reconciler.go index 6be0098..b93de76 100644 --- a/reconciler/reconciler.go +++ b/reconciler/reconciler.go @@ -31,7 +31,7 @@ func New[Obj comparable](p Params[Obj]) (Reconciler[Obj], error) { } if p.Config.Metrics == nil { - p.Config.Metrics = NewExpVarMetrics(false) + p.Config.Metrics = NewUnpublishedExpVarMetrics() } idx := p.Table.PrimaryIndexer() diff --git a/reconciler/reconciler_test.go b/reconciler/reconciler_test.go index b46bc11..12bf36b 100644 --- a/reconciler/reconciler_test.go +++ b/reconciler/reconciler_test.go @@ -56,7 +56,7 @@ func testReconciler(t *testing.T, batchOps bool) { fakeHealth *cell.SimpleHealth ) - expVarMetrics := reconciler.NewExpVarMetrics(false) + expVarMetrics := reconciler.NewUnpublishedExpVarMetrics() testObjects, err := statedb.NewTable[*testObject]("test-objects", idIndex, statusIndex) require.NoError(t, err, "NewTable")