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

Default to 0.0.0.0 instead of localhost in OTel receivers #1414

Merged
merged 1 commit into from
Aug 2, 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
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ v1.3.0-rc.0

### Breaking changes

- `otelcol.receiver.otlp`, `otelcol.receiver.jaeger`, `otelcol.extension.jaeger_remote_sampling`, `otelcol.receiver.zipkin`
will now configure `endpoint` using `localhost` by default instead of `0.0.0.0`.
This may break the receiver in containerized environments like Kubernetes.
If you depend on `0.0.0.0`, configure the `endpoint` attribute to explicitly use `0.0.0.0`.
- [`otelcol.exporter.otlp`,`otelcol.exporter.loadbalancing`]: Change the default gRPC load balancing strategy.
The default value for the `balancer_name` attribute has changed to `round_robin`
https://github.com/open-telemetry/opentelemetry-collector/pull/10319
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
-------------------------|----------------|-----------------------------------------------------------------|------------------|---------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:5778"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:5778"` | no
`max_request_body_size` | `string` | Maximum request body size the server will allow. | `20MiB` | no
`include_metadata` | `boolean` | Propagate incoming connection metadata to downstream consumers. | | no
`compression_algorithms` | `list(string)` | A list of compression algorithms the server can accept. | `["", "gzip", "zstd", "zlib", "snappy", "deflate"]` | no
Expand Down Expand Up @@ -118,7 +118,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
-------------------------|-----------|----------------------------------------------------------------------------|-------------------|---------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:14250"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:14250"` | no
`transport` | `string` | Transport to use for the gRPC server. | `"tcp"` | no
`max_recv_msg_size` | `string` | Maximum size of messages the server will accept. | `"4MiB"` | no
`max_concurrent_streams` | `number` | Limit the number of concurrent streaming RPC calls. | | no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
-------------------------|-----------|----------------------------------------------------------------------------|-------------------|---------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:14250"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:14250"` | no
`transport` | `string` | Transport to use for the gRPC server. | `"tcp"` | no
`max_recv_msg_size` | `string` | Maximum size of messages the server will accept. | `"4MiB`" | no
`max_concurrent_streams` | `number` | Limit the number of concurrent streaming RPC calls. | | no
Expand Down Expand Up @@ -150,7 +150,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
-------------------------|-----------|-----------------------------------------------------------------|-------------------|---------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:14268"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:14268"` | no
`max_request_body_size` | `string` | Maximum request body size the server will allow. | `20MiB` | no
`include_metadata` | `boolean` | Propagate incoming connection metadata to downstream consumers. | | no
`compression_algorithms` | `list(string)` | A list of compression algorithms the server can accept. | `["", "gzip", "zstd", "zlib", "snappy", "deflate"]` | no
Expand Down Expand Up @@ -186,7 +186,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
---------------------|----------|----------------------------------------------------------------|------------------|---------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:6832"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:6832"` | no
`queue_size` | `number` | Maximum number of UDP messages that can be queued at once. | `1000` | no
`max_packet_size` | `string` | Maximum UDP message size. | `"65KiB"` | no
`workers` | `number` | Number of workers to concurrently read from the message queue. | `10` | no
Expand All @@ -201,7 +201,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
---------------------|----------|----------------------------------------------------------------|------------------|---------
`endpoint` | `string` | `host:port` to listen for traffic on. | `localhost:6831"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:6831"` | no
`queue_size` | `number` | Maximum number of UDP messages that can be queued at once. | `1000` | no
`max_packet_size` | `string` | Maximum UDP message size. | `"65KiB"` | no
`workers` | `number` | Number of workers to concurrently read from the message queue. | `10` | no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ otelcol.receiver.opencensus "LABEL" {
Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`cors_allowed_origins` | `list(string)` | A list of allowed Cross-Origin Resource Sharing (CORS) origins. | | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:55678"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:55678"` | no
`transport` | `string` | Transport to use for the gRPC server. | `"tcp"` | no
`max_recv_msg_size` | `string` | Maximum size of messages the server will accept. | `"4MiB`" | no
`max_concurrent_streams` | `number` | Limit the number of concurrent streaming RPC calls. | | no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:4317"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:4317"` | no
`transport` | `string` | Transport to use for the gRPC server. | `"tcp"` | no
`max_recv_msg_size` | `string` | Maximum size of messages the server will accept. | `"4MiB`" | no
`max_concurrent_streams` | `number` | Limit the number of concurrent streaming RPC calls. | | no
Expand Down Expand Up @@ -138,7 +138,7 @@ The following arguments are supported:

Name | Type | Description | Default | Required
---- | ---- | ----------- |-----------------| --------
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:4318"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:4318"` | no
`max_request_body_size` | `string` | Maximum request body size the server will allow. | `20MiB` | no
`include_metadata` | `boolean` | Propagate incoming connection metadata to downstream consumers. | | no
`traces_url_path` | `string` | The URL path to receive traces on. | `"/v1/traces"` | no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ otelcol.receiver.zipkin "LABEL" {
Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`parse_string_tags` | `bool` | Parse string tags and binary annotations into non-string types. | `false` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"localhost:9411"` | no
`endpoint` | `string` | `host:port` to listen for traffic on. | `"0.0.0.0:9411"` | no
`max_request_body_size` | `string` | Maximum request body size the server will allow. | `20MiB` | no
`include_metadata` | `boolean` | Propagate incoming connection metadata to downstream consumers. | | no
`compression_algorithms` | `list(string)` | A list of compression algorithms the server can accept. | `["", "gzip", "zstd", "zlib", "snappy", "deflate"]` | no
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
otelcol.receiver.otlp "otlp_metrics" {
http {
endpoint = "0.0.0.0:4318"
}
http {}

output {
metrics = [otelcol.processor.attributes.otlp_metrics.input, otelcol.exporter.prometheus.otlp_to_prom_metrics.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewID(component.MustNewType(typeStr)),
expected: &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: ":5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "localhost:14250",
Endpoint: ":14250",
Transport: confignet.TransportTypeTCP,
}},
Source: Source{
Expand All @@ -42,9 +42,9 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewIDWithName(component.MustNewType(typeStr), "1"),
expected: &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: ":5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "localhost:14250",
Endpoint: ":14250",
Transport: confignet.TransportTypeTCP,
}},
Source: Source{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func NewFactory() extension.Factory {
func createDefaultConfig() component.Config {
return &Config{
HTTPServerConfig: &confighttp.ServerConfig{
Endpoint: "localhost:5778",
Endpoint: ":5778",
},
GRPCServerConfig: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "localhost:14250",
Endpoint: ":14250",
Transport: "tcp",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
func TestCreateDefaultConfig(t *testing.T) {
// prepare and test
expected := &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: ":5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "localhost:14250",
Endpoint: ":14250",
Transport: confignet.TransportTypeTCP,
}},
}
Expand Down
8 changes: 4 additions & 4 deletions internal/component/otelcol/receiver/jaeger/jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type GRPC struct {
func (args *GRPC) SetToDefault() {
*args = GRPC{
GRPCServerArguments: &otelcol.GRPCServerArguments{
Endpoint: "localhost:14250",
Endpoint: "0.0.0.0:14250",
Transport: "tcp",
},
}
Expand All @@ -129,7 +129,7 @@ type ThriftHTTP struct {
func (args *ThriftHTTP) SetToDefault() {
*args = ThriftHTTP{
HTTPServerArguments: &otelcol.HTTPServerArguments{
Endpoint: "localhost:14268",
Endpoint: "0.0.0.0:14268",
CompressionAlgorithms: append([]string(nil), otelcol.DefaultCompressionAlgorithms...),
},
}
Expand Down Expand Up @@ -179,7 +179,7 @@ type ThriftCompact struct {
func (args *ThriftCompact) SetToDefault() {
*args = ThriftCompact{
ProtocolUDP: &ProtocolUDP{
Endpoint: "localhost:6831",
Endpoint: "0.0.0.0:6831",
QueueSize: 1_000,
MaxPacketSize: 65 * units.KiB,
Workers: 10,
Expand All @@ -205,7 +205,7 @@ type ThriftBinary struct {
func (args *ThriftBinary) SetToDefault() {
*args = ThriftBinary{
ProtocolUDP: &ProtocolUDP{
Endpoint: "localhost:6832",
Endpoint: "0.0.0.0:6832",
QueueSize: 1_000,
MaxPacketSize: 65 * units.KiB,
Workers: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var _ receiver.Arguments = Arguments{}
func (args *Arguments) SetToDefault() {
*args = Arguments{
GRPC: otelcol.GRPCServerArguments{
Endpoint: "localhost:55678",
Endpoint: "0.0.0.0:55678",
Transport: "tcp",

ReadBufferSize: 512 * units.Kibibyte,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestDefaultArguments_UnmarshalAlloy(t *testing.T) {
defaultArgs.SetToDefault()

// Check the gRPC arguments
require.Equal(t, otelArgs.NetAddr.Endpoint, "localhost:55678")
require.Equal(t, otelArgs.NetAddr.Endpoint, "0.0.0.0:55678")

// Check the gRPC arguments
require.Equal(t, defaultArgs.GRPC.Endpoint, otelArgs.NetAddr.Endpoint)
Expand Down
4 changes: 2 additions & 2 deletions internal/component/otelcol/receiver/otlp/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func validateURL(url string, urlName string) error {
// SetToDefault implements syntax.Defaulter.
func (args *GRPCServerArguments) SetToDefault() {
*args = GRPCServerArguments{
Endpoint: "localhost:4317",
Endpoint: "0.0.0.0:4317",
Transport: "tcp",

ReadBufferSize: 512 * units.Kibibyte,
Expand All @@ -148,7 +148,7 @@ func (args *GRPCServerArguments) SetToDefault() {
func (args *HTTPConfigArguments) SetToDefault() {
*args = HTTPConfigArguments{
HTTPServerArguments: &otelcol.HTTPServerArguments{
Endpoint: "localhost:4318",
Endpoint: "0.0.0.0:4318",
CompressionAlgorithms: append([]string(nil), otelcol.DefaultCompressionAlgorithms...),
},
MetricsURLPath: "/v1/metrics",
Expand Down
4 changes: 2 additions & 2 deletions internal/component/otelcol/receiver/otlp/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ func TestUnmarshalDefault(t *testing.T) {
Protocols: otlpreceiver.Protocols{
GRPC: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "localhost:4317",
Endpoint: "0.0.0.0:4317",
Transport: "tcp",
},
ReadBufferSize: 524288,
},
HTTP: &otlpreceiver.HTTPConfig{
ServerConfig: &confighttp.ServerConfig{
Endpoint: "localhost:4318",
Endpoint: "0.0.0.0:4318",
CompressionAlgorithms: []string{"", "gzip", "zstd", "zlib", "snappy", "deflate"},
},
TracesURLPath: "/v1/traces",
Expand Down
2 changes: 1 addition & 1 deletion internal/component/otelcol/receiver/zipkin/zipkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var _ receiver.Arguments = Arguments{}
func (args *Arguments) SetToDefault() {
*args = Arguments{
HTTPServer: otelcol.HTTPServerArguments{
Endpoint: "localhost:9411",
Endpoint: "0.0.0.0:9411",
CompressionAlgorithms: append([]string(nil), otelcol.DefaultCompressionAlgorithms...),
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestArguments_UnmarshalDefaults(t *testing.T) {

expected := zipkinreceiver.Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "localhost:9411",
Endpoint: "0.0.0.0:9411",
CompressionAlgorithms: []string{"", "gzip", "zstd", "zlib", "snappy", "deflate"},
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.processor.attributes.default_example.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ otelcol.auth.basic "default_client" {
}

otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.exporter.otlp.default.input]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.processor.batch.default.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ otelcol.auth.bearer "default_withscheme" {
}

otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.exporter.otlp.default_withauth.input, otelcol.exporter.otlphttp.default_withauth.input]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.exporter.debug.default.input, otelcol.exporter.debug.default_default.input]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.processor.deltatocumulative.default.input]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.processor.filter.default_ottl.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ otelcol.auth.headers "default" {
}

otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.exporter.otlp.default.input]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
otelcol.receiver.otlp "default" {
grpc { }
grpc {
endpoint = "localhost:4317"
}

http { }
http {
endpoint = "localhost:4318"
}

output {
metrics = [otelcol.exporter.otlp.default.input]
Expand Down
Loading
Loading