Skip to content

Commit

Permalink
[all] Promote component.UseLocalHostAsDefaultHost feature gate to b…
Browse files Browse the repository at this point in the history
…eta (#33658)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->

Counterpart to open-telemetry/opentelemetry-collector/pull/10352.

**Link to tracking Issue:**
open-telemetry/opentelemetry-collector/issues/8510
  • Loading branch information
mx-psi authored Jun 27, 2024
1 parent c641095 commit 968d4b8
Show file tree
Hide file tree
Showing 43 changed files with 143 additions and 81 deletions.
45 changes: 45 additions & 0 deletions .chloggen/mx-psi_localhost-fg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Use this changelog template to create an entry for release notes.
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Promote `component.UseLocalHostAsDefaultHost` feature gate to beta. This changes default endpoints from 0.0.0.0 to localhost"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30702]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
This change affects the following components:
- extension/awsproxy
- extension/health_check
- extension/health_checkv2
- extension/jaegerremotesampling
- internal/aws/proxy
- processor/remotetap
- receiver/awsfirehose
- receiver/awsxray
- receiver/influxdb
- receiver/jaeger
- receiver/loki
- receiver/opencensus
- receiver/sapm
- receiver/signalfx
- receiver/skywalking
- receiver/splunk_hec
- receiver/zipkin
- receiver/zookeeper
# 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.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
4 changes: 2 additions & 2 deletions extension/awsproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ extensions:
### endpoint (Optional)
The TCP address and port on which this proxy listens for requests.
Default: `0.0.0.0:2000`
Default: `localhost:2000`

The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:2000. This will become the default in a future release.
You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:2000`. This feature gate will be removed in a future release.


### proxy_address (Optional)
Expand Down
2 changes: 1 addition & 1 deletion extension/awsproxy/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) {
assert.Equal(t, &Config{
ProxyConfig: proxy.Config{
TCPAddrConfig: confignet.TCPAddrConfig{
Endpoint: "0.0.0.0:2000",
Endpoint: "localhost:2000",
},
},
}, cfg)
Expand Down
2 changes: 1 addition & 1 deletion extension/healthcheckextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ liveness and/or readiness probe on Kubernetes.

The following settings are required:

- `endpoint` (default = 0.0.0.0:13133): Address to publish the health check status. For full list of `ServerConfig` refer [here](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp). The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:13133. This will become the default in a future release.
- `endpoint` (default = localhost:13133): Address to publish the health check status. For full list of `ServerConfig` refer [here](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp). You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to 0.0.0.0:13133. This feature gate will be removed in a future release.
- `path` (default = "/"): Specifies the path to be configured for the health check server.
- `response_body` (default = ""): Specifies a static body that overrides the default response returned by the health check service.

Expand Down
2 changes: 1 addition & 1 deletion extension/healthcheckextension/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) {
cfg := createDefaultConfig()
assert.Equal(t, &Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:13133",
Endpoint: "localhost:13133",
},
CheckCollectorPipeline: defaultCheckCollectorPipelineSettings(),
Path: "/",
Expand Down
4 changes: 2 additions & 2 deletions extension/healthcheckv2extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ liveness and/or readiness probe on Kubernetes.

The following settings are required:

- `endpoint` (default = 0.0.0.0:13133): Address to publish the health check status. For full list of `ServerConfig` refer [here](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp). The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:13133. This will become the default in a future release.
- `endpoint` (default = localhost:13133): Address to publish the health check status. For full list of `ServerConfig` refer [here](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp). You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to 0.0.0.0:13133. This feature gate will be removed in a future release.
- `path` (default = "/"): Specifies the path to be configured for the health check server.
- `response_body` (default = ""): Specifies a static body that overrides the default response returned by the health check service.
- `check_collector_pipeline:` (deprecated and ignored): Settings of collector pipeline health check
Expand Down Expand Up @@ -425,4 +425,4 @@ begin streaming.
There are plans to provide the ability to export status events as OTLP logs adhering to the event
semantic conventions.

[grpc_health_v1 service]: https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
[grpc_health_v1 service]: https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
6 changes: 3 additions & 3 deletions extension/jaegerremotesampling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
This extension allows serving sampling strategies following the Jaeger's remote sampling API. This extension can be configured to proxy requests to a backing remote sampling server, which could potentially be a Jaeger Collector down the pipeline, or a static JSON file from the local file system.

By default, two listeners are made available:
- `0.0.0.0:5778`, following the legacy remote sampling endpoint as defined by Jaeger
- `0.0.0.0:14250`, following the gRPC remote sampling endpoint, also defined by Jaeger
- `localhost:5778`, following the legacy remote sampling endpoint as defined by Jaeger
- `localhost:14250`, following the gRPC remote sampling endpoint, also defined by Jaeger

The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:9943. This will become the default in a future release.
You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:5778` and `0.0.0.0:14250` respectively. This feature gate will be removed in a future release.


Note that the port `14250` will clash with the Jaeger Receiver. When both are used, it's recommended to change this extension to use another port.
Expand Down
8 changes: 4 additions & 4 deletions extension/jaegerremotesampling/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewID(metadata.Type),
expected: &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
}},
Source: Source{
Expand All @@ -44,9 +44,9 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewIDWithName(metadata.Type, "1"),
expected: &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
}},
Source: Source{
Expand Down
4 changes: 2 additions & 2 deletions extension/jaegerremotesampling/factory_test.go
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: "0.0.0.0:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
}},
}
Expand Down
6 changes: 3 additions & 3 deletions internal/common/localhostgate/featuregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const UseLocalHostAsDefaultHostID = "component.UseLocalHostAsDefaultHost"
var UseLocalHostAsDefaultHostfeatureGate = mustRegisterOrLoad(
featuregate.GlobalRegistry(),
UseLocalHostAsDefaultHostID,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("controls whether server-like receivers and extensions such as the OTLP receiver use localhost as the default host for their endpoints"),
)

