diff --git a/receiver/awsfirehosereceiver/factory.go b/receiver/awsfirehosereceiver/factory.go index 5058ad42064d..1e6b2347276f 100644 --- a/receiver/awsfirehosereceiver/factory.go +++ b/receiver/awsfirehosereceiver/factory.go @@ -13,7 +13,6 @@ import ( "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/metadata" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog" @@ -22,8 +21,7 @@ import ( ) const ( - defaultEndpoint = "0.0.0.0:4433" - defaultPort = 4433 + defaultEndpoint = "localhost:4433" ) var ( @@ -78,7 +76,7 @@ func defaultLogsUnmarshalers(logger *zap.Logger) map[string]unmarshaler.LogsUnma func createDefaultConfig() component.Config { return &Config{ ServerConfig: confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, }, } } diff --git a/receiver/awsxrayreceiver/factory.go b/receiver/awsxrayreceiver/factory.go index e0c802fa4778..d739fb14f807 100644 --- a/receiver/awsxrayreceiver/factory.go +++ b/receiver/awsxrayreceiver/factory.go @@ -12,12 +12,11 @@ import ( "go.opentelemetry.io/collector/receiver" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver/internal/metadata" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver/internal/udppoller" ) -const defaultPort = 2000 +const defaultEndpoint = "localhost:2000" // NewFactory creates a factory for AWS receiver. func NewFactory() receiver.Factory { @@ -33,7 +32,7 @@ func createDefaultConfig() component.Config { // https://github.com/aws/aws-xray-daemon/blob/master/pkg/cfg/cfg.go#L99 return &Config{ AddrConfig: confignet.AddrConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, Transport: udppoller.Transport, }, ProxyServer: proxy.DefaultConfig(), diff --git a/receiver/influxdbreceiver/factory.go b/receiver/influxdbreceiver/factory.go index 46f625bbf40b..0bad4bcdc7d4 100644 --- a/receiver/influxdbreceiver/factory.go +++ b/receiver/influxdbreceiver/factory.go @@ -11,11 +11,10 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver/internal/metadata" ) -const defaultPort = 8086 +const defaultEndpoint = "localhost:8086" func NewFactory() receiver.Factory { return receiver.NewFactory( @@ -28,7 +27,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ServerConfig: confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, }, } } diff --git a/receiver/jaegerreceiver/factory.go b/receiver/jaegerreceiver/factory.go index 7519e9148fbc..92d1f0cf5af9 100644 --- a/receiver/jaegerreceiver/factory.go +++ b/receiver/jaegerreceiver/factory.go @@ -16,7 +16,6 @@ import ( "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver/internal/metadata" ) @@ -27,11 +26,11 @@ const ( protoThriftBinary = "thrift_binary" protoThriftCompact = "thrift_compact" - // Default ports to bind to. - defaultGRPCPort = 14250 - defaultHTTPPort = 14268 - defaultThriftCompactPort = 6831 - defaultThriftBinaryPort = 6832 + // Default endpoints to bind to. + defaultGRPCEndpoint = "localhost:14250" + defaultHTTPEndpoint = "localhost:14268" + defaultThriftCompactEndpoint = "localhost:6831" + defaultThriftBinaryEndpoint = "localhost:6832" ) var disableJaegerReceiverRemoteSampling = featuregate.GlobalRegistry().MustRegister( @@ -54,19 +53,19 @@ func createDefaultConfig() component.Config { Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ - Endpoint: testutil.EndpointForPort(defaultGRPCPort), + Endpoint: defaultGRPCEndpoint, Transport: confignet.TransportTypeTCP, }, }, ThriftHTTP: &confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultHTTPPort), + Endpoint: defaultHTTPEndpoint, }, ThriftBinary: &ProtocolUDP{ - Endpoint: testutil.EndpointForPort(defaultThriftBinaryPort), + Endpoint: defaultThriftBinaryEndpoint, ServerConfigUDP: defaultServerConfigUDP(), }, ThriftCompact: &ProtocolUDP{ - Endpoint: testutil.EndpointForPort(defaultThriftCompactPort), + Endpoint: defaultThriftCompactEndpoint, ServerConfigUDP: defaultServerConfigUDP(), }, }, diff --git a/receiver/lokireceiver/factory.go b/receiver/lokireceiver/factory.go index 8faa7d0d128c..b645545f68f2 100644 --- a/receiver/lokireceiver/factory.go +++ b/receiver/lokireceiver/factory.go @@ -15,15 +15,12 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/lokireceiver/internal/metadata" ) const ( - defaultGRPCPort = 3600 - defaultHTTPPort = 3500 - defaultGRPCBindEndpoint = "0.0.0.0:3600" - defaultHTTPBindEndpoint = "0.0.0.0:3500" + defaultGRPCEndpoint = "localhost:3600" + defaultHTTPEndpoint = "localhost:3500" ) // NewFactory return a new receiver.Factory for loki receiver. @@ -39,12 +36,12 @@ func createDefaultConfig() component.Config { Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ - Endpoint: testutil.EndpointForPort(defaultGRPCPort), + Endpoint: defaultGRPCEndpoint, Transport: confignet.TransportTypeTCP, }, }, HTTP: &confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultHTTPPort), + Endpoint: defaultHTTPEndpoint, }, }, } diff --git a/receiver/lokireceiver/factory_test.go b/receiver/lokireceiver/factory_test.go index 608d57587dff..8866bffa9848 100644 --- a/receiver/lokireceiver/factory_test.go +++ b/receiver/lokireceiver/factory_test.go @@ -27,7 +27,7 @@ func TestCreateReceiver(t *testing.T) { cfg := factory.CreateDefaultConfig() cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ - Endpoint: defaultGRPCBindEndpoint, + Endpoint: defaultGRPCEndpoint, Transport: confignet.TransportTypeTCP, }, } diff --git a/receiver/opencensusreceiver/factory.go b/receiver/opencensusreceiver/factory.go index d406b1d6e911..be1633df2088 100644 --- a/receiver/opencensusreceiver/factory.go +++ b/receiver/opencensusreceiver/factory.go @@ -12,12 +12,11 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver/internal/metadata" ) -const grpcPort = 55678 +const grpcEndpoint = "localhost:55678" // NewFactory creates a new OpenCensus receiver factory. func NewFactory() receiver.Factory { @@ -32,7 +31,7 @@ func createDefaultConfig() component.Config { return &Config{ ServerConfig: configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ - Endpoint: testutil.EndpointForPort(grpcPort), + Endpoint: grpcEndpoint, Transport: confignet.TransportTypeTCP, }, // We almost write 0 bytes, so no need to tune WriteBufferSize. diff --git a/receiver/sapmreceiver/factory.go b/receiver/sapmreceiver/factory.go index dabaa4a6871d..f15b5e393e3d 100644 --- a/receiver/sapmreceiver/factory.go +++ b/receiver/sapmreceiver/factory.go @@ -17,13 +17,12 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver/internal/metadata" ) const ( - // Default port to bind to. - defaultPort = 7276 + // Default endpoint to bind to. + defaultEndpoint = "localhost:7276" ) // NewFactory creates a factory for SAPM receiver. @@ -37,7 +36,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ServerConfig: confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, }, } } diff --git a/receiver/signalfxreceiver/factory.go b/receiver/signalfxreceiver/factory.go index 428fdd2237cd..e115f1d8d9a4 100644 --- a/receiver/signalfxreceiver/factory.go +++ b/receiver/signalfxreceiver/factory.go @@ -16,7 +16,6 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver/internal/metadata" ) @@ -24,8 +23,8 @@ import ( const ( - // Default port to bind to. - defaultPort = 9943 + // Default endpoint to bind to. + defaultEndpoint = "localhost:9943" ) // NewFactory creates a factory for SignalFx receiver. @@ -40,7 +39,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ServerConfig: confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, }, } } diff --git a/receiver/skywalkingreceiver/factory.go b/receiver/skywalkingreceiver/factory.go index 933e97ca06bd..e376718870a2 100644 --- a/receiver/skywalkingreceiver/factory.go +++ b/receiver/skywalkingreceiver/factory.go @@ -19,7 +19,6 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/skywalkingreceiver/internal/metadata" ) @@ -29,9 +28,9 @@ const ( protoGRPC = "grpc" protoHTTP = "http" - // Default ports to bind to. - defaultGRPCPort = 11800 - defaultHTTPPort = 12800 + // Default endpoints to bind to. + defaultGRPCEndpoint = "localhost:11800" + defaultHTTPEndpoint = "localhost:12800" ) // NewFactory creates a new Skywalking receiver factory. @@ -49,12 +48,12 @@ func createDefaultConfig() component.Config { Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ - Endpoint: testutil.EndpointForPort(defaultGRPCPort), + Endpoint: defaultGRPCEndpoint, Transport: confignet.TransportTypeTCP, }, }, HTTP: &confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultHTTPPort), + Endpoint: defaultHTTPEndpoint, }, }, } diff --git a/receiver/splunkhecreceiver/factory.go b/receiver/splunkhecreceiver/factory.go index ffbd2ad9f534..916f2d8c651c 100644 --- a/receiver/splunkhecreceiver/factory.go +++ b/receiver/splunkhecreceiver/factory.go @@ -12,7 +12,6 @@ import ( "go.opentelemetry.io/collector/receiver" conventions "go.opentelemetry.io/collector/semconv/v1.27.0" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver/internal/metadata" @@ -21,8 +20,8 @@ import ( // This file implements factory for Splunk HEC receiver. const ( - // Default endpoints to bind to. - defaultPort = 8088 + // Default endpoint to bind to. + defaultEndpoint = "localhost:8088" ) // NewFactory creates a factory for Splunk HEC receiver. @@ -38,7 +37,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ServerConfig: confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, }, AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{}, HecToOtelAttrs: splunk.HecToOtelAttrs{ diff --git a/receiver/zipkinreceiver/factory.go b/receiver/zipkinreceiver/factory.go index dd86d7d9c477..d4bdbf9342db 100644 --- a/receiver/zipkinreceiver/factory.go +++ b/receiver/zipkinreceiver/factory.go @@ -11,15 +11,13 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver/internal/metadata" ) // This file implements factory for Zipkin receiver. const ( - defaultHTTPPort = 9411 - defaultBindEndpoint = "localhost:9411" + defaultHTTPEndpoint = "localhost:9411" ) // NewFactory creates a new Zipkin receiver factory @@ -35,7 +33,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ServerConfig: confighttp.ServerConfig{ - Endpoint: testutil.EndpointForPort(defaultHTTPPort), + Endpoint: defaultHTTPEndpoint, }, ParseStringTags: false, } diff --git a/receiver/zookeeperreceiver/factory.go b/receiver/zookeeperreceiver/factory.go index 57cdbf82276a..2aded7155e7f 100644 --- a/receiver/zookeeperreceiver/factory.go +++ b/receiver/zookeeperreceiver/factory.go @@ -14,12 +14,11 @@ import ( "go.opentelemetry.io/collector/scraper" "go.opentelemetry.io/collector/scraper/scraperhelper" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver/internal/metadata" ) const ( - defaultPort = 2181 + defaultEndpoint = "localhost:2181" defaultCollectionInterval = 10 * time.Second defaultTimeout = 10 * time.Second ) @@ -40,7 +39,7 @@ func createDefaultConfig() component.Config { return &Config{ ControllerConfig: cfg, TCPAddrConfig: confignet.TCPAddrConfig{ - Endpoint: testutil.EndpointForPort(defaultPort), + Endpoint: defaultEndpoint, }, MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), }