Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jaeger-agent from distributions #6081

Merged
merged 8 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Makefile.BuildBinaries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ build-jaeger: build-ui _build-a-binary-jaeger$(SUFFIX)-$(GOOS)-$(GOARCH)
build-all-in-one: BIN_NAME = all-in-one
build-all-in-one: build-ui _build-a-binary-all-in-one$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-agent
build-agent: BIN_NAME = agent
build-agent: _build-a-binary-agent$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-query
build-query: BIN_NAME = query
build-query: build-ui _build-a-binary-query$(SUFFIX)-$(GOOS)-$(GOARCH)
Expand Down Expand Up @@ -135,7 +131,6 @@ build-binaries-linux-ppc64le:
# build all binaries for one specific platform GOOS/GOARCH
.PHONY: _build-platform-binaries
_build-platform-binaries: \
build-agent \
build-all-in-one \
build-collector \
build-query \
Expand All @@ -155,7 +150,6 @@ _build-platform-binaries: \
.PHONY: _build-platform-binaries-debug
_build-platform-binaries-debug:
_build-platform-binaries-debug: \
build-agent \
build-collector \
build-query \
build-ingester \
Expand Down
1 change: 0 additions & 1 deletion Makefile.Windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ _build-syso: $(GOVERSIONINFO)
$(eval SEMVER_MAJOR := $(word 2, $(SEMVER_ALL)))
$(eval SEMVER_MINOR := $(word 3, $(SEMVER_ALL)))
$(eval SEMVER_PATCH := $(word 4, $(SEMVER_ALL)))
$(call _build_syso_macro,Jaeger Agent,cmd/agent)
$(call _build_syso_macro,Jaeger Collector,cmd/collector)
$(call _build_syso_macro,Jaeger Query,cmd/query)
$(call _build_syso_macro,Jaeger Ingester,cmd/ingester)
Expand Down
3 changes: 1 addition & 2 deletions cmd/agent/app/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
"github.com/jaegertracing/jaeger/internal/safeexpvar"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/ports"
agentThrift "github.com/jaegertracing/jaeger/thrift-gen/agent"
)

Expand All @@ -38,7 +37,7 @@ const (
binaryProtocol Protocol = "binary"
)

var defaultHTTPServerHostPort = ":" + strconv.Itoa(ports.AgentConfigServerHTTP)
var defaultHTTPServerHostPort = ":" + strconv.Itoa(AgentConfigServerHTTP)

// Model used to distinguish the data transfer model
type Model string
Expand Down
8 changes: 3 additions & 5 deletions cmd/agent/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"strconv"

"github.com/spf13/viper"

"github.com/jaegertracing/jaeger/ports"
)

