diff --git a/.chloggen/mx-psi_internal-localhostgate.yaml b/.chloggen/mx-psi_internal-localhostgate.yaml index 038439f6d29a..9ac87b0988db 100755 --- a/.chloggen/mx-psi_internal-localhostgate.yaml +++ b/.chloggen/mx-psi_internal-localhostgate.yaml @@ -27,6 +27,7 @@ subtext: | - receiver/influxdb - receiver/zookeeper - receiver/signalfx + - extension/jaegerremotesampling - receiver/jaeger - receiver/skywalking diff --git a/extension/jaegerremotesampling/README.md b/extension/jaegerremotesampling/README.md index d89f5d4cf4e1..1b4049f4e246 100644 --- a/extension/jaegerremotesampling/README.md +++ b/extension/jaegerremotesampling/README.md @@ -17,8 +17,11 @@ 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: -- `localhost:5778`, following the legacy remote sampling endpoint as defined by Jaeger -- `localhost:14250`, following the gRPC remote sampling endpoint, also defined by Jaeger +- `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 + +The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:9943. This will become the default 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. diff --git a/extension/jaegerremotesampling/config_test.go b/extension/jaegerremotesampling/config_test.go index 5b877252e23c..43174721268e 100644 --- a/extension/jaegerremotesampling/config_test.go +++ b/extension/jaegerremotesampling/config_test.go @@ -29,9 +29,9 @@ func TestLoadConfig(t *testing.T) { { id: component.NewID(metadata.Type), expected: &Config{ - HTTPServerConfig: &confighttp.HTTPServerConfig{Endpoint: ":5778"}, + HTTPServerConfig: &confighttp.HTTPServerConfig{Endpoint: "0.0.0.0:5778"}, GRPCServerSettings: &configgrpc.GRPCServerSettings{NetAddr: confignet.NetAddr{ - Endpoint: ":14250", + Endpoint: "0.0.0.0:14250", Transport: "tcp", }}, Source: Source{ @@ -44,9 +44,9 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "1"), expected: &Config{ - HTTPServerConfig: &confighttp.HTTPServerConfig{Endpoint: ":5778"}, + HTTPServerConfig: &confighttp.HTTPServerConfig{Endpoint: "0.0.0.0:5778"}, GRPCServerSettings: &configgrpc.GRPCServerSettings{NetAddr: confignet.NetAddr{ - Endpoint: ":14250", + Endpoint: "0.0.0.0:14250", Transport: "tcp", }}, Source: Source{ diff --git a/extension/jaegerremotesampling/factory.go b/extension/jaegerremotesampling/factory.go index bfa15fcbeee8..9123dee0e1de 100644 --- a/extension/jaegerremotesampling/factory.go +++ b/extension/jaegerremotesampling/factory.go @@ -16,6 +16,7 @@ import ( "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/jaegerremotesampling/internal/metadata" + "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/localhostgate" ) // NewFactory creates a factory for the jaeger remote sampling extension. @@ -31,11 +32,11 @@ func NewFactory() extension.Factory { func createDefaultConfig() component.Config { return &Config{ HTTPServerConfig: &confighttp.HTTPServerConfig{ - Endpoint: ":5778", + Endpoint: localhostgate.EndpointForPort(5778), }, GRPCServerSettings: &configgrpc.GRPCServerSettings{ NetAddr: confignet.NetAddr{ - Endpoint: ":14250", + Endpoint: localhostgate.EndpointForPort(14250), Transport: "tcp", }, }, diff --git a/extension/jaegerremotesampling/factory_test.go b/extension/jaegerremotesampling/factory_test.go index d0ceac8408b2..e8fb9c0484d6 100644 --- a/extension/jaegerremotesampling/factory_test.go +++ b/extension/jaegerremotesampling/factory_test.go @@ -18,9 +18,9 @@ import ( func TestCreateDefaultConfig(t *testing.T) { // prepare and test expected := &Config{ - HTTPServerConfig: &confighttp.HTTPServerConfig{Endpoint: ":5778"}, + HTTPServerConfig: &confighttp.HTTPServerConfig{Endpoint: "0.0.0.0:5778"}, GRPCServerSettings: &configgrpc.GRPCServerSettings{NetAddr: confignet.NetAddr{ - Endpoint: ":14250", + Endpoint: "0.0.0.0:14250", Transport: "tcp", }}, } diff --git a/extension/jaegerremotesampling/go.mod b/extension/jaegerremotesampling/go.mod index 7a0835b42f3d..aec7ffa5532c 100644 --- a/extension/jaegerremotesampling/go.mod +++ b/extension/jaegerremotesampling/go.mod @@ -5,6 +5,7 @@ go 1.20 require ( github.com/fortytw2/leaktest v1.3.0 github.com/jaegertracing/jaeger v1.53.0 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.93.0 github.com/stretchr/testify v1.8.4 github.com/tilinna/clock v1.1.0 go.opentelemetry.io/collector/component v0.93.1-0.20240130182548-89388addcc7f @@ -90,3 +91,5 @@ retract ( v0.76.1 v0.65.0 ) + +replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common