Skip to content

Commit

Permalink
Using component for no op host instead of component test
Browse files Browse the repository at this point in the history
Signed-off-by: chahatsagarmain <[email protected]>
  • Loading branch information
chahatsagarmain committed Oct 6, 2024
1 parent f411b3c commit 1220b5d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions plugin/storage/grpc/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/spf13/viper"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
Expand Down Expand Up @@ -49,11 +48,21 @@ type Factory struct {
remoteConn *grpc.ClientConn
}

type nopHost struct{}

func NewNopHost() component.Host {
return &nopHost{}
}

// NewFactory creates a new Factory.
func NewFactory() *Factory {
return &Factory{}
}

func (*nopHost) GetExtensions() map[component.ID]component.Component {
return nil
}

// NewFactoryWithConfig is used from jaeger(v2).
func NewFactoryWithConfig(
cfg Config,
Expand Down Expand Up @@ -98,7 +107,8 @@ func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger)
for _, opt := range opts {
clientOpts = append(clientOpts, configgrpc.WithGrpcDialOption(opt))
}
return f.config.ToClientConn(context.Background(), componenttest.NewNopHost(), telset, clientOpts...)
noophost := NewNopHost()
return f.config.ToClientConn(context.Background(), noophost, telset, clientOpts...)
}

var err error
Expand Down

0 comments on commit 1220b5d

Please sign in to comment.