const (
Expand All @@ -30,9 +28,9 @@ var defaultProcessors = []struct {
protocol Protocol
port int
}{
{model: "zipkin", protocol: "compact", port: ports.AgentZipkinThriftCompactUDP},
{model: "jaeger", protocol: "compact", port: ports.AgentJaegerThriftCompactUDP},
{model: "jaeger", protocol: "binary", port: ports.AgentJaegerThriftBinaryUDP},
{model: "zipkin", protocol: "compact", port: AgentZipkinThriftCompactUDP},
{model: "jaeger", protocol: "compact", port: AgentJaegerThriftCompactUDP},
{model: "jaeger", protocol: "binary", port: AgentJaegerThriftBinaryUDP},
}

// AddFlags adds flags for Builder.
Expand Down
17 changes: 17 additions & 0 deletions cmd/agent/app/ports.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2019 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package app

const (
// AgentJaegerThriftCompactUDP is the default port for receiving Jaeger Thrift over UDP in compact encoding
AgentJaegerThriftCompactUDP = 6831
// AgentJaegerThriftBinaryUDP is the default port for receiving Jaeger Thrift over UDP in binary encoding
AgentJaegerThriftBinaryUDP = 6832
// AgentZipkinThriftCompactUDP is the default port for receiving Zipkin Thrift over UDP in binary encoding
AgentZipkinThriftCompactUDP = 5775
// AgentConfigServerHTTP is the default port for the agent's HTTP config server (e.g. /sampling endpoint)
AgentConfigServerHTTP = 5778
// AgentAdminHTTP is the default admin HTTP port (health check, metrics, etc.)
AgentAdminHTTP = 14271
)
5 changes: 2 additions & 3 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import (
"github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/pkg/version"
"github.com/jaegertracing/jaeger/ports"
)

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

svc := flags.NewService(ports.AgentAdminHTTP)
svc := flags.NewService(app.AgentAdminHTTP)
svc.NoStorage = true

v := viper.New()
Expand Down Expand Up @@ -92,7 +91,7 @@ func main() {

command.AddCommand(version.Command())
command.AddCommand(docs.Command(v))
command.AddCommand(status.Command(v, ports.AgentAdminHTTP))
command.AddCommand(status.Command(v, app.AgentAdminHTTP))

config.AddFlags(
v,
Expand Down
24 changes: 0 additions & 24 deletions cmd/all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ FROM $base_image AS release
ARG TARGETARCH
ARG USER_UID=10001

# Agent zipkin.thrift compact
EXPOSE 5775/udp

# Agent jaeger.thrift compact
EXPOSE 6831/udp

# Agent jaeger.thrift binary
EXPOSE 6832/udp

# Agent config HTTP
EXPOSE 5778

# Collector OTLP gRPC
EXPOSE 4317

Expand Down Expand Up @@ -52,18 +40,6 @@ FROM $debug_image AS debug
ARG TARGETARCH=amd64
ARG USER_UID=10001

# Agent zipkin.thrift compact
EXPOSE 5775/udp

# Agent jaeger.thrift compact
EXPOSE 6831/udp

# Agent jaeger.thrift binary
EXPOSE 6832/udp

# Agent config HTTP
EXPOSE 5778

# Collector OTLP gRPC
EXPOSE 4317

Expand Down
20 changes: 11 additions & 9 deletions cmd/all-in-one/all_in_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
Expand All @@ -20,24 +21,25 @@ import (
"github.com/stretchr/testify/require"

ui "github.com/jaegertracing/jaeger/model/json"
"github.com/jaegertracing/jaeger/ports"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)

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

const (
host = "0.0.0.0"
queryPort = "16686"
agentPort = "5778"
healthPort = "13133"
queryAddr = "http://" + host + ":" + queryPort
agentAddr = "http://" + host + ":" + agentPort
healthAddr = "http://" + host + ":" + healthPort + "/status"
host = "0.0.0.0"

getServicesURL = "/api/services"
getTraceURL = "/api/traces/"
getServicesAPIV3URL = "/api/v3/services"
getSamplingStrategyURL = "/sampling?service=whatever"
getSamplingStrategyURL = "/api/sampling?service=whatever"
)

var (
queryAddr = fmt.Sprintf("http://%s:%d", host, ports.QueryHTTP)
samplingAddr = fmt.Sprintf("http://%s:%d", host, ports.CollectorHTTP)
healthAddr = fmt.Sprintf("http://%s:%d/status", host, ports.CollectorV2HealthChecks)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question for my own understanding: why is this the port here being called CollectorV2HealthChecks when it is being used in v1 as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not being used with v1:

func healthCheckV2(t *testing.T) {
	if os.Getenv("HEALTHCHECK_V2") == "false" {
		t.Skip("Skipping health check for V1 Binary")
	}

)

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

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

Expand Down
76 changes: 11 additions & 65 deletions cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"context"
"errors"
"fmt"
"io"
"log"
Expand All @@ -16,9 +17,6 @@ import (
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"

agentApp "github.com/jaegertracing/jaeger/cmd/agent/app"
agentRep "github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
agentGrpcRep "github.com/jaegertracing/jaeger/cmd/agent/app/reporter/grpc"
"github.com/jaegertracing/jaeger/cmd/all-in-one/setupcontext"
collectorApp "github.com/jaegertracing/jaeger/cmd/collector/app"
collectorFlags "github.com/jaegertracing/jaeger/cmd/collector/app/flags"
Expand Down Expand Up @@ -76,8 +74,8 @@ func main() {
v := viper.New()
command := &cobra.Command{
Use: "jaeger-all-in-one",
Short: "Jaeger all-in-one distribution with agent, collector and query in one process.",
Long: `Jaeger all-in-one distribution with agent, collector and query. Use with caution this version
Short: "Jaeger all-in-one distribution with collector and query in one process.",
Long: `Jaeger all-in-one distribution with collector and query. Use with caution: this version
by default uses only in-memory database.`,
RunE: func(_ *cobra.Command, _ /* args */ []string) error {
if err := svc.Start(v); err != nil {
Expand All @@ -86,7 +84,6 @@ by default uses only in-memory database.`,
logger := svc.Logger // shortcut
baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
version.NewInfoMetrics(baseFactory)
agentMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "agent"})
collectorMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "collector"})
queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"})

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

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

// agent
// if the agent reporter grpc host:port was not explicitly set then use whatever the collector is listening on
if len(grpcBuilder.CollectorHostPorts) == 0 {
grpcBuilder.CollectorHostPorts = append(grpcBuilder.CollectorHostPorts, cOpts.GRPC.HostPort)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
builders := map[agentRep.Type]agentApp.CollectorProxyBuilder{
agentRep.GRPC: agentApp.GRPCCollectorProxyBuilder(grpcBuilder),
}
cp, err := agentApp.CreateCollectorProxy(ctx, agentApp.ProxyBuilderOptions{
Options: *repOpts,
Logger: logger,
Metrics: agentMetricsFactory,
}, builders)
if err != nil {
logger.Fatal("Could not create collector proxy", zap.Error(err))
}
agent := startAgent(cp, aOpts, logger, agentMetricsFactory)
telset := telemetery.Setting{
Logger: svc.Logger,
TracerProvider: tracer.OTEL,
Expand All @@ -197,20 +169,16 @@ by default uses only in-memory database.`,
)

svc.RunAndThen(func() {
agent.Stop()
_ = cp.Close()
_ = c.Close()
_ = querySrv.Close()
var errs []error
errs = append(errs, c.Close())
errs = append(errs, querySrv.Close())
if closer, ok := spanWriter.(io.Closer); ok {
if err := closer.Close(); err != nil {
logger.Error("Failed to close span writer", zap.Error(err))
}
errs = append(errs, closer.Close())
}
if err := storageFactory.Close(); err != nil {
logger.Error("Failed to close storage factory", zap.Error(err))
}
if err := tracer.Close(context.Background()); err != nil {
logger.Error("Error shutting down tracer provider", zap.Error(err))
errs = append(errs, storageFactory.Close())
errs = append(errs, tracer.Close(context.Background()))
if err := errors.Join(errs...); err != nil {
logger.Error("Failed to close services", zap.Error(err))
}
})
return nil
Expand All @@ -228,9 +196,6 @@ by default uses only in-memory database.`,
command,
svc.AddFlags,
storageFactory.AddPipelineFlags,
agentApp.AddFlags,
agentRep.AddFlags,
agentGrpcRep.AddFlags,
collectorFlags.AddFlags,
queryApp.AddFlags,
samplingStrategyFactory.AddFlags,
Expand All @@ -242,25 +207,6 @@ by default uses only in-memory database.`,
}
}

func startAgent(
cp agentApp.CollectorProxy,
b *agentApp.Builder,
logger *zap.Logger,
baseFactory metrics.Factory,
) *agentApp.Agent {
agent, err := b.CreateAgent(cp, logger, baseFactory)
if err != nil {
logger.Fatal("Unable to initialize Jaeger Agent", zap.Error(err))
}

logger.Info("Starting agent")
if err := agent.Run(); err != nil {
logger.Fatal("Failed to run the agent", zap.Error(err))
}

return agent
}

func startQuery(
svc *flags.Service,
qOpts *queryApp.QueryOptions,
Expand Down
4 changes: 2 additions & 2 deletions cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func main() {
v := viper.New()
command := &cobra.Command{
Use: "jaeger-collector",
Short: "Jaeger collector receives and processes traces from Jaeger agents and clients",
Long: `Jaeger collector receives traces from Jaeger agents and runs them through a processing pipeline.`,
Short: "Jaeger collector receives and stores traces",
Long: `Jaeger collector receives traces and runs them through a processing pipeline.`,
RunE: func(_ *cobra.Command, _ /* args */ []string) error {
if err := svc.Start(v); err != nil {
return err
Expand Down
18 changes: 0 additions & 18 deletions cmd/jaeger/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ FROM $base_image AS release
ARG TARGETARCH
ARG USER_UID=10001

# Agent zipkin.thrift compact
EXPOSE 5775/udp

# Agent jaeger.thrift compact
EXPOSE 6831/udp

# Agent jaeger.thrift binary
EXPOSE 6832/udp

# Sampling config HTTP
EXPOSE 5778

Expand Down Expand Up @@ -62,15 +53,6 @@ FROM $debug_image AS debug
ARG TARGETARCH=amd64
ARG USER_UID=10001

# Agent zipkin.thrift compact
EXPOSE 5775/udp

# Agent jaeger.thrift compact
EXPOSE 6831/udp

# Agent jaeger.thrift binary
EXPOSE 6832/udp

# Sampling config HTTP
EXPOSE 5778

Expand Down
Loading
Loading