Skip to content

Commit

Permalink
Remove existing OpenTelemetry Collector code (#2828)
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling authored Feb 25, 2021
1 parent 5deca64 commit 72279ee
Show file tree
Hide file tree
Showing 142 changed files with 39 additions and 12,412 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci-crossdock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
steps:
- name: crossdock
cmd: bash scripts/build-crossdock.sh
- name: crossdock-otel
cmd: make build-crossdock crossdock-otel
name: ${{ matrix.steps.name }}
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,4 @@ cmd/docs/*.1
cmd/docs/*.yaml
crossdock/crossdock-*
run-crossdock.log
cmd/opentelemetry/cmd/collector/opentelemetry-collector-*
cmd/opentelemetry/cmd/agent/opentelemetry-agent-*
cmd/opentelemetry/cmd/ingester/opentelemetry-ingester-*
cmd/opentelemetry/cmd/all-in-one/opentelemetry-all-in-one-*
__pycache__
50 changes: 5 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
JAEGER_IMPORT_PATH=github.com/jaegertracing/jaeger
STORAGE_PKGS = ./plugin/storage/integration/...
OTEL_COLLECTOR_DIR = ./cmd/opentelemetry

include docker/Makefile

Expand Down Expand Up @@ -87,13 +86,9 @@ clean:
jaeger-ui/packages/jaeger-ui/build

.PHONY: test
test: go-gen test-otel
test: go-gen
bash -c "set -e; set -o pipefail; $(GOTEST) ./... | $(COLORIZE)"

.PHONY: test-otel
test-otel:
cd ${OTEL_COLLECTOR_DIR} && bash -c "set -e; set -o pipefail; $(GOTEST) ./... | $(COLORIZE)"

.PHONY: all-in-one-integration-test
all-in-one-integration-test: go-gen
$(GOTEST) -tags=integration ./cmd/all-in-one/...
Expand All @@ -117,11 +112,6 @@ grpc-plugin-storage-integration-test:
(cd examples/memstore-plugin/ && go build .)
STORAGE=grpc-plugin $(MAKE) storage-integration-test

.PHONY: es-otel-exporter-integration-test
es-otel-exporter-integration-test: go-gen
go clean -testcache
bash -c "set -e; set -o pipefail; cd ${OTEL_COLLECTOR_DIR} && go clean -testcache && $(GOTEST) -tags=integration ./app/exporter/elasticsearchexporter | $(COLORIZE)"

.PHONY: test-compile-es-scripts
test-compile-es-scripts:
docker run --rm -v ${PWD}:/tmp/jaeger python:3-alpine3.11 /usr/local/bin/python -m py_compile /tmp/jaeger/plugin/storage/es/esRollover.py
Expand Down Expand Up @@ -174,7 +164,7 @@ fmt:

.PHONY: lint-gosec
lint-gosec:
time gosec -quiet -exclude=G104,G107 -exclude-dir=cmd/opentelemetry ./...
time gosec -quiet -exclude=G104,G107 ./...

.PHONY: lint-staticcheck
lint-staticcheck:
Expand All @@ -187,7 +177,7 @@ lint-staticcheck:
@[ ! -s "$(LINT_LOG)" ] || (echo "Detected staticcheck failures:" | cat - $(LINT_LOG) && false)

.PHONY: lint
lint: lint-staticcheck lint-gosec lint-otel
lint: lint-staticcheck lint-gosec
$(GOVET) ./...
$(MAKE) go-lint
@echo Running go fmt on ALL_SRC ...
Expand All @@ -196,11 +186,6 @@ lint: lint-staticcheck lint-gosec lint-otel
./scripts/import-order-cleanup.sh stdout > $(IMPORT_LOG)
@[ ! -s "$(FMT_LOG)" -a ! -s "$(IMPORT_LOG)" ] || (echo "Go fmt, license check, or import ordering failures, run 'make fmt'" | cat - $(FMT_LOG) && false)

.PHONY: lint-otel
lint-otel:
cd ${OTEL_COLLECTOR_DIR} && $(GOVET) ./...
cd ${OTEL_COLLECTOR_DIR} && time gosec -quiet -exclude=G104,G107 ./...

.PHONY: go-lint
go-lint:
@cat /dev/null > $(LINT_LOG)
Expand Down Expand Up @@ -277,22 +262,6 @@ build-query build-query-debug: build-ui
build-collector build-collector-debug: elasticsearch-mappings
$(GOBUILD) $(DISABLE_OPTIMIZATIONS) -o ./cmd/collector/collector$(SUFFIX)-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/collector/main.go

.PHONY: build-otel-collector
build-otel-collector: elasticsearch-mappings
cd ${OTEL_COLLECTOR_DIR}/cmd/collector && $(GOBUILD) -o ./opentelemetry-collector-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go

.PHONY: build-otel-agent
build-otel-agent:
cd ${OTEL_COLLECTOR_DIR}/cmd/agent && $(GOBUILD) -o ./opentelemetry-agent-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go

.PHONY: build-otel-ingester
build-otel-ingester:
cd ${OTEL_COLLECTOR_DIR}/cmd/ingester && $(GOBUILD) -o ./opentelemetry-ingester-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go

.PHONY: build-otel-all-in-one
build-otel-all-in-one: build-ui
cd ${OTEL_COLLECTOR_DIR}/cmd/all-in-one && $(GOBUILD) -tags ui -o ./opentelemetry-all-in-one-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go

.PHONY: build-ingester build-ingester-debug
build-ingester build-ingester-debug:
$(GOBUILD) $(DISABLE_OPTIMIZATIONS) -o ./cmd/ingester/ingester$(SUFFIX)-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/ingester/main.go
Expand Down Expand Up @@ -336,11 +305,7 @@ build-platform-binaries: build-agent \
build-all-in-one \
build-examples \
build-tracegen \
build-anonymizer \
build-otel-collector \
build-otel-agent \
build-otel-ingester \
build-otel-all-in-one
build-anonymizer

.PHONY: build-all-platforms
build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin build-binaries-s390x build-binaries-arm64 build-binaries-ppc64le
Expand Down Expand Up @@ -371,9 +336,6 @@ docker-images-jaeger-backend docker-images-jaeger-backend-debug: create-baseimg
cmd/$$component ; \
echo "Finished building $$component ==============" ; \
done
docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-collector:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/collector/Dockerfile cmd/opentelemetry/cmd/collector --build-arg TARGETARCH=$(GOARCH)
docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-agent:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/agent/Dockerfile cmd/opentelemetry/cmd/agent --build-arg TARGETARCH=$(GOARCH)
docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-ingester:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/ingester/Dockerfile cmd/opentelemetry/cmd/ingester --build-arg TARGETARCH=$(GOARCH)

.PHONY: docker-images-tracegen
docker-images-tracegen:
Expand Down Expand Up @@ -449,9 +411,7 @@ install-tools:
install-ci: install-tools

.PHONY: test-ci
# TODO (ys) added test-otel to at least ensure tests run in CI,
# but this needs to be changed in the lint and cover targets instead
test-ci: build-examples lint cover test-otel
test-ci: build-examples lint cover

.PHONY: thrift
thrift: idl/thrift/jaeger.thrift thrift-image
Expand Down
20 changes: 7 additions & 13 deletions cmd/agent/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ const (
suffixServerHostPort = "server-host-port"

processorPrefixFmt = "processor.%s-%s."

// HTTPServerHostPort is the flag for HTTP endpoint
HTTPServerHostPort = "http-server.host-port"
httpServerHostPort = "http-server.host-port"
)

var defaultProcessors = []struct {
Expand All @@ -50,6 +48,11 @@ var defaultProcessors = []struct {

// AddFlags adds flags for Builder.
func AddFlags(flags *flag.FlagSet) {
flags.String(
httpServerHostPort,
defaultHTTPServerHostPort,
"host:port of the http server (e.g. for /sampling point and /baggageRestrictions endpoint)")

for _, p := range defaultProcessors {
prefix := fmt.Sprintf(processorPrefixFmt, p.model, p.protocol)
flags.Int(prefix+suffixWorkers, defaultServerWorkers, "how many workers the processor should run")
Expand All @@ -58,15 +61,6 @@ func AddFlags(flags *flag.FlagSet) {
flags.Int(prefix+suffixServerSocketBufferSize, 0, "socket buffer size for UDP packets in bytes")
flags.String(prefix+suffixServerHostPort, ":"+strconv.Itoa(p.port), "host:port for the UDP server")
}
AddOTELFlags(flags)
}

// AddOTELFlags adds flags that are exposed by OTEL collector
func AddOTELFlags(flags *flag.FlagSet) {
flags.String(
HTTPServerHostPort,
defaultHTTPServerHostPort,
"host:port of the http server (e.g. for /sampling point and /baggageRestrictions endpoint)")
}

// InitFromViper initializes Builder with properties retrieved from Viper.
Expand All @@ -82,7 +76,7 @@ func (b *Builder) InitFromViper(v *viper.Viper) *Builder {
b.Processors = append(b.Processors, *p)
}

b.HTTPServer.HostPort = portNumToHostPort(v.GetString(HTTPServerHostPort))
b.HTTPServer.HostPort = portNumToHostPort(v.GetString(httpServerHostPort))
return b
}

Expand Down
5 changes: 0 additions & 5 deletions cmd/agent/app/reporter/grpc/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ var tlsFlagsConfig = tlscfg.ClientFlagsConfig{
func AddFlags(flags *flag.FlagSet) {
flags.Uint(retry, defaultMaxRetry, "Sets the maximum number of retries for a call")
flags.Int(discoveryMinPeers, 3, "Max number of collectors to which the agent will try to connect at any given time")
AddOTELFlags(flags)
}

// AddOTELFlags adds flags that are exposed by OTEL collector
func AddOTELFlags(flags *flag.FlagSet) {
flags.String(collectorHostPort, "", "Comma-separated string representing host:port of a static list of collectors to connect to directly")
tlsFlagsConfig.AddFlags(flags)
}
Expand Down
52 changes: 20 additions & 32 deletions cmd/collector/app/builder_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,15 @@ import (
)

const (
collectorDynQueueSizeMemory = "collector.queue-size-memory"
collectorQueueSize = "collector.queue-size"
collectorNumWorkers = "collector.num-workers"
// CollectorHTTPHostPort is the flag for collector HTTP port
CollectorHTTPHostPort = "collector.http-server.host-port"
// CollectorGRPCHostPort is the flag for collector gRPC port
CollectorGRPCHostPort = "collector.grpc-server.host-port"
// CollectorZipkinHTTPHostPort is the flag for Zipkin HTTP port
CollectorZipkinHTTPHostPort = "collector.zipkin.host-port"
collectorDynQueueSizeMemory = "collector.queue-size-memory"
collectorGRPCHostPort = "collector.grpc-server.host-port"
collectorHTTPHostPort = "collector.http-server.host-port"
collectorNumWorkers = "collector.num-workers"
collectorQueueSize = "collector.queue-size"
collectorTags = "collector.tags"
collectorZipkinAllowedOrigins = "collector.zipkin.allowed-origins"
collectorZipkinAllowedHeaders = "collector.zipkin.allowed-headers"
collectorZipkinAllowedOrigins = "collector.zipkin.allowed-origins"
collectorZipkinHTTPHostPort = "collector.zipkin.host-port"
)

var tlsGRPCFlagsConfig = tlscfg.ServerFlagsConfig{
Expand Down Expand Up @@ -80,40 +77,31 @@ type CollectorOptions struct {

// AddFlags adds flags for CollectorOptions
func AddFlags(flags *flag.FlagSet) {
flags.Int(collectorQueueSize, DefaultQueueSize, "The queue size of the collector")
flags.Int(collectorNumWorkers, DefaultNumWorkers, "The number of workers pulling items from the queue")
flags.Uint(collectorDynQueueSizeMemory, 0, "(experimental) The max memory size in MiB to use for the dynamic queue.")
flags.Int(collectorQueueSize, DefaultQueueSize, "The queue size of the collector")
flags.String(collectorGRPCHostPort, ports.PortToHostPort(ports.CollectorGRPC), "The host:port (e.g. 127.0.0.1:14250 or :14250) of the collector's GRPC server")
flags.String(collectorHTTPHostPort, ports.PortToHostPort(ports.CollectorHTTP), "The host:port (e.g. 127.0.0.1:14268 or :14268) of the collector's HTTP server")
flags.String(collectorTags, "", "One or more tags to be added to the Process tags of all spans passing through this collector. Ex: key1=value1,key2=${envVar:defaultValue}")
flags.String(collectorZipkinAllowedOrigins, "*", "Comma separated list of allowed origins for the Zipkin collector service, default accepts all")
flags.String(collectorZipkinAllowedHeaders, "content-type", "Comma separated list of allowed headers for the Zipkin collector service, default content-type")
AddOTELJaegerFlags(flags)
AddOTELZipkinFlags(flags)
}
flags.String(collectorZipkinAllowedOrigins, "*", "Comma separated list of allowed origins for the Zipkin collector service, default accepts all")
flags.String(collectorZipkinHTTPHostPort, "", "The host:port (e.g. 127.0.0.1:9411 or :9411) of the collector's Zipkin server (disabled by default)")
flags.Uint(collectorDynQueueSizeMemory, 0, "(experimental) The max memory size in MiB to use for the dynamic queue.")

// AddOTELJaegerFlags adds flags that are exposed by OTEL Jaeger receier
func AddOTELJaegerFlags(flags *flag.FlagSet) {
flags.String(CollectorHTTPHostPort, ports.PortToHostPort(ports.CollectorHTTP), "The host:port (e.g. 127.0.0.1:14268 or :14268) of the collector's HTTP server")
flags.String(CollectorGRPCHostPort, ports.PortToHostPort(ports.CollectorGRPC), "The host:port (e.g. 127.0.0.1:14250 or :14250) of the collector's GRPC server")
tlsGRPCFlagsConfig.AddFlags(flags)
tlsHTTPFlagsConfig.AddFlags(flags)
}

// AddOTELZipkinFlags adds flag that are exposed by OTEL Zipkin receiver
func AddOTELZipkinFlags(flags *flag.FlagSet) {
flags.String(CollectorZipkinHTTPHostPort, "", "The host:port (e.g. 127.0.0.1:9411 or :9411) of the collector's Zipkin server (disabled by default)")
}

// InitFromViper initializes CollectorOptions with properties from viper
func (cOpts *CollectorOptions) InitFromViper(v *viper.Viper) *CollectorOptions {
cOpts.DynQueueSizeMemory = v.GetUint(collectorDynQueueSizeMemory) * 1024 * 1024 // we receive in MiB and store in bytes
cOpts.QueueSize = v.GetInt(collectorQueueSize)
cOpts.NumWorkers = v.GetInt(collectorNumWorkers)
cOpts.CollectorHTTPHostPort = ports.FormatHostPort(v.GetString(CollectorHTTPHostPort))
cOpts.CollectorGRPCHostPort = ports.FormatHostPort(v.GetString(CollectorGRPCHostPort))
cOpts.CollectorZipkinHTTPHostPort = ports.FormatHostPort(v.GetString(CollectorZipkinHTTPHostPort))
cOpts.CollectorGRPCHostPort = ports.FormatHostPort(v.GetString(collectorGRPCHostPort))
cOpts.CollectorHTTPHostPort = ports.FormatHostPort(v.GetString(collectorHTTPHostPort))
cOpts.CollectorTags = flags.ParseJaegerTags(v.GetString(collectorTags))
cOpts.CollectorZipkinAllowedOrigins = v.GetString(collectorZipkinAllowedOrigins)
cOpts.CollectorZipkinAllowedHeaders = v.GetString(collectorZipkinAllowedHeaders)
cOpts.CollectorZipkinAllowedOrigins = v.GetString(collectorZipkinAllowedOrigins)
cOpts.CollectorZipkinHTTPHostPort = ports.FormatHostPort(v.GetString(collectorZipkinHTTPHostPort))
cOpts.DynQueueSizeMemory = v.GetUint(collectorDynQueueSizeMemory) * 1024 * 1024 // we receive in MiB and store in bytes
cOpts.NumWorkers = v.GetInt(collectorNumWorkers)
cOpts.QueueSize = v.GetInt(collectorQueueSize)
cOpts.TLSGRPC = tlsGRPCFlagsConfig.InitFromViper(v)
cOpts.TLSHTTP = tlsHTTPFlagsConfig.InitFromViper(v)

Expand Down
5 changes: 1 addition & 4 deletions cmd/ingester/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ func AddFlags(flagSet *flag.FlagSet) {
ConfigPrefix+SuffixDeadlockInterval,
DefaultDeadlockInterval,
"Interval to check for deadlocks. If no messages gets processed in given time, ingester app will exit. Value of 0 disables deadlock check.")
AddOTELFlags(flagSet)
}

// AddOTELFlags adds only OTEL flags
func AddOTELFlags(flagSet *flag.FlagSet) {
// Authentication flags
flagSet.String(
KafkaConsumerConfigPrefix+SuffixBrokers,
Expand All @@ -115,6 +111,7 @@ func AddOTELFlags(flagSet *flag.FlagSet) {
KafkaConsumerConfigPrefix+SuffixEncoding,
DefaultEncoding,
fmt.Sprintf(`The encoding of spans ("%s") consumed from kafka`, strings.Join(kafka.AllEncodings, "\", \"")))

auth.AddFlags(KafkaConsumerConfigPrefix, flagSet)
}

Expand Down
1 change: 0 additions & 1 deletion cmd/opentelemetry/app/.nocover

This file was deleted.

Loading

0 comments on commit 72279ee

Please sign in to comment.