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

[receiver/sapm] sapmreceiver adopts component.UseLocalHostAsDefaultHost feature gate #30926

Merged
merged 3 commits into from
Feb 1, 2024
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 .chloggen/mx-psi_internal-localhostgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ subtext: |
- receiver/influxdb
- receiver/zookeeper
- receiver/signalfx
- receiver/sapm
- extension/jaegerremotesampling
- receiver/jaeger
- receiver/skywalking
Expand Down
1 change: 1 addition & 0 deletions receiver/sapmreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The following settings are required:

- `endpoint` (default = `0.0.0.0:7276`): Address and port that the SAPM
receiver should bind to.
The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:7276. This will become the default in a future release.

The following setting are optional:

Expand Down
4 changes: 2 additions & 2 deletions receiver/sapmreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "tls"),
expected: &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: ":7276",
Endpoint: "0.0.0.0:7276",
TLSSetting: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CertFile: "/test.crt",
Expand All @@ -58,7 +58,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "passthrough"),
expected: &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: ":7276",
Endpoint: "0.0.0.0:7276",
},
AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{
AccessTokenPassthrough: true,
Expand Down
7 changes: 4 additions & 3 deletions receiver/sapmreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/localhostgate"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sapmreceiver/internal/metadata"
)

const (
// Default endpoints to bind to.
defaultEndpoint = ":7276"
// Default port to bind to.
defaultPort = 7276
)

// NewFactory creates a factory for SAPM receiver.
Expand All @@ -35,7 +36,7 @@ func NewFactory() receiver.Factory {
func createDefaultConfig() component.Config {
return &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: localhostgate.EndpointForPort(defaultPort),
},
}
}
Expand Down
6 changes: 3 additions & 3 deletions receiver/sapmreceiver/trace_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func TestReception(t *testing.T) {
// 1. Create the SAPM receiver aka "server"
config: &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: "0.0.0.0:7226",
},
},
sapm: &splunksapm.PostSpansRequest{Batches: []*model.Batch{grpcFixture(now)}},
Expand All @@ -293,7 +293,7 @@ func TestReception(t *testing.T) {
args: args{
config: &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: "0.0.0.0:7226",
},
},
sapm: &splunksapm.PostSpansRequest{Batches: []*model.Batch{grpcFixture(now)}},
Expand Down Expand Up @@ -382,7 +382,7 @@ func TestAccessTokenPassthrough(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
config := &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: "0.0.0.0:7226",
},
AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{
AccessTokenPassthrough: tt.accessTokenPassthrough,
Expand Down
Loading