Skip to content

Commit

Permalink
[receiver/awsxray] Use component.UseLocalHostAsDefaultHost feature ga…
Browse files Browse the repository at this point in the history
…te (#30824)

**Description:** Fixes #30823
  • Loading branch information
mx-psi authored Jan 31, 2024
1 parent 5943dac commit cfe22a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .chloggen/mx-psi_internal-localhostgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ subtext: |
- receiver/awsfirehose
- processor/remotetap
- receiver/splunk_hec
- receiver/awsxray
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
Expand Down
2 changes: 2 additions & 0 deletions receiver/awsxrayreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ The UDP address and port on which this receiver listens for X-Ray segment docume
Default: `0.0.0.0:2000`

The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:2000. This will become the default in a future release.

### transport (Optional)
This should always be "udp" as X-Ray SDKs only send segments using UDP.

Expand Down
7 changes: 4 additions & 3 deletions receiver/awsxrayreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ 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/localhostgate"
"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

// NewFactory creates a factory for AWS receiver.
func NewFactory() receiver.Factory {
return receiver.NewFactory(
Expand All @@ -29,10 +32,8 @@ func createDefaultConfig() component.Config {
// in the X-Ray daemon:
// https://github.com/aws/aws-xray-daemon/blob/master/pkg/cfg/cfg.go#L99
return &Config{
// X-Ray daemon defaults to 127.0.0.1:2000 but
// the default in OT is 0.0.0.0.
NetAddr: confignet.NetAddr{
Endpoint: "0.0.0.0:2000",
Endpoint: localhostgate.EndpointForPort(defaultPort),
Transport: udppoller.Transport,
},
ProxyServer: proxy.DefaultConfig(),
Expand Down

0 comments on commit cfe22a0

Please sign in to comment.