Skip to content

Commit

Permalink
[extension/jaegerremotesampling] jaegerremotesampling adopts `compone…
Browse files Browse the repository at this point in the history
…nt.UseLocalHostAsDefaultHost` feature gate (open-telemetry#30983)

Description:
jaegerremotesampling extension adopts
component.UseLocalHostAsDefaultHost feature gate

Link to tracking Issue:

open-telemetry#30702

Fixes
open-telemetry#30982

Documentation:
Updated docs.

Co-authored-by: Pablo Baeyens <[email protected]>
  • Loading branch information
2 people authored and cparkins committed Feb 1, 2024
1 parent d491a1c commit 05c76dc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 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 @@ -27,6 +27,7 @@ subtext: |
- receiver/influxdb
- receiver/zookeeper
- receiver/signalfx
- extension/jaegerremotesampling
- receiver/jaeger
- receiver/skywalking
Expand Down
7 changes: 5 additions & 2 deletions extension/jaegerremotesampling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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.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{
Expand All @@ -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{
Expand Down
5 changes: 3 additions & 2 deletions extension/jaegerremotesampling/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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",
},
},
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.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",
}},
}
Expand Down
3 changes: 3 additions & 0 deletions extension/jaegerremotesampling/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -90,3 +91,5 @@ retract (
v0.76.1
v0.65.0
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common

0 comments on commit 05c76dc

Please sign in to comment.