Skip to content

Commit 0c12aa3

Browse files
ptodevjpkrohling
andauthored
[receiver/jaeger] Removing remote sampling configuration code (#24186)
Most remote sampling code is already removed from the jaeger receiver via #6633, but the configuration is still there. It is unused and should be removed. The only reason I can think of for retaining it is so that old configuration files don't stop the Collector from running. However, given that this is a no-op, I think it would be better to have an error and let the customers reconfigure their collectors. Here, I'm assuming that configuring a struct which doesn't exist will indeed raise an error. There is no changelog entry since the change is mostly an implementation detail. --------- Co-authored-by: Juraci Paixão Kröhling <[email protected]>
1 parent 642e7f7 commit 0c12aa3

File tree

8 files changed

+47
-67
lines changed

8 files changed

+47
-67
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: jaegerreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Deprecate remote_sampling config in the jaeger receiver
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [24186]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: >
19+
The jaeger receiver will fail to start if remote_sampling config is specified in it.
20+
The `receiver.jaeger.DisableRemoteSampling` feature gate can be set to let the receiver start and treat
21+
remote_sampling config as no-op. In a future version this feature gate will be removed and the receiver will always
22+
fail when remote_sampling config is specified.
23+
24+
# If your change doesn't affect end users or the exported elements of any package,
25+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
26+
# Optional: The change log or logs in which this entry should be included.
27+
# e.g. '[user]' or '[user, api]'
28+
# Include 'user' if the change is relevant to end users.
29+
# Include 'api' if there is a change to a library API.
30+
# Default: '[user]'
31+
change_logs: [user, api]

extension/jaegerremotesampling/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/jaegerremotesampling/internal/metadata"
1616
)
1717

