From d67a5de3d355cd377045b2fbc644b1b59ce5d5a8 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Fri, 27 Dec 2024 11:38:11 -0500 Subject: [PATCH] simplify Signed-off-by: Yuri Shkuro --- receiver/jaegerreceiver/config.go | 24 ++++----- receiver/jaegerreceiver/config_test.go | 16 +++--- receiver/jaegerreceiver/factory.go | 24 ++------- receiver/jaegerreceiver/factory_test.go | 12 ++--- receiver/jaegerreceiver/jaeger_agent_test.go | 26 +++++----- receiver/jaegerreceiver/trace_receiver.go | 52 ++++++------------- .../jaegerreceiver/trace_receiver_test.go | 26 +++++----- 7 files changed, 71 insertions(+), 109 deletions(-) diff --git a/receiver/jaegerreceiver/config.go b/receiver/jaegerreceiver/config.go index bfa43c09e3c8..adb5b087778a 100644 --- a/receiver/jaegerreceiver/config.go +++ b/receiver/jaegerreceiver/config.go @@ -37,10 +37,10 @@ type RemoteSamplingConfig struct { // Protocols is the configuration for the supported protocols. type Protocols struct { - GRPC *configgrpc.ServerConfig `mapstructure:"grpc"` - ThriftHTTP *confighttp.ServerConfig `mapstructure:"thrift_http"` - ThriftBinary *ProtocolUDP `mapstructure:"thrift_binary"` - ThriftCompact *ProtocolUDP `mapstructure:"thrift_compact"` + GRPC *configgrpc.ServerConfig `mapstructure:"grpc"` + ThriftHTTP *confighttp.ServerConfig `mapstructure:"thrift_http"` + ThriftBinaryUDP *ProtocolUDP `mapstructure:"thrift_binary"` + ThriftCompactUDP *ProtocolUDP `mapstructure:"thrift_compact"` } // ProtocolUDP is the configuration for a UDP protocol. @@ -82,8 +82,8 @@ var ( func (cfg *Config) Validate() error { if cfg.GRPC == nil && cfg.ThriftHTTP == nil && - cfg.ThriftBinary == nil && - cfg.ThriftCompact == nil { + cfg.ThriftBinaryUDP == nil && + cfg.ThriftCompactUDP == nil { return errors.New("must specify at least one protocol when using the Jaeger receiver") } @@ -99,14 +99,14 @@ func (cfg *Config) Validate() error { } } - if cfg.ThriftBinary != nil { - if err := checkPortFromEndpoint(cfg.ThriftBinary.Endpoint); err != nil { + if cfg.ThriftBinaryUDP != nil { + if err := checkPortFromEndpoint(cfg.ThriftBinaryUDP.Endpoint); err != nil { return fmt.Errorf("invalid port number for the Thrift UDP Binary endpoint: %w", err) } } - if cfg.ThriftCompact != nil { - if err := checkPortFromEndpoint(cfg.ThriftCompact.Endpoint); err != nil { + if cfg.ThriftCompactUDP != nil { + if err := checkPortFromEndpoint(cfg.ThriftCompactUDP.Endpoint); err != nil { return fmt.Errorf("invalid port number for the Thrift UDP Compact endpoint: %w", err) } } @@ -145,10 +145,10 @@ func (cfg *Config) Unmarshal(componentParser *confmap.Conf) error { cfg.ThriftHTTP = nil } if !protocols.IsSet(protoThriftBinary) { - cfg.ThriftBinary = nil + cfg.ThriftBinaryUDP = nil } if !protocols.IsSet(protoThriftCompact) { - cfg.ThriftCompact = nil + cfg.ThriftCompactUDP = nil } return nil diff --git a/receiver/jaegerreceiver/config_test.go b/receiver/jaegerreceiver/config_test.go index ee9a05b6e23d..e2bcaeb154c6 100644 --- a/receiver/jaegerreceiver/config_test.go +++ b/receiver/jaegerreceiver/config_test.go @@ -42,7 +42,7 @@ func TestLoadConfig(t *testing.T) { ThriftHTTP: &confighttp.ServerConfig{ Endpoint: ":3456", }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:456", ServerConfigUDP: ServerConfigUDP{ QueueSize: 100_000, @@ -51,7 +51,7 @@ func TestLoadConfig(t *testing.T) { SocketBufferSize: 65_536, }, }, - ThriftBinary: &ProtocolUDP{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:789", ServerConfigUDP: ServerConfigUDP{ QueueSize: 1_000, @@ -76,11 +76,11 @@ func TestLoadConfig(t *testing.T) { ThriftHTTP: &confighttp.ServerConfig{ Endpoint: "localhost:14268", }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "localhost:6831", ServerConfigUDP: defaultServerConfigUDP(), }, - ThriftBinary: &ProtocolUDP{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: "localhost:6832", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -97,7 +97,7 @@ func TestLoadConfig(t *testing.T) { Transport: confignet.TransportTypeTCP, }, }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "localhost:6831", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -183,7 +183,7 @@ func TestInvalidConfig(t *testing.T) { { desc: "thrift-udp-compact-no-port", apply: func(cfg *Config) { - cfg.ThriftCompact = &ProtocolUDP{ + cfg.ThriftCompactUDP = &ProtocolUDP{ Endpoint: "localhost:", } }, @@ -192,7 +192,7 @@ func TestInvalidConfig(t *testing.T) { { desc: "thrift-udp-binary-no-port", apply: func(cfg *Config) { - cfg.ThriftBinary = &ProtocolUDP{ + cfg.ThriftBinaryUDP = &ProtocolUDP{ Endpoint: "localhost:", } }, @@ -220,7 +220,7 @@ func TestInvalidConfig(t *testing.T) { { desc: "port-outside-of-range", apply: func(cfg *Config) { - cfg.ThriftBinary = &ProtocolUDP{ + cfg.ThriftBinaryUDP = &ProtocolUDP{ Endpoint: "localhost:65536", } }, diff --git a/receiver/jaegerreceiver/factory.go b/receiver/jaegerreceiver/factory.go index 7519e9148fbc..d1c547f17ba7 100644 --- a/receiver/jaegerreceiver/factory.go +++ b/receiver/jaegerreceiver/factory.go @@ -61,11 +61,11 @@ func createDefaultConfig() component.Config { ThriftHTTP: &confighttp.ServerConfig{ Endpoint: testutil.EndpointForPort(defaultHTTPPort), }, - ThriftBinary: &ProtocolUDP{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: testutil.EndpointForPort(defaultThriftBinaryPort), ServerConfigUDP: defaultServerConfigUDP(), }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: testutil.EndpointForPort(defaultThriftCompactPort), ServerConfigUDP: defaultServerConfigUDP(), }, @@ -86,28 +86,10 @@ func createTracesReceiver( rCfg := cfg.(*Config) - var config configuration - // Set ports - if rCfg.Protocols.GRPC != nil { - config.GRPCServerConfig = *rCfg.Protocols.GRPC - } - - if rCfg.Protocols.ThriftHTTP != nil { - config.HTTPServerConfig = *rCfg.ThriftHTTP - } - - if rCfg.Protocols.ThriftBinary != nil { - config.AgentBinaryThrift = *rCfg.ThriftBinary - } - - if rCfg.Protocols.ThriftCompact != nil { - config.AgentCompactThrift = *rCfg.ThriftCompact - } - if rCfg.RemoteSampling != nil { set.Logger.Warn("You are using a deprecated no-op `remote_sampling` option which will be removed soon; use a `jaegerremotesampling` extension instead") } // Create the receiver. - return newJaegerReceiver(set.ID, &config, nextConsumer, set) + return newJaegerReceiver(set.ID, rCfg.Protocols, nextConsumer, set) } diff --git a/receiver/jaegerreceiver/factory_test.go b/receiver/jaegerreceiver/factory_test.go index 194a5dcaebcb..6c809c823891 100644 --- a/receiver/jaegerreceiver/factory_test.go +++ b/receiver/jaegerreceiver/factory_test.go @@ -91,7 +91,7 @@ func TestCreateDefaultGRPCEndpoint(t *testing.T) { r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "0.0.0.0:14250", r.(*jReceiver).config.GRPCServerConfig.NetAddr.Endpoint, "grpc port should be default") + assert.Equal(t, "0.0.0.0:14250", r.(*jReceiver).config.GRPC.NetAddr.Endpoint, "grpc port should be default") } func TestCreateTLSGPRCEndpoint(t *testing.T) { @@ -144,33 +144,33 @@ func TestCreateInvalidHTTPEndpoint(t *testing.T) { r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "localhost:14268", r.(*jReceiver).config.HTTPServerConfig.Endpoint, "http port should be default") + assert.Equal(t, "localhost:14268", r.(*jReceiver).config.ThriftHTTP.Endpoint, "http port should be default") } func TestCreateInvalidThriftBinaryEndpoint(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - cfg.(*Config).Protocols.ThriftBinary = &ProtocolUDP{ + cfg.(*Config).Protocols.ThriftBinaryUDP = &ProtocolUDP{ Endpoint: "0.0.0.0:6832", } set := receivertest.NewNopSettings() r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "0.0.0.0:6832", r.(*jReceiver).config.AgentBinaryThrift.Endpoint, "thrift port should be default") + assert.Equal(t, "0.0.0.0:6832", r.(*jReceiver).config.ThriftBinaryUDP.Endpoint, "thrift port should be default") } func TestCreateInvalidThriftCompactEndpoint(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - cfg.(*Config).Protocols.ThriftCompact = &ProtocolUDP{ + cfg.(*Config).Protocols.ThriftCompactUDP = &ProtocolUDP{ Endpoint: "0.0.0.0:6831", } set := receivertest.NewNopSettings() r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "0.0.0.0:6831", r.(*jReceiver).config.AgentCompactThrift.Endpoint, "thrift port should be default") + assert.Equal(t, "0.0.0.0:6831", r.(*jReceiver).config.ThriftCompactUDP.Endpoint, "thrift port should be default") } diff --git a/receiver/jaegerreceiver/jaeger_agent_test.go b/receiver/jaegerreceiver/jaeger_agent_test.go index 4f062410661e..4e23cbda9696 100644 --- a/receiver/jaegerreceiver/jaeger_agent_test.go +++ b/receiver/jaegerreceiver/jaeger_agent_test.go @@ -33,8 +33,8 @@ var jaegerAgent = component.NewIDWithName(metadata.Type, "agent_test") func TestJaegerAgentUDP_ThriftCompact(t *testing.T) { addr := testutil.GetAvailableLocalAddress(t) - testJaegerAgent(t, addr, &configuration{ - AgentCompactThrift: ProtocolUDP{ + testJaegerAgent(t, addr, Protocols{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: addr, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -42,8 +42,8 @@ func TestJaegerAgentUDP_ThriftCompact(t *testing.T) { } func TestJaegerAgentUDP_ThriftCompact_InvalidPort(t *testing.T) { - config := &configuration{ - AgentCompactThrift: ProtocolUDP{ + config := Protocols{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:999999", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -59,8 +59,8 @@ func TestJaegerAgentUDP_ThriftCompact_InvalidPort(t *testing.T) { func TestJaegerAgentUDP_ThriftBinary(t *testing.T) { addr := testutil.GetAvailableLocalAddress(t) - testJaegerAgent(t, addr, &configuration{ - AgentBinaryThrift: ProtocolUDP{ + testJaegerAgent(t, addr, Protocols{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: addr, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -71,8 +71,8 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { // This test confirms that the thrift binary port is opened correctly. This is all we can test at the moment. See above. addr := testutil.GetAvailableLocalAddress(t) - config := &configuration{ - AgentBinaryThrift: ProtocolUDP{ + config := Protocols{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: addr, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -81,7 +81,7 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { jr, err := newJaegerReceiver(jaegerAgent, config, nil, set) require.NoError(t, err) - assert.NoError(t, jr.startAgent(componenttest.NewNopHost()), "Start failed") + assert.NoError(t, jr.startAgent(), "Start failed") t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) l, err := net.Listen("udp", addr) @@ -93,8 +93,8 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { } func TestJaegerAgentUDP_ThriftBinary_InvalidPort(t *testing.T) { - config := &configuration{ - AgentBinaryThrift: ProtocolUDP{ + config := Protocols{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:999999", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -108,7 +108,7 @@ func TestJaegerAgentUDP_ThriftBinary_InvalidPort(t *testing.T) { require.NoError(t, jr.Shutdown(context.Background())) } -func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig *configuration) { +func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig Protocols) { // 1. Create the Jaeger receiver aka "server" sink := new(consumertest.TracesSink) set := receivertest.NewNopSettings() @@ -127,7 +127,7 @@ func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig *configu require.NoError(t, err, "Start failed") // 2. Then send spans to the Jaeger receiver. - jexp, err := newClientUDP(agentEndpoint, jr.config.AgentBinaryThrift.Endpoint != "") + jexp, err := newClientUDP(agentEndpoint, jr.config.ThriftBinaryUDP != nil) require.NoError(t, err, "Failed to create the Jaeger OpenTelemetry exporter for the live application") // 3. Now finally send some spans diff --git a/receiver/jaegerreceiver/trace_receiver.go b/receiver/jaegerreceiver/trace_receiver.go index feb39dc7c83d..af204faa68f0 100644 --- a/receiver/jaegerreceiver/trace_receiver.go +++ b/receiver/jaegerreceiver/trace_receiver.go @@ -26,8 +26,6 @@ import ( "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" - "go.opentelemetry.io/collector/config/configgrpc" - "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receiverhelper" @@ -37,23 +35,13 @@ import ( jaegertranslator "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger" ) -// configuration defines the behavior and the ports that -// the Jaeger receiver will use. -type configuration struct { - HTTPServerConfig confighttp.ServerConfig - GRPCServerConfig configgrpc.ServerConfig - - AgentCompactThrift ProtocolUDP - AgentBinaryThrift ProtocolUDP -} - // Receiver type is used to receive spans that were originally intended to be sent to Jaeger. // This receiver is basically a Jaeger collector. type jReceiver struct { nextConsumer consumer.Traces id component.ID - config *configuration + config Protocols grpc *grpc.Server collectorServer *http.Server @@ -88,7 +76,7 @@ var acceptedThriftFormats = map[string]struct{}{ // also as a Jaeger agent. func newJaegerReceiver( id component.ID, - config *configuration, + config Protocols, nextConsumer consumer.Traces, set receiver.Settings, ) (*jReceiver, error) { @@ -120,7 +108,7 @@ func newJaegerReceiver( } func (jr *jReceiver) Start(ctx context.Context, host component.Host) error { - if err := jr.startAgent(host); err != nil { + if err := jr.startAgent(); err != nil { return err } @@ -206,12 +194,8 @@ func (jr *jReceiver) PostSpans(ctx context.Context, r *api_v2.PostSpansRequest) return &api_v2.PostSpansResponse{}, nil } -func (jr *jReceiver) startAgent(host component.Host) error { - if jr.config == nil { - return nil - } - - if jr.config.AgentBinaryThrift.Endpoint != "" { +func (jr *jReceiver) startAgent() error { + if jr.config.ThriftBinaryUDP != nil { obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: jr.id, Transport: agentTransportBinary, @@ -225,14 +209,14 @@ func (jr *jReceiver) startAgent(host component.Host) error { nextConsumer: jr.nextConsumer, obsrecv: obsrecv, } - processor, err := jr.buildProcessor(jr.config.AgentBinaryThrift.Endpoint, jr.config.AgentBinaryThrift.ServerConfigUDP, apacheThrift.NewTBinaryProtocolFactoryConf(nil), h) + processor, err := jr.buildProcessor(jr.config.ThriftBinaryUDP.Endpoint, jr.config.ThriftBinaryUDP.ServerConfigUDP, apacheThrift.NewTBinaryProtocolFactoryConf(nil), h) if err != nil { return err } jr.agentProcessors = append(jr.agentProcessors, processor) } - if jr.config.AgentCompactThrift.Endpoint != "" { + if jr.config.ThriftCompactUDP != nil { obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: jr.id, Transport: agentTransportCompact, @@ -245,7 +229,7 @@ func (jr *jReceiver) startAgent(host component.Host) error { nextConsumer: jr.nextConsumer, obsrecv: obsrecv, } - processor, err := jr.buildProcessor(jr.config.AgentCompactThrift.Endpoint, jr.config.AgentCompactThrift.ServerConfigUDP, apacheThrift.NewTCompactProtocolFactoryConf(nil), h) + processor, err := jr.buildProcessor(jr.config.ThriftCompactUDP.Endpoint, jr.config.ThriftCompactUDP.ServerConfigUDP, apacheThrift.NewTCompactProtocolFactoryConf(nil), h) if err != nil { return err } @@ -341,20 +325,16 @@ func (jr *jReceiver) HandleThriftHTTPBatch(w http.ResponseWriter, r *http.Reques } func (jr *jReceiver) startCollector(ctx context.Context, host component.Host) error { - if jr.config == nil { - return nil - } - - if jr.config.HTTPServerConfig.Endpoint != "" { - cln, err := jr.config.HTTPServerConfig.ToListener(ctx) + if jr.config.ThriftHTTP != nil { + cln, err := jr.config.ThriftHTTP.ToListener(ctx) if err != nil { return fmt.Errorf("failed to bind to Collector address %q: %w", - jr.config.HTTPServerConfig.Endpoint, err) + jr.config.ThriftHTTP.Endpoint, err) } nr := mux.NewRouter() nr.HandleFunc("/api/traces", jr.HandleThriftHTTPBatch).Methods(http.MethodPost) - jr.collectorServer, err = jr.config.HTTPServerConfig.ToServer(ctx, host, jr.settings.TelemetrySettings, nr) + jr.collectorServer, err = jr.config.ThriftHTTP.ToServer(ctx, host, jr.settings.TelemetrySettings, nr) if err != nil { return err } @@ -368,16 +348,16 @@ func (jr *jReceiver) startCollector(ctx context.Context, host component.Host) er }() } - if jr.config.GRPCServerConfig.NetAddr.Endpoint != "" { + if jr.config.GRPC != nil { var err error - jr.grpc, err = jr.config.GRPCServerConfig.ToServer(ctx, host, jr.settings.TelemetrySettings) + jr.grpc, err = jr.config.GRPC.ToServer(ctx, host, jr.settings.TelemetrySettings) if err != nil { return fmt.Errorf("failed to build the options for the Jaeger gRPC Collector: %w", err) } - ln, err := jr.config.GRPCServerConfig.NetAddr.Listen(ctx) + ln, err := jr.config.GRPC.NetAddr.Listen(ctx) if err != nil { - return fmt.Errorf("failed to bind to gRPC address %q: %w", jr.config.GRPCServerConfig.NetAddr, err) + return fmt.Errorf("failed to bind to gRPC address %q: %w", jr.config.GRPC.NetAddr, err) } api_v2.RegisterCollectorServiceServer(jr.grpc, jr) diff --git a/receiver/jaegerreceiver/trace_receiver_test.go b/receiver/jaegerreceiver/trace_receiver_test.go index 31062bf57791..5377850bdc12 100644 --- a/receiver/jaegerreceiver/trace_receiver_test.go +++ b/receiver/jaegerreceiver/trace_receiver_test.go @@ -45,7 +45,7 @@ var jaegerReceiver = component.MustNewIDWithName("jaeger", "receiver_test") func TestTraceSource(t *testing.T) { set := receivertest.NewNopSettings() - jr, err := newJaegerReceiver(jaegerReceiver, &configuration{}, nil, set) + jr, err := newJaegerReceiver(jaegerReceiver, Protocols{}, nil, set) require.NoError(t, err) require.NotNil(t, jr) } @@ -77,8 +77,8 @@ func TestThriftHTTPBodyDecode(t *testing.T) { func TestReception(t *testing.T) { addr := testutil.GetAvailableLocalAddress(t) // 1. Create the Jaeger receiver aka "server" - config := &configuration{ - HTTPServerConfig: confighttp.ServerConfig{ + config := Protocols{ + ThriftHTTP: &confighttp.ServerConfig{ Endpoint: addr, }, } @@ -110,7 +110,7 @@ func TestReception(t *testing.T) { func TestPortsNotOpen(t *testing.T) { // an empty config should result in no open ports - config := &configuration{} + config := Protocols{} sink := new(consumertest.TracesSink) @@ -139,8 +139,8 @@ func TestPortsNotOpen(t *testing.T) { func TestGRPCReception(t *testing.T) { // prepare - config := &configuration{ - GRPCServerConfig: configgrpc.ServerConfig{ + config := Protocols{ + GRPC: &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: confignet.TransportTypeTCP, @@ -156,7 +156,7 @@ func TestGRPCReception(t *testing.T) { require.NoError(t, jr.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) - conn, err := grpc.NewClient(config.GRPCServerConfig.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.NewClient(config.GRPC.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) defer conn.Close() @@ -194,7 +194,7 @@ func TestGRPCReceptionWithTLS(t *testing.T) { }, } - grpcServerSettings := configgrpc.ServerConfig{ + grpcServerSettings := &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: confignet.TransportTypeTCP, @@ -202,8 +202,8 @@ func TestGRPCReceptionWithTLS(t *testing.T) { TLSSetting: tlsCreds, } - config := &configuration{ - GRPCServerConfig: grpcServerSettings, + config := Protocols{ + GRPC: grpcServerSettings, } sink := new(consumertest.TracesSink) @@ -335,8 +335,8 @@ func grpcFixture(t *testing.T, t1 time.Time, d1, d2 time.Duration) *api_v2.PostS } func TestSampling(t *testing.T) { - config := &configuration{ - GRPCServerConfig: configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ + config := Protocols{ + GRPC: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: confignet.TransportTypeTCP, }}, @@ -350,7 +350,7 @@ func TestSampling(t *testing.T) { require.NoError(t, jr.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) - conn, err := grpc.NewClient(config.GRPCServerConfig.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.NewClient(config.GRPC.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) defer conn.Close()