Skip to content

Commit b4abab6

Browse files
committed
Revert "Use OTEL component host instead of no op host for prod code (jaegertracing#6085)"
This reverts commit bec885e.
1 parent 442318e commit b4abab6

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

cmd/jaeger/internal/extension/jaegerstorage/extension.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func newStorageExt(config *Config, telset component.TelemetrySettings) *storageE
112112
}
113113
}
114114

115-
func (s *storageExt) Start(_ context.Context, host component.Host) error {
115+
func (s *storageExt) Start(_ context.Context, _ component.Host) error {
116116
baseFactory := otelmetrics.NewFactory(s.telset.MeterProvider)
117117
mf := baseFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
118118
for storageName, cfg := range s.config.Backends {
@@ -126,7 +126,7 @@ func (s *storageExt) Start(_ context.Context, host component.Host) error {
126126
factory, err = badger.NewFactoryWithConfig(*cfg.Badger, mf, s.telset.Logger)
127127
case cfg.GRPC != nil:
128128
//nolint: contextcheck
129-
factory, err = grpc.NewFactoryWithConfig(*cfg.GRPC, mf, s.telset.Logger, host)
129+
factory, err = grpc.NewFactoryWithConfig(*cfg.GRPC, mf, s.telset.Logger)
130130
case cfg.Cassandra != nil:
131131
factory, err = cassandra.NewFactoryWithConfig(*cfg.Cassandra, mf, s.telset.Logger)
132132
case cfg.Elasticsearch != nil:

plugin/storage/grpc/factory.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,21 @@ type Factory struct {
4747
config Config
4848
services *ClientPluginServices
4949
remoteConn *grpc.ClientConn
50-
host component.Host
5150
}
5251

5352
// NewFactory creates a new Factory.
5453
func NewFactory() *Factory {
55-
return &Factory{
56-
host: componenttest.NewNopHost(),
57-
}
54+
return &Factory{}
5855
}
5956

6057
// NewFactoryWithConfig is used from jaeger(v2).
6158
func NewFactoryWithConfig(
6259
cfg Config,
6360
metricsFactory metrics.Factory,
6461
logger *zap.Logger,
65-
host component.Host,
6662
) (*Factory, error) {
6763
f := NewFactory()
6864
f.config = cfg
69-
f.host = host
7065
if err := f.Initialize(metricsFactory, logger); err != nil {
7166
return nil, err
7267
}
@@ -103,7 +98,7 @@ func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger)
10398
for _, opt := range opts {
10499
clientOpts = append(clientOpts, configgrpc.WithGrpcDialOption(opt))
105100
}
106-
return f.config.ToClientConn(context.Background(), f.host, telset, clientOpts...)
101+
return f.config.ToClientConn(context.Background(), componenttest.NewNopHost(), telset, clientOpts...)
107102
}
108103

109104
var err error

plugin/storage/grpc/factory_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/stretchr/testify/mock"
1717
"github.com/stretchr/testify/require"
1818
"go.opentelemetry.io/collector/component"
19-
"go.opentelemetry.io/collector/component/componenttest"
2019
"go.opentelemetry.io/collector/config/configauth"
2120
"go.opentelemetry.io/collector/config/configgrpc"
2221
"go.opentelemetry.io/collector/exporter/exporterhelper"
@@ -106,7 +105,7 @@ func TestNewFactoryError(t *testing.T) {
106105
},
107106
}
108107
t.Run("with_config", func(t *testing.T) {
109-
_, err := NewFactoryWithConfig(*cfg, metrics.NullFactory, zap.NewNop(), componenttest.NewNopHost())
108+
_, err := NewFactoryWithConfig(*cfg, metrics.NullFactory, zap.NewNop())
110109
require.Error(t, err)
111110
assert.Contains(t, err.Error(), "authenticator")
112111
})
@@ -122,7 +121,7 @@ func TestNewFactoryError(t *testing.T) {
122121

123122
t.Run("client", func(t *testing.T) {
124123
// this is a silly test to verify handling of error from grpc.NewClient, which cannot be induced via params.
125-
f, err := NewFactoryWithConfig(Config{}, metrics.NullFactory, zap.NewNop(), componenttest.NewNopHost())
124+
f, err := NewFactoryWithConfig(Config{}, metrics.NullFactory, zap.NewNop())
126125
require.NoError(t, err)
127126
t.Cleanup(func() { require.NoError(t, f.Close()) })
128127
newClientFn := func(_ ...grpc.DialOption) (conn *grpc.ClientConn, err error) {
@@ -174,7 +173,7 @@ func TestGRPCStorageFactoryWithConfig(t *testing.T) {
174173
Enabled: true,
175174
},
176175
}
177-
f, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop(), componenttest.NewNopHost())
176+
f, err := NewFactoryWithConfig(cfg, metrics.NullFactory, zap.NewNop())
178177
require.NoError(t, err)
179178
require.NoError(t, f.Close())
180179
}

0 commit comments

Comments
 (0)