Skip to content

Commit

Permalink
Call setExpvarOptions method inside Initialize
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>
  • Loading branch information
dstdfx committed Sep 22, 2020
1 parent 2123f10 commit 0bd8431
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func NewFactory(config FactoryConfig) (*Factory, error) {
}
f.factories[t] = ff
}
f.setExpvarOptions()
return f, nil
}

Expand Down Expand Up @@ -113,6 +112,7 @@ func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger)
return err
}
}
f.setExpvarOptions()
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions plugin/storage/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ func TestSetExpvarOptions(t *testing.T) {
f, err := NewFactory(defaultCfg())
require.NoError(t, err)

m := metrics.NullFactory
l := zap.NewNop()
f.Initialize(m, l)

gotDownsamplingRatio := expvar.Get(downsamplingRatio)

assert.Equal(t, f.DownsamplingRatio, gotDownsamplingRatio)
Expand Down

0 comments on commit 0bd8431

Please sign in to comment.