Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for legacy otlp/http port #4916

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 💡

Expand Down
1 change: 0 additions & 1 deletion receiver/otlpreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 0 additions & 16 deletions receiver/otlpreceiver/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 0 additions & 39 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down