Skip to content

Commit ac6f78b

Browse files
authored
Remove jaeger-agent from distributions (jaegertracing#6081)
## Which problem is this PR solving? - Part of jaegertracing#4739 ## Description of the changes - Remove jaeger-agent from binary and Docker distributions - Move agent's port mappings into `cmd/agent/app/ports.go` to clean up the main ports ## Dependencies - Need to refactor crossdock to not rely on agent ## How was this change tested? - CI ## Checklist - [ ] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [ ] I have signed all commits - [ ] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Yuri Shkuro <[email protected]>
1 parent c7e9f3d commit ac6f78b

22 files changed

+70
-244
lines changed

Makefile.BuildBinaries.mk

-6
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ build-jaeger: build-ui _build-a-binary-jaeger$(SUFFIX)-$(GOOS)-$(GOARCH)
8181
build-all-in-one: BIN_NAME = all-in-one
8282
build-all-in-one: build-ui _build-a-binary-all-in-one$(SUFFIX)-$(GOOS)-$(GOARCH)
8383

84-
.PHONY: build-agent
85-
build-agent: BIN_NAME = agent
86-
build-agent: _build-a-binary-agent$(SUFFIX)-$(GOOS)-$(GOARCH)
87-
8884
.PHONY: build-query
8985
build-query: BIN_NAME = query
9086
build-query: build-ui _build-a-binary-query$(SUFFIX)-$(GOOS)-$(GOARCH)
@@ -135,7 +131,6 @@ build-binaries-linux-ppc64le:
135131
# build all binaries for one specific platform GOOS/GOARCH
136132
.PHONY: _build-platform-binaries
137133
_build-platform-binaries: \
138-
build-agent \
139134
build-all-in-one \
140135
build-collector \
141136
build-query \
@@ -155,7 +150,6 @@ _build-platform-binaries: \
155150
.PHONY: _build-platform-binaries-debug
156151
_build-platform-binaries-debug:
157152
_build-platform-binaries-debug: \
158-
build-agent \
159153
build-collector \
160154
build-query \
161155
build-ingester \

Makefile.Windows.mk

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ _build-syso: $(GOVERSIONINFO)
6464
$(eval SEMVER_MAJOR := $(word 2, $(SEMVER_ALL)))
6565
$(eval SEMVER_MINOR := $(word 3, $(SEMVER_ALL)))
6666
$(eval SEMVER_PATCH := $(word 4, $(SEMVER_ALL)))
67-
$(call _build_syso_macro,Jaeger Agent,cmd/agent)
6867
$(call _build_syso_macro,Jaeger Collector,cmd/collector)
6968
$(call _build_syso_macro,Jaeger Query,cmd/query)
7069
$(call _build_syso_macro,Jaeger Ingester,cmd/ingester)

cmd/agent/app/builder.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
2323
"github.com/jaegertracing/jaeger/internal/safeexpvar"
2424
"github.com/jaegertracing/jaeger/pkg/metrics"
25-
"github.com/jaegertracing/jaeger/ports"
2625
agentThrift "github.com/jaegertracing/jaeger/thrift-gen/agent"
2726
)
2827

@@ -38,7 +37,7 @@ const (
3837
binaryProtocol Protocol = "binary"
3938
)
4039

41-
var defaultHTTPServerHostPort = ":" + strconv.Itoa(ports.AgentConfigServerHTTP)
40+
var defaultHTTPServerHostPort = ":" + strconv.Itoa(AgentConfigServerHTTP)
4241

4342
// Model used to distinguish the data transfer model
4443
type Model string

cmd/agent/app/flags.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
"strconv"
1111

1212
"github.com/spf13/viper"
13-
14-
"github.com/jaegertracing/jaeger/ports"
1513
)
1614

