diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c3c2153776..1475f9bc0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - Deprecated `receiverhelper.WithMetrics` in favour of `component.WithMetricsReceiver` - Deprecated `receiverhelper.WithLogs` in favour of `component.WithLogsReceiver` - Deprecated `receiverhelper.NewFactory` in favour of `component.NewReceiverFactory` +- Remove support for legacy otlp/http port. (#4916) ### 💡 Enhancements 💡 diff --git a/receiver/otlpreceiver/factory.go b/receiver/otlpreceiver/factory.go index ca4dc3ec3e3..707ace1beae 100644 --- a/receiver/otlpreceiver/factory.go +++ b/receiver/otlpreceiver/factory.go @@ -31,7 +31,6 @@ const ( defaultGRPCEndpoint = "0.0.0.0:4317" defaultHTTPEndpoint = "0.0.0.0:4318" - legacyHTTPEndpoint = "0.0.0.0:55681" ) // NewFactory creates a new OTLP receiver factory. diff --git a/receiver/otlpreceiver/otlp.go b/receiver/otlpreceiver/otlp.go index 35a735a7b9c..94a64d8425b 100644 --- a/receiver/otlpreceiver/otlp.go +++ b/receiver/otlpreceiver/otlp.go @@ -143,22 +143,6 @@ func (r *otlpReceiver) startProtocolServers(host component.Host) error { if err != nil { return err } - if r.cfg.HTTP.Endpoint == defaultHTTPEndpoint { - r.settings.Logger.Info("Setting up a second HTTP listener on legacy endpoint " + legacyHTTPEndpoint) - - // Copy the config. - cfgLegacyHTTP := *(r.cfg.HTTP) - // And use the legacy endpoint. - cfgLegacyHTTP.Endpoint = legacyHTTPEndpoint - err = r.startHTTPServer(&cfgLegacyHTTP, host) - if err != nil { - return err - } - } - if r.cfg.HTTP.Endpoint == legacyHTTPEndpoint { - r.settings.Logger.Warn(fmt.Sprintf("Legacy HTTP endpoint %v is configured, please use %v instead.", - legacyHTTPEndpoint, defaultHTTPEndpoint)) - } } return err diff --git a/receiver/otlpreceiver/otlp_test.go b/receiver/otlpreceiver/otlp_test.go index b404627d9e5..4fba3596a56 100644 --- a/receiver/otlpreceiver/otlp_test.go +++ b/receiver/otlpreceiver/otlp_test.go @@ -24,14 +24,11 @@ import ( "io/ioutil" "net" "net/http" - "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/zap" - "go.uber.org/zap/zaptest/observer" spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -49,7 +46,6 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/internal/internalconsumertest" - "go.opentelemetry.io/collector/internal/sharedcomponent" "go.opentelemetry.io/collector/internal/testdata" "go.opentelemetry.io/collector/internal/testutil" "go.opentelemetry.io/collector/model/otlp" @@ -770,41 +766,6 @@ func TestHTTPInvalidTLSCredentials(t *testing.T) { `failed to load TLS config: for auth via TLS, either both certificate and key must be supplied, or neither`) } -func TestHTTPUseLegacyPortWhenUsingDefaultEndpoint(t *testing.T) { - r := newHTTPReceiver(t, defaultHTTPEndpoint, consumertest.NewNop(), consumertest.NewNop()) - require.NotNil(t, r) - - logCore, logs := observer.New(zap.InfoLevel) - logger := zap.New(logCore) - - metric := r.(*sharedcomponent.SharedComponent).Unwrap().(*otlpReceiver) - metric.settings.Logger = logger - - t.Cleanup(func() { require.NoError(t, r.Shutdown(context.Background())) }) - - require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) - - require.True(t, func() bool { - for _, l := range logs.All() { - if strings.Contains(l.Message, "Setting up a second HTTP listener on legacy endpoint 0.0.0.0:55681") { - return true - } - } - return false - }()) - - require.False(t, func() bool { - for _, l := range logs.All() { - if strings.Contains(l.Message, "Legacy HTTP endpoint 0.0.0.0:55681 is configured, please use 0.0.0.0:4318 instead.") { - return true - } - } - return false - }()) - - require.Equal(t, defaultHTTPEndpoint, metric.cfg.HTTP.Endpoint) -} - func testHTTPMaxRequestBodySizeJSON(t *testing.T, payload []byte, size int, expectedStatusCode int) { endpoint := testutil.GetAvailableLocalAddress(t) url := fmt.Sprintf("http://%s/v1/traces", endpoint)