18-
// NewFactory creates a factory for the OIDC Authenticator extension.
18+
// NewFactory creates a factory for the jaeger remote sampling extension.
1919
func NewFactory() extension.Factory {
2020
return extension.NewFactory(
2121
metadata.Type,

extension/oauth2clientauthextension/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/oauth2clientauthextension/internal/metadata"
1414
)
1515

16-
// NewFactory creates a factory for the OIDC Authenticator extension.
16+
// NewFactory creates a factory for the oauth2 client Authenticator extension.
1717
func NewFactory() extension.Factory {
1818
return extension.NewFactory(
1919
metadata.Type,

receiver/jaegerreceiver/config.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,8 @@ func (cfg *Config) Validate() error {
109109
}
110110

111111
if cfg.RemoteSampling != nil {
112-
if err := checkPortFromEndpoint(cfg.RemoteSampling.HostEndpoint); err != nil {
113-
return fmt.Errorf("invalid port number for the Remote Sampling endpoint: %w", err)
114-
}
115-
116-
if len(cfg.RemoteSampling.StrategyFile) != 0 && cfg.GRPC == nil {
117-
return fmt.Errorf("strategy file requires the gRPC protocol to be enabled")
118-
}
119-
120-
if cfg.RemoteSampling.StrategyFileReloadInterval < 0 {
121-
return fmt.Errorf("strategy file reload interval should be great or equal zero")
112+
if disableJaegerReceiverRemoteSampling.IsEnabled() {
113+
return fmt.Errorf("remote sampling config detected in the Jaeger receiver; use the `jaegerremotesampling` extension instead")
122114
}
123115
}
124116

receiver/jaegerreceiver/config_test.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package jaegerreceiver
66
import (
77
"path/filepath"
88
"testing"
9-
"time"
109

1110
"github.com/stretchr/testify/assert"
1211
"github.com/stretchr/testify/require"
@@ -62,14 +61,6 @@ func TestLoadConfig(t *testing.T) {
6261
},
6362
},
6463
},
65-
RemoteSampling: &RemoteSamplingConfig{
66-
HostEndpoint: "0.0.0.0:5778",
67-
GRPCClientSettings: configgrpc.GRPCClientSettings{
68-
Endpoint: "jaeger-collector:1234",
69-
},
70-
StrategyFile: "/etc/strategies.json",
71-
StrategyFileReloadInterval: time.Second * 10,
72-
},
7364
},
7465
},
7566
{
@@ -207,15 +198,6 @@ func TestInvalidConfig(t *testing.T) {
207198
},
208199
err: "receiver creation with no port number for Thrift UDP - Binary must fail",
209200
},
210-
{
211-
desc: "remote-sampling-http-no-port",
212-
apply: func(cfg *Config) {
213-
cfg.RemoteSampling = &RemoteSamplingConfig{
214-
HostEndpoint: "localhost:",
215-
}
216-
},
217-
err: "receiver creation with no port number for the remote sampling HTTP endpoint must fail",
218-
},
219201
{
220202
desc: "grpc-invalid-host",
221203
apply: func(cfg *Config) {
@@ -244,37 +226,6 @@ func TestInvalidConfig(t *testing.T) {
244226
},
245227
err: "receiver creation with too large port number must fail",
246228
},
247-
{
248-
desc: "port-outside-of-range",
249-
apply: func(cfg *Config) {
250-
cfg.Protocols = Protocols{}
251-
cfg.ThriftCompact = &ProtocolUDP{
252-
Endpoint: defaultThriftCompactBindEndpoint,
253-
}
254-
cfg.RemoteSampling = &RemoteSamplingConfig{
255-
HostEndpoint: "localhost:5778",
256-
StrategyFile: "strategies.json",
257-
}
258-
},
259-
err: "receiver creation without gRPC and with remote sampling config",
260-
},
261-
{
262-
desc: "reload-interval-outside-of-range",
263-
apply: func(cfg *Config) {
264-
cfg.Protocols.GRPC = &configgrpc.GRPCServerSettings{
265-
NetAddr: confignet.NetAddr{
266-
Endpoint: "1234",
267-
Transport: "tcp",
268-
},
269-
}
270-
cfg.RemoteSampling = &RemoteSamplingConfig{
271-
HostEndpoint: "localhost:5778",
272-
StrategyFile: "strategies.json",
273-
StrategyFileReloadInterval: -time.Second,
274-
}
275-
},
276-
err: "strategy file reload interval should be great zero",
277-
},
278229
}
279230
for _, tC := range testCases {
280231
t.Run(tC.desc, func(t *testing.T) {

receiver/jaegerreceiver/factory.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"go.opentelemetry.io/collector/config/confighttp"
1414
"go.opentelemetry.io/collector/config/confignet"
1515
"go.opentelemetry.io/collector/consumer"
16+
"go.opentelemetry.io/collector/featuregate"
1617
"go.opentelemetry.io/collector/receiver"
1718

1819
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver/internal/metadata"
@@ -32,6 +33,12 @@ const (
3233
defaultThriftBinaryBindEndpoint = "0.0.0.0:6832"
3334
)
3435

36+
var disableJaegerReceiverRemoteSampling = featuregate.GlobalRegistry().MustRegister(
37+
"receiver.jaeger.DisableRemoteSampling",
38+
featuregate.StageBeta,
39+
featuregate.WithRegisterDescription("When enabled, the Jaeger Receiver will fail to start when it is configured with remote_sampling config. When disabled, the receiver will start and the remote_sampling config will be no-op."),
40+
)
41+
3542
// NewFactory creates a new Jaeger receiver factory.
3643
func NewFactory() receiver.Factory {
3744
return receiver.NewFactory(
@@ -97,6 +104,10 @@ func createTracesReceiver(
97104
config.AgentCompactThrift = *rCfg.ThriftCompact
98105
}
99106

107+
if rCfg.RemoteSampling != nil {
108+
set.Logger.Warn("You are using a deprecated no-op `remote_sampling` option which will be removed soon; use a `jaegerremotesampling` extension instead")
109+
}
110+
100111
// Create the receiver.
101112
return newJaegerReceiver(set.ID, &config, nextConsumer, set)
102113
}

receiver/jaegerreceiver/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require (
1717
go.opentelemetry.io/collector/config/configtls v0.83.0
1818
go.opentelemetry.io/collector/confmap v0.83.0
1919
go.opentelemetry.io/collector/consumer v0.83.0
20+
go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014
2021
go.opentelemetry.io/collector/pdata v1.0.0-rcv0014
2122
go.opentelemetry.io/collector/receiver v0.83.0
2223
go.opentelemetry.io/collector/semconv v0.83.0
@@ -60,7 +61,6 @@ require (
6061
go.opentelemetry.io/collector/exporter v0.83.0 // indirect
6162
go.opentelemetry.io/collector/extension v0.83.0 // indirect
6263
go.opentelemetry.io/collector/extension/auth v0.83.0 // indirect
63-
go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 // indirect
6464
go.opentelemetry.io/collector/processor v0.83.0 // indirect
6565
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 // indirect
6666
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect

receiver/jaegerreceiver/testdata/config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ jaeger/customname:
2020
max_packet_size: 65_536
2121
workers: 5
2222
socket_buffer_size: 0
23-
remote_sampling:
24-
host_endpoint: "0.0.0.0:5778"
25-
endpoint: "jaeger-collector:1234"
26-
strategy_file: "/etc/strategies.json"
27-
strategy_file_reload_interval: 10s
2823
# The following demonstrates how to enable protocols with defaults.
2924
jaeger/defaults:
3025
protocols:

0 commit comments

Comments
 (0)