Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: chahatsagarmain <chahatsagar2003@gmail.com>
  • Loading branch information
chahatsagarmain committed Nov 14, 2024
1 parent 516dfe7 commit 70280ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerstorage/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (s *storageExt) Start(_ context.Context, host component.Host) error {
factory, err = badger.NewFactoryWithConfig(*cfg.Badger, mf, s.telset.Logger)
case cfg.GRPC != nil:
//nolint: contextcheck
factory, err = grpc.NewFactoryWithConfig(*cfg.GRPC, mf, s.telset.Logger, host, s.telset.MeterProvider)
factory, err = grpc.NewFactoryWithConfig(*cfg.GRPC, host, mf, s.telset)
case cfg.Cassandra != nil:
factory, err = cassandra.NewFactoryWithConfig(*cfg.Cassandra, mf, s.telset.Logger)
case cfg.Elasticsearch != nil:
Expand Down
10 changes: 4 additions & 6 deletions plugin/storage/grpc/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ func NewFactory() *Factory {
// NewFactoryWithConfig is used from jaeger(v2).
func NewFactoryWithConfig(
cfg Config,
metricsFactory metrics.Factory,
logger *zap.Logger,
host component.Host,
meterProvider metric.MeterProvider,
metricsFactory metrics.Factory,
telset component.TelemetrySettings,
) (*Factory, error) {
f := NewFactory()
f.config = cfg
f.host = host
f.meterProvider = meterProvider
if err := f.Initialize(metricsFactory, logger); err != nil {
f.meterProvider = telset.MeterProvider
if err := f.Initialize(metricsFactory, telset.Logger); err != nil {
return nil, err
}
return f, nil
Expand Down Expand Up @@ -238,7 +237,6 @@ func getTelset(logger *zap.Logger, tracerProvider trace.TracerProvider, meterPro
return component.TelemetrySettings{
Logger: logger,
TracerProvider: tracerProvider,
// TODO needs to be joined with the metricsFactory
LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider {
return meterProvider
},
Expand Down
14 changes: 11 additions & 3 deletions plugin/storage/grpc/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ func TestNewFactoryError(t *testing.T) {
Auth: &configauth.Authentication{},
},
}
telset := component.TelemetrySettings{
Logger: zap.NewNop(),
MeterProvider: noop.NewMeterProvider(),
}
t.Run("with_config", func(t *testing.T) {
_, err := NewFactoryWithConfig(*cfg, metrics.NullFactory, zap.NewNop(), componenttest.NewNopHost(), noop.NewMeterProvider())
_, err := NewFactoryWithConfig(*cfg, componenttest.NewNopHost(), metrics.NullFactory, telset)
assert.ErrorContains(t, err, "authenticator")
})

Expand All @@ -126,7 +130,7 @@ func TestNewFactoryError(t *testing.T) {
ClientConfig: configgrpc.ClientConfig{
Endpoint: ":0",
},
}, metrics.NullFactory, zap.NewNop(), componenttest.NewNopHost())
}, componenttest.NewNopHost(), metrics.NullFactory, telset)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, f.Close()) })
newClientFn := func(_ component.TelemetrySettings, _ ...grpc.DialOption) (conn *grpc.ClientConn, err error) {
Expand Down Expand Up @@ -177,7 +181,11 @@ func TestGRPCStorageFactoryWithConfig(t *testing.T) {
Enabled: true,
},
}
f, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop(), componenttest.NewNopHost(), noop.NewMeterProvider())
telset := component.TelemetrySettings{
Logger: zap.NewNop(),
MeterProvider: noop.NewMeterProvider(),
}
f, err := NewFactoryWithConfig(cfg, componenttest.NewNopHost(), metrics.NullFactory, telset)
require.NoError(t, err)
require.NoError(t, f.Close())
}
Expand Down

0 comments on commit 70280ea

Please sign in to comment.