1715
const (
@@ -30,9 +28,9 @@ var defaultProcessors = []struct {
3028
protocol Protocol
3129
port int
3230
}{
33-
{model: "zipkin", protocol: "compact", port: ports.AgentZipkinThriftCompactUDP},
34-
{model: "jaeger", protocol: "compact", port: ports.AgentJaegerThriftCompactUDP},
35-
{model: "jaeger", protocol: "binary", port: ports.AgentJaegerThriftBinaryUDP},
31+
{model: "zipkin", protocol: "compact", port: AgentZipkinThriftCompactUDP},
32+
{model: "jaeger", protocol: "compact", port: AgentJaegerThriftCompactUDP},
33+
{model: "jaeger", protocol: "binary", port: AgentJaegerThriftBinaryUDP},
3634
}
3735

3836
// AddFlags adds flags for Builder.

cmd/agent/app/ports.go

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) 2019 The Jaeger Authors.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package app
5+
6+
const (
7+
// AgentJaegerThriftCompactUDP is the default port for receiving Jaeger Thrift over UDP in compact encoding
8+
AgentJaegerThriftCompactUDP = 6831
9+
// AgentJaegerThriftBinaryUDP is the default port for receiving Jaeger Thrift over UDP in binary encoding
10+
AgentJaegerThriftBinaryUDP = 6832
11+
// AgentZipkinThriftCompactUDP is the default port for receiving Zipkin Thrift over UDP in binary encoding
12+
AgentZipkinThriftCompactUDP = 5775
13+
// AgentConfigServerHTTP is the default port for the agent's HTTP config server (e.g. /sampling endpoint)
14+
AgentConfigServerHTTP = 5778
15+
// AgentAdminHTTP is the default admin HTTP port (health check, metrics, etc.)
16+
AgentAdminHTTP = 14271
17+
)

cmd/agent/main.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ import (
2323
"github.com/jaegertracing/jaeger/pkg/config"
2424
"github.com/jaegertracing/jaeger/pkg/metrics"
2525
"github.com/jaegertracing/jaeger/pkg/version"
26-
"github.com/jaegertracing/jaeger/ports"
2726
)
2827

