@@ -23,21 +23,17 @@ import (
23
23
"mime"
24
24
"net/http"
25
25
"sync"
26
- "time"
27
26
28
27
apacheThrift "github.com/apache/thrift/lib/go/thrift"
29
28
"github.com/gorilla/mux"
30
29
"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
31
- jSamplingConfig "github.com/jaegertracing/jaeger/cmd/agent/app/configmanager/grpc"
32
30
"github.com/jaegertracing/jaeger/cmd/agent/app/httpserver"
33
31
"github.com/jaegertracing/jaeger/cmd/agent/app/processors"
34
32
"github.com/jaegertracing/jaeger/cmd/agent/app/servers"
35
33
"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
36
34
"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
37
- collectorSampling "github.com/jaegertracing/jaeger/cmd/collector/app/sampling"
38
35
"github.com/jaegertracing/jaeger/model"
39
36
"github.com/jaegertracing/jaeger/pkg/metrics"
40
- staticStrategyStore "github.com/jaegertracing/jaeger/plugin/sampling/strategystore/static"
41
37
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
42
38
"github.com/jaegertracing/jaeger/thrift-gen/agent"
43
39
"github.com/jaegertracing/jaeger/thrift-gen/baggage"
@@ -51,7 +47,6 @@ import (
51
47
"go.opentelemetry.io/collector/consumer"
52
48
"go.opentelemetry.io/collector/obsreport"
53
49
"go.uber.org/multierr"
54
- "go.uber.org/zap"
55
50
"google.golang.org/grpc"
56
51
57
52
jaegertranslator "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger"
@@ -63,12 +58,9 @@ type configuration struct {
63
58
CollectorHTTPSettings confighttp.HTTPServerSettings
64
59
CollectorGRPCServerSettings configgrpc.GRPCServerSettings
65
60
66
- AgentCompactThrift ProtocolUDP
67
- AgentBinaryThrift ProtocolUDP
68
- AgentHTTPEndpoint string
69
- RemoteSamplingClientSettings configgrpc.GRPCClientSettings
70
- RemoteSamplingStrategyFile string
71
- RemoteSamplingStrategyFileReloadInterval time.Duration
61
+ AgentCompactThrift ProtocolUDP
62
+ AgentBinaryThrift ProtocolUDP
63
+ AgentHTTPEndpoint string
72
64
}
73
65
74
66
// Receiver type is used to receive spans that were originally intended to be sent to Jaeger.
@@ -82,9 +74,8 @@ type jReceiver struct {
82
74
grpc * grpc.Server
83
75
collectorServer * http.Server
84
76
85
- agentSamplingManager * jSamplingConfig.SamplingManager
86
- agentProcessors []processors.Processor
87
- agentServer * http.Server
77
+ agentProcessors []processors.Processor
78
+ agentServer * http.Server
88
79
89
80
goroutines sync.WaitGroup
90
81
@@ -183,7 +174,19 @@ func consumeTraces(ctx context.Context, batch *jaeger.Batch, consumer consumer.T
183
174
184
175
var _ agent.Agent = (* agentHandler )(nil )
185
176
var _ api_v2.CollectorServiceServer = (* jReceiver )(nil )
186
- var _ configmanager.ClientConfigManager = (* jReceiver )(nil )
177
+ var _ configmanager.ClientConfigManager = (* notImplementedConfigManager )(nil )
178
+
179
+ var errNotImplemented = fmt .Errorf ("not implemented" )
180
+
181
+ type notImplementedConfigManager struct {}
182
+
183
+ func (notImplementedConfigManager ) GetSamplingStrategy (ctx context.Context , serviceName string ) (* sampling.SamplingStrategyResponse , error ) {
184
+ return nil , errNotImplemented
185
+ }
186
+
187
+ func (notImplementedConfigManager ) GetBaggageRestrictions (ctx context.Context , serviceName string ) ([]* baggage.BaggageRestriction , error ) {
188
+ return nil , errNotImplemented
189
+ }
187
190
188
191
type agentHandler struct {
189
192
nextConsumer consumer.Traces
@@ -204,21 +207,6 @@ func (h *agentHandler) EmitBatch(ctx context.Context, batch *jaeger.Batch) error
204
207
return err
205
208
}
206
209
207
- func (jr * jReceiver ) GetSamplingStrategy (ctx context.Context , serviceName string ) (* sampling.SamplingStrategyResponse , error ) {
208
- return jr .agentSamplingManager .GetSamplingStrategy (ctx , serviceName )
209
- }
210
-
211
- func (jr * jReceiver ) GetBaggageRestrictions (ctx context.Context , serviceName string ) ([]* baggage.BaggageRestriction , error ) {
212
- br , err := jr .agentSamplingManager .GetBaggageRestrictions (ctx , serviceName )
213
- if err != nil {
214
- // Baggage restrictions are not yet implemented - refer to - https://github.com/jaegertracing/jaeger/issues/373
215
- // As of today, GetBaggageRestrictions() always returns an error.
216
- // However, we `return nil, nil` here in order to serve a valid `200 OK` response.
217
- return nil , nil
218
- }
219
- return br , nil
220
- }
221
-
222
210
func (jr * jReceiver ) PostSpans (ctx context.Context , r * api_v2.PostSpansRequest ) (* api_v2.PostSpansResponse , error ) {
223
211
ctx = jr .grpcObsrecv .StartTracesOp (ctx )
224
212
@@ -283,25 +271,8 @@ func (jr *jReceiver) startAgent(host component.Host) error {
283
271
}(processor )
284
272
}
285
273
286
- // Start upstream grpc client before serving sampling endpoints over HTTP
287
- if jr .config .RemoteSamplingClientSettings .Endpoint != "" {
288
- grpcOpts , err := jr .config .RemoteSamplingClientSettings .ToDialOptions (host , jr .settings .TelemetrySettings )
289
- if err != nil {
290
- jr .settings .Logger .Error ("Error creating grpc dial options for remote sampling endpoint" , zap .Error (err ))
291
- return err
292
- }
293
- jr .config .RemoteSamplingClientSettings .SanitizedEndpoint ()
294
- conn , err := grpc .Dial (jr .config .RemoteSamplingClientSettings .Endpoint , grpcOpts ... )
295
- if err != nil {
296
- jr .settings .Logger .Error ("Error creating grpc connection to jaeger remote sampling endpoint" , zap .String ("endpoint" , jr .config .RemoteSamplingClientSettings .Endpoint ))
297
- return err
298
- }
299
-
300
- jr .agentSamplingManager = jSamplingConfig .NewConfigManager (conn )
301
- }
302
-
303
274
if jr .config .AgentHTTPEndpoint != "" {
304
- jr .agentServer = httpserver .NewHTTPServer (jr .config .AgentHTTPEndpoint , jr , metrics .NullFactory , jr .settings .Logger )
275
+ jr .agentServer = httpserver .NewHTTPServer (jr .config .AgentHTTPEndpoint , & notImplementedConfigManager {} , metrics .NullFactory , jr .settings .Logger )
305
276
306
277
jr .goroutines .Add (1 )
307
278
go func () {
@@ -434,16 +405,6 @@ func (jr *jReceiver) startCollector(host component.Host) error {
434
405
435
406
api_v2 .RegisterCollectorServiceServer (jr .grpc , jr )
436
407
437
- // init and register sampling strategy store
438
- ss , err := staticStrategyStore .NewStrategyStore (staticStrategyStore.Options {
439
- StrategiesFile : jr .config .RemoteSamplingStrategyFile ,
440
- ReloadInterval : jr .config .RemoteSamplingStrategyFileReloadInterval ,
441
- }, jr .settings .Logger )
442
- if err != nil {
443
- return fmt .Errorf ("failed to create collector strategy store: %w" , err )
444
- }
445
- api_v2 .RegisterSamplingManagerServer (jr .grpc , collectorSampling .NewGRPCHandler (ss ))
446
-
447
408
jr .goroutines .Add (1 )
448
409
go func () {
449
410
defer jr .goroutines .Done ()
0 commit comments