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

Updated AWS X-Ray receiver Config to use udp #497

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions receiver/awsxrayreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Example:
receivers:
aws_xray:
endpoint: 0.0.0.0:2000
transport: udp
proxy_server:
tcp_endpoint: 0.0.0.0:2000
endpoint: 0.0.0.0:2000
proxy_address: ""
insecure: false
server_name_override: ""
Expand All @@ -35,11 +36,16 @@ The UDP address and port on which this receiver listens for X-Ray segment docume

Default: `0.0.0.0:2000`

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

Default: `udp`

### proxy_server (Optional)
Defines configurations related to the local TCP proxy server.

### tcp_endpoint (Optional)
The address and port on which this receiver listens for calls from the X-Ray SDK and relays them to the AWS X-Ray backend to get sampling rules and report sampling statistics.
### endpoint (Optional)
The TCP address and port on which this receiver listens for calls from the X-Ray SDK and relays them to the AWS X-Ray backend to get sampling rules and report sampling statistics.

Default: `0.0.0.0:2000`

Expand Down
13 changes: 5 additions & 8 deletions receiver/awsxrayreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,21 @@ const (

// Config defines the configurations for an AWS X-Ray receiver.
type Config struct {
// The Endpoint field in ReceiverSettings represents the UDP address
configmodels.ReceiverSettings `mapstructure:",squash"`
// The `NetAddr` represents the UDP address
// and port on which this receiver listens for X-Ray segment documents
// emitted by the X-Ray SDK.
configmodels.ReceiverSettings `mapstructure:",squash"`
confignet.TCPAddr `mapstructure:",squash"`

// squash ensures fields are correctly decoded in embedded struct
// https://godoc.org/github.com/mitchellh/mapstructure#hdr-Embedded_Structs_and_Squashing
confignet.NetAddr `mapstructure:",squash"`
bogdandrutu marked this conversation as resolved.
Show resolved Hide resolved

// ProxyServer defines configurations related to the local TCP proxy server.
ProxyServer *proxyServer `mapstructure:"proxy_server"`
}

type proxyServer struct {
// TCPEndpoint is the address and port on which this receiver listens for
// endpoint is the TCP address and port on which this receiver listens for
// calls from the X-Ray SDK and relays them to the AWS X-Ray backend to
// get sampling rules and report sampling statistics.
TCPEndpoint string `mapstructure:"tcp_endpoint"`
confignet.TCPAddr `mapstructure:",squash"`

// ProxyAddress defines the proxy address that the local TCP server
// forwards HTTP requests to AWS X-Ray backend through.
Expand Down
18 changes: 12 additions & 6 deletions receiver/awsxrayreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ func TestLoadConfig(t *testing.T) {
TypeVal: configmodels.Type(typeStr),
NameVal: typeStr + "/udp_endpoint",
},
TCPAddr: confignet.TCPAddr{
Endpoint: "localhost:5678",
NetAddr: confignet.NetAddr{
Endpoint: "0.0.0.0:5678",
Transport: "udp",
},
ProxyServer: &proxyServer{
TCPEndpoint: "0.0.0.0:2000",
TCPAddr: confignet.TCPAddr{
Endpoint: "0.0.0.0:2000",
},
ProxyAddress: "",
TLSSetting: configtls.TLSClientSetting{
Insecure: false,
Expand All @@ -81,11 +84,14 @@ func TestLoadConfig(t *testing.T) {
TypeVal: configmodels.Type(typeStr),
NameVal: typeStr + "/proxy_server",
},
TCPAddr: confignet.TCPAddr{
Endpoint: "0.0.0.0:2000",
NetAddr: confignet.NetAddr{
Endpoint: "0.0.0.0:2000",
Transport: "udp",
},
ProxyServer: &proxyServer{
TCPEndpoint: "localhost:1234",
TCPAddr: confignet.TCPAddr{
Endpoint: "0.0.0.0:1234",
},
ProxyAddress: "https://proxy.proxy.com",
TLSSetting: configtls.TLSClientSetting{
Insecure: true,
Expand Down
9 changes: 6 additions & 3 deletions receiver/awsxrayreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ func createDefaultConfig() configmodels.Receiver {
// X-Ray daemon defaults to 127.0.0.1:2000 but
// the default in OT is 0.0.0.0.
},
TCPAddr: confignet.TCPAddr{
Endpoint: "0.0.0.0:2000",
NetAddr: confignet.NetAddr{
Endpoint: "0.0.0.0:2000",
Transport: "udp",
},
ProxyServer: &proxyServer{
TCPEndpoint: "0.0.0.0:2000",
TCPAddr: confignet.TCPAddr{
Endpoint: "0.0.0.0:2000",
},
ProxyAddress: "",
TLSSetting: configtls.TLSClientSetting{
Insecure: false,
Expand Down
3 changes: 1 addition & 2 deletions receiver/awsxrayreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxra
go 1.14

require (
github.com/aws/aws-sdk-go v1.32.11
github.com/shirou/gopsutil v2.20.4+incompatible // indirect
github.com/aws/aws-sdk-go v1.33.10
github.com/stretchr/testify v1.6.1
go.opentelemetry.io/collector v0.5.1-0.20200722180048-c0b3cf61a63a
go.uber.org/zap v1.15.0
Expand Down