2928
func main() {
3029
println("***************************************************************************************************")
3130
println("*** WARNING jaeger-agent is deprecated. See https://github.com/jaegertracing/jaeger/issues/4739 ***")
3231
println("***************************************************************************************************")
3332

34-
svc := flags.NewService(ports.AgentAdminHTTP)
33+
svc := flags.NewService(app.AgentAdminHTTP)
3534
svc.NoStorage = true
3635

3736
v := viper.New()
@@ -92,7 +91,7 @@ func main() {
9291

9392
command.AddCommand(version.Command())
9493
command.AddCommand(docs.Command(v))
95-
command.AddCommand(status.Command(v, ports.AgentAdminHTTP))
94+
command.AddCommand(status.Command(v, app.AgentAdminHTTP))
9695

9796
config.AddFlags(
9897
v,

cmd/all-in-one/Dockerfile

-24
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ FROM $base_image AS release
88
ARG TARGETARCH
99
ARG USER_UID=10001
1010

11-
# Agent zipkin.thrift compact
12-
EXPOSE 5775/udp
13-
14-
# Agent jaeger.thrift compact
15-
EXPOSE 6831/udp
16-
17-
# Agent jaeger.thrift binary
18-
EXPOSE 6832/udp
19-
20-
# Agent config HTTP
21-
EXPOSE 5778
22-
2311
# Collector OTLP gRPC
2412
EXPOSE 4317
2513

@@ -52,18 +40,6 @@ FROM $debug_image AS debug
5240
ARG TARGETARCH=amd64
5341
ARG USER_UID=10001
5442

55-
# Agent zipkin.thrift compact
56-
EXPOSE 5775/udp
57-
58-
# Agent jaeger.thrift compact
59-
EXPOSE 6831/udp
60-
61-
# Agent jaeger.thrift binary
62-
EXPOSE 6832/udp
63-
64-
# Agent config HTTP
65-
EXPOSE 5778
66-
6743
# Collector OTLP gRPC
6844
EXPOSE 4317
6945

cmd/all-in-one/all_in_one_test.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package main
77
import (
88
"bytes"
99
"encoding/json"
10+
"fmt"
1011
"io"
1112
"net/http"
1213
"os"
@@ -20,24 +21,25 @@ import (
2021
"github.com/stretchr/testify/require"
2122

2223
ui "github.com/jaegertracing/jaeger/model/json"
24+
"github.com/jaegertracing/jaeger/ports"
2325
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
2426
)
2527

2628
// These tests are only run when the environment variable TEST_MODE=integration is set.
2729

2830
const (
29-
host = "0.0.0.0"
30-
queryPort = "16686"
31-
agentPort = "5778"
32-
healthPort = "13133"
33-
queryAddr = "http://" + host + ":" + queryPort
34-
agentAddr = "http://" + host + ":" + agentPort
35-
healthAddr = "http://" + host + ":" + healthPort + "/status"
31+
host = "0.0.0.0"
3632

3733
getServicesURL = "/api/services"
3834
getTraceURL = "/api/traces/"
3935
getServicesAPIV3URL = "/api/v3/services"
40-
getSamplingStrategyURL = "/sampling?service=whatever"
36+
getSamplingStrategyURL = "/api/sampling?service=whatever"
37+
)
38+
39+
var (
40+
queryAddr = fmt.Sprintf("http://%s:%d", host, ports.QueryHTTP)
41+
samplingAddr = fmt.Sprintf("http://%s:%d", host, ports.CollectorHTTP)
42+
healthAddr = fmt.Sprintf("http://%s:%d/status", host, ports.CollectorV2HealthChecks)
4143
)
4244

4345
var traceID string // stores state exchanged between createTrace and getAPITrace
@@ -170,7 +172,7 @@ func getAPITrace(t *testing.T) {
170172
func getSamplingStrategy(t *testing.T) {
171173
// TODO should we test refreshing the strategy file?
172174

173-
r, body := httpGet(t, agentAddr+getSamplingStrategyURL)
175+
r, body := httpGet(t, samplingAddr+getSamplingStrategyURL)
174176
t.Logf("Sampling strategy response: %s", string(body))
175177
require.EqualValues(t, http.StatusOK, r.StatusCode)
176178

cmd/all-in-one/main.go

+11-65
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package main
66

77
import (
88
"context"
9+
"errors"
910
"fmt"
1011
"io"
1112
"log"
@@ -16,9 +17,6 @@ import (
1617
_ "go.uber.org/automaxprocs"
1718
"go.uber.org/zap"
1819

19-
agentApp "github.com/jaegertracing/jaeger/cmd/agent/app"
20-
agentRep "github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
21-
agentGrpcRep "github.com/jaegertracing/jaeger/cmd/agent/app/reporter/grpc"
2220
"github.com/jaegertracing/jaeger/cmd/all-in-one/setupcontext"
2321
collectorApp "github.com/jaegertracing/jaeger/cmd/collector/app"
2422
collectorFlags "github.com/jaegertracing/jaeger/cmd/collector/app/flags"
@@ -76,8 +74,8 @@ func main() {
7674
v := viper.New()
7775
command := &cobra.Command{
7876
Use: "jaeger-all-in-one",
79-
Short: "Jaeger all-in-one distribution with agent, collector and query in one process.",
80-
Long: `Jaeger all-in-one distribution with agent, collector and query. Use with caution this version
77+
Short: "Jaeger all-in-one distribution with collector and query in one process.",
78+
Long: `Jaeger all-in-one distribution with collector and query. Use with caution: this version
8179
by default uses only in-memory database.`,
8280
RunE: func(_ *cobra.Command, _ /* args */ []string) error {
8381
if err := svc.Start(v); err != nil {
@@ -86,7 +84,6 @@ by default uses only in-memory database.`,
8684
logger := svc.Logger // shortcut
8785
baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
8886
version.NewInfoMetrics(baseFactory)
89-
agentMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "agent"})
9087
collectorMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "collector"})
9188
queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"})
9289

@@ -132,12 +129,6 @@ by default uses only in-memory database.`,
132129
logger.Fatal("Failed to create sampling strategy provider", zap.Error(err))
133130
}
134131

135-
aOpts := new(agentApp.Builder).InitFromViper(v)
136-
repOpts := new(agentRep.Options).InitFromViper(v, logger)
137-
grpcBuilder, err := agentGrpcRep.NewConnBuilder().InitFromViper(v)
138-
if err != nil {
139-
logger.Fatal("Failed to configure connection for grpc", zap.Error(err))
140-
}
141132
cOpts, err := new(collectorFlags.CollectorOptions).InitFromViper(v, logger)
142133
if err != nil {
143134
logger.Fatal("Failed to initialize collector", zap.Error(err))
@@ -164,25 +155,6 @@ by default uses only in-memory database.`,
164155
log.Fatal(err)
165156
}
166157

167-
// agent
168-
// if the agent reporter grpc host:port was not explicitly set then use whatever the collector is listening on
169-
if len(grpcBuilder.CollectorHostPorts) == 0 {
170-
grpcBuilder.CollectorHostPorts = append(grpcBuilder.CollectorHostPorts, cOpts.GRPC.HostPort)
171-
}
172-
ctx, cancel := context.WithCancel(context.Background())
173-
defer cancel()
174-
builders := map[agentRep.Type]agentApp.CollectorProxyBuilder{
175-
agentRep.GRPC: agentApp.GRPCCollectorProxyBuilder(grpcBuilder),
176-
}
177-
cp, err := agentApp.CreateCollectorProxy(ctx, agentApp.ProxyBuilderOptions{
178-
Options: *repOpts,
179-
Logger: logger,
180-
Metrics: agentMetricsFactory,
181-
}, builders)
182-
if err != nil {
183-
logger.Fatal("Could not create collector proxy", zap.Error(err))
184-
}
185-
agent := startAgent(cp, aOpts, logger, agentMetricsFactory)
186158
telset := telemetery.Setting{
187159
Logger: svc.Logger,
188160
TracerProvider: tracer.OTEL,
@@ -197,20 +169,16 @@ by default uses only in-memory database.`,
197169
)
198170

199171
svc.RunAndThen(func() {
200-
agent.Stop()
201-
_ = cp.Close()
202-
_ = c.Close()
203-
_ = querySrv.Close()
172+
var errs []error
173+
errs = append(errs, c.Close())
174+
errs = append(errs, querySrv.Close())
204175
if closer, ok := spanWriter.(io.Closer); ok {
205-
if err := closer.Close(); err != nil {
206-
logger.Error("Failed to close span writer", zap.Error(err))
207-
}
176+
errs = append(errs, closer.Close())
208177
}
209-
if err := storageFactory.Close(); err != nil {
210-
logger.Error("Failed to close storage factory", zap.Error(err))
211-
}
212-
if err := tracer.Close(context.Background()); err != nil {
213-
logger.Error("Error shutting down tracer provider", zap.Error(err))
178+
errs = append(errs, storageFactory.Close())
179+
errs = append(errs, tracer.Close(context.Background()))
180+
if err := errors.Join(errs...); err != nil {
181+
logger.Error("Failed to close services", zap.Error(err))
214182
}
215183
})
216184
return nil
@@ -228,9 +196,6 @@ by default uses only in-memory database.`,
228196
command,
229197
svc.AddFlags,
230198
storageFactory.AddPipelineFlags,
231-
agentApp.AddFlags,
232-
agentRep.AddFlags,
233-
agentGrpcRep.AddFlags,
234199
collectorFlags.AddFlags,
235200
queryApp.AddFlags,
236201
samplingStrategyFactory.AddFlags,
@@ -242,25 +207,6 @@ by default uses only in-memory database.`,
242207
}
243208
}
244209

245-
func startAgent(
246-
cp agentApp.CollectorProxy,
247-
b *agentApp.Builder,
248-
logger *zap.Logger,
249-
baseFactory metrics.Factory,
250-
) *agentApp.Agent {
251-
agent, err := b.CreateAgent(cp, logger, baseFactory)
252-
if err != nil {
253-
logger.Fatal("Unable to initialize Jaeger Agent", zap.Error(err))
254-
}
255-
256-
logger.Info("Starting agent")
257-
if err := agent.Run(); err != nil {
258-
logger.Fatal("Failed to run the agent", zap.Error(err))
259-
}
260-
261-
return agent
262-
}
263-
264210
func startQuery(
265211
svc *flags.Service,
266212
qOpts *queryApp.QueryOptions,

cmd/collector/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ func main() {
5252
v := viper.New()
5353
command := &cobra.Command{
5454
Use: "jaeger-collector",
55-
Short: "Jaeger collector receives and processes traces from Jaeger agents and clients",
56-
Long: `Jaeger collector receives traces from Jaeger agents and runs them through a processing pipeline.`,
55+
Short: "Jaeger collector receives and stores traces",
56+
Long: `Jaeger collector receives traces and runs them through a processing pipeline.`,
5757
RunE: func(_ *cobra.Command, _ /* args */ []string) error {
5858
if err := svc.Start(v); err != nil {
5959
return err

cmd/jaeger/Dockerfile

-18
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ FROM $base_image AS release
1010
ARG TARGETARCH
1111
ARG USER_UID=10001
1212

13-
# Agent zipkin.thrift compact
14-
EXPOSE 5775/udp
15-
16-
# Agent jaeger.thrift compact
17-
EXPOSE 6831/udp
18-
19-
# Agent jaeger.thrift binary
20-
EXPOSE 6832/udp
21-
2213
# Sampling config HTTP
2314
EXPOSE 5778
2415

@@ -62,15 +53,6 @@ FROM $debug_image AS debug
6253
ARG TARGETARCH=amd64
6354
ARG USER_UID=10001
6455

65-
# Agent zipkin.thrift compact
66-
EXPOSE 5775/udp
67-
68-
# Agent jaeger.thrift compact
69-
EXPOSE 6831/udp
70-
71-
# Agent jaeger.thrift binary
72-
EXPOSE 6832/udp
73-
7456
# Sampling config HTTP
7557
EXPOSE 5778
7658

0 commit comments

Comments
 (0)