Expand Down Expand Up @@ -60,8 +60,8 @@ func EndpointForPort(port int) string {
// LogAboutUseLocalHostAsDefault logs about the upcoming change from 0.0.0.0 to localhost on server-like components.
func LogAboutUseLocalHostAsDefault(logger *zap.Logger) {
if !UseLocalHostAsDefaultHostfeatureGate.IsEnabled() {
logger.Warn(
"The default endpoints for all servers in components will change to use localhost instead of 0.0.0.0 in a future version. Use the feature gate to preview the new default.",
logger.Info(
"The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Use the feature gate to temporarily revert to the previous default.",
zap.String("feature gate ID", UseLocalHostAsDefaultHostID),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
extract:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
filter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
filter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
filter:
Expand Down
4 changes: 2 additions & 2 deletions processor/remotetapprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ any open WebSockets is rate limited by an adjustable amount.
The Remote Tap processor has two configurable fields: `endpoint` and `limit`:

- `endpoint`: The endpoint on which the WebSocket processor listens. Optional. Defaults
to `0.0.0.0:12001`.
The `component.UseLocalHostAsDefaultHost` feature gate changes this to `localhost:12001`. This will become the default in a future release.
to `localhost:12001`.
You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:12001`. This feature gate will be removed in a future release.

- `limit`: The rate limit over the WebSocket in messages per second. Can be a
float or an integer. Optional. Defaults to `1`.
Expand Down
2 changes: 1 addition & 1 deletion processor/remotetapprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import (

func TestCreateDefaultConfig(t *testing.T) {
cfg := createDefaultConfig().(*Config)
assert.Equal(t, "0.0.0.0:12001", cfg.Endpoint)
assert.Equal(t, "localhost:12001", cfg.Endpoint)
assert.EqualValues(t, 1, cfg.Limit)
}
4 changes: 2 additions & 2 deletions receiver/awsfirehosereceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ using a Load Balancer.
### endpoint:
The address:port to bind the listener to.
default: `0.0.0.0:4433`
default: `localhost:4433`

The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:4433. This will become the default in a future release.
You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:4433`. This feature gate will be removed in a future release.

### tls:
See [documentation](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md#server-configuration) for more details.
Expand Down
5 changes: 3 additions & 2 deletions receiver/awsxrayreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ The default configurations below are based on the [default configurations](https
### endpoint (Optional)
The UDP address and port on which this receiver listens for X-Ray segment documents emitted by the X-Ray SDK.
Default: `0.0.0.0:2000`
Default: `localhost:2000`

You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:2000`. This feature gate will be removed in a future release.

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
4 changes: 2 additions & 2 deletions receiver/awsxrayreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestLoadConfig(t *testing.T) {
},
ProxyServer: &proxy.Config{
TCPAddrConfig: confignet.TCPAddrConfig{
Endpoint: "0.0.0.0:2000",
Endpoint: "localhost:2000",
},
ProxyAddress: "",
TLSSetting: configtls.ClientConfig{
Expand All @@ -59,7 +59,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "proxy_server"),
expected: &Config{
AddrConfig: confignet.AddrConfig{
Endpoint: "0.0.0.0:2000",
Endpoint: "localhost:2000",
Transport: confignet.TransportTypeUDP,
},
ProxyServer: &proxy.Config{
Expand Down
3 changes: 1 addition & 2 deletions receiver/influxdbreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Write responses:

The following configuration options are supported:

* `endpoint` (default = 0.0.0.0:8086) HTTP service endpoint for the line protocol receiver. The
`component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:8086. This will become the default in a future release.
* `endpoint` (default = localhost:8086) HTTP service endpoint for the line protocol receiver. You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:8086`. This feature gate will be removed in a future release.

The full list of settings exposed for this receiver are documented in [config.go](config.go).

Expand Down
11 changes: 5 additions & 6 deletions receiver/jaegerreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ named under the `protocols` object for the jaeger receiver to start. The
below protocols are supported, each supports an optional `endpoint`
object configuration parameter.

- `grpc` (default `endpoint` = 0.0.0.0:14250)
- `thrift_binary` (default `endpoint` = 0.0.0.0:6832)
- `thrift_compact` (default `endpoint` = 0.0.0.0:6831)
- `thrift_http` (default `endpoint` = 0.0.0.0:14268)
- `grpc` (default `endpoint` = localhost:14250)
- `thrift_binary` (default `endpoint` = localhost:6832)
- `thrift_compact` (default `endpoint` = localhost:6831)
- `thrift_http` (default `endpoint` = localhost:14268)

The `component.UseLocalHostAsDefaultHost` feature gate changes these endpoints to localhost:14250, localhost:6832,
localhost:6831 and localhost:14268. This will become the default in a future release.
You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change tgese endpoints to 0.0.0.0:14250, 0.0.0.0:6832, 0.0.0.0:6831 and 0.0.0.0:14268. This feature gate will be removed in a future release.

Examples:

Expand Down
10 changes: 5 additions & 5 deletions receiver/jaegerreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ func TestLoadConfig(t *testing.T) {
Protocols: Protocols{
GRPC: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
},
},
ThriftHTTP: &confighttp.ServerConfig{
Endpoint: "0.0.0.0:14268",
Endpoint: "localhost:14268",
},
ThriftCompact: &ProtocolUDP{
Endpoint: "0.0.0.0:6831",
Endpoint: "localhost:6831",
ServerConfigUDP: defaultServerConfigUDP(),
},
ThriftBinary: &ProtocolUDP{
Endpoint: "0.0.0.0:6832",
Endpoint: "localhost:6832",
ServerConfigUDP: defaultServerConfigUDP(),
},
},
Expand All @@ -98,7 +98,7 @@ func TestLoadConfig(t *testing.T) {
},
},
ThriftCompact: &ProtocolUDP{
Endpoint: "0.0.0.0:6831",
Endpoint: "localhost:6831",
ServerConfigUDP: defaultServerConfigUDP(),
},
},
Expand Down
2 changes: 1 addition & 1 deletion receiver/jaegerreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestCreateInvalidHTTPEndpoint(t *testing.T) {
r, err := factory.CreateTracesReceiver(context.Background(), set, cfg, nil)

assert.NoError(t, err, "unexpected error creating receiver")
assert.Equal(t, "0.0.0.0:14268", r.(*jReceiver).config.HTTPServerConfig.Endpoint, "http port should be default")
assert.Equal(t, "localhost:14268", r.(*jReceiver).config.HTTPServerConfig.Endpoint, "http port should be default")
}

func TestCreateInvalidThriftBinaryEndpoint(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
receivers:
k8s_cluster:
Expand Down
1 change: 1 addition & 0 deletions receiver/k8sobjectsreceiver/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestE2E(t *testing.T) {
f := otlpreceiver.NewFactory()
cfg := f.CreateDefaultConfig().(*otlpreceiver.Config)
cfg.HTTP = nil
cfg.GRPC.NetAddr.Endpoint = "0.0.0.0:4317"
logsConsumer := new(consumertest.LogsSink)
rcvr, err := f.CreateLogsReceiver(context.Background(), receivertest.NewNopSettings(), cfg, logsConsumer)
require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
transform/k8sobjectsNS:
error_mode: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
receivers:
kubeletstats:
Expand Down
2 changes: 1 addition & 1 deletion receiver/lokireceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This receiver runs HTTP and GRPC servers to ingest log entries in Loki format.

The settings are:

- `endpoint` (required, default = 0.0.0.0:3500 for HTTP protocol, 0.0.0.0:3600 gRPC protocol): host:port to which the receiver is going to receive data. The `component.UseLocalHostAsDefaultHost` feature gate changes these to localhost:3500 and localhost:3600. These will become the default in a future release.
- `endpoint` (required, default = localhost:3500 for HTTP protocol, localhost:3600 gRPC protocol): host:port to which the receiver is going to receive data. You can temporarily disable the `component.UseLocalHostAsDefaultHost` feature gate to change this to `0.0.0.0:3500` and `0.0.0.0:3600`. This feature gate will be removed in a future release.
- `use_incoming_timestamp` (optional, default = false) if set `true` the timestamp from Loki log entry is used

Example:
Expand Down
Loading

0 comments on commit 968d4b8

Please sign in to comment.