Improve Tempo build options (#4755)

* Set CPU architecture API version for amd64 and arm64

This enables the compiler to use instructions from more recent API versions

* Strip debug symbols from production binary

Reduces Tempo binary size by ~20%

* Remove GO111MODULE=on environment variable

GO111MODULE defaults to 'on' since Go 1.16

* CHANGELOG.md
This commit is contained in:
A. Stoewer
2025-02-27 19:57:01 +10:00
committed by GitHub
parent 1b7a088e08
commit 2c3c357ffd
2 changed files with 19 additions and 5 deletions

View File

@ -23,6 +23,7 @@
configurable via the throughput_bytes_slo field, and it will populate op="traces" label in slo and throughput metrics.
* [FEATURE] Added most_recent=true query hint to TraceQL to return most recent results. [#4238](https://github.com/grafana/tempo/pull/4238) (@joe-elliott)
* [FEATURE] Add ability to add artificial delay to push requests [#4716](https://github.com/grafana/tempo/pull/4716) (@yvrhdn)
* [ENHANCEMENT] Improve Tempo build options [#4755](https://github.com/grafana/tempo/pull/4755) (@stoewer)
* [ENHANCEMENT] Rewrite traces using rebatching [#4690](https://github.com/grafana/tempo/pull/4690) (@stoewer @joe-elliott)
* [ENHANCEMENT] Reorder span iterators [#4754](https://github.com/grafana/tempo/pull/4754) (@stoewer)
* [ENHANCEMENT] Update minio to version [#4341](https://github.com/grafana/tempo/pull/4568) (@javiermolinar)

View File

@ -45,11 +45,24 @@ ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \
# ALL_PKGS is used with 'go cover'
ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))
GO_OPT= -mod vendor -ldflags "-X main.Branch=$(GIT_BRANCH) -X main.Revision=$(GIT_REVISION) -X main.Version=$(VERSION)"
LD_FLAGS=-X main.Branch=$(GIT_BRANCH) -X main.Revision=$(GIT_REVISION) -X main.Version=$(VERSION)
ifeq ($(BUILD_DEBUG),)
LD_FLAGS+= -w
endif
GO_OPT= -mod vendor -ldflags "$(LD_FLAGS)"
ifeq ($(BUILD_DEBUG), 1)
GO_OPT+= -gcflags="all=-N -l"
endif
GO_ENV=CGO_ENABLED=0
ifeq ($(GOARCH),amd64)
GO_ENV+= GOAMD64=v2
endif
ifeq ($(GOARCH),arm64)
GO_ENV+= GOARM64=v8
endif
GOTEST_OPT?= -race -timeout 25m -count=1 -v
GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -cover
GOTEST=gotestsum --format=testname --
@ -66,19 +79,19 @@ FILES_TO_JSONNETFMT=$(shell find ./operations/jsonnet ./operations/tempo-mixin -
##@ Building
.PHONY: tempo
tempo: ## Build tempo
GO111MODULE=on CGO_ENABLED=0 go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-$(GOARCH) $(BUILD_INFO) ./cmd/tempo
$(GO_ENV) go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-$(GOARCH) $(BUILD_INFO) ./cmd/tempo
.PHONY: tempo-query
tempo-query: ## Build tempo-query
GO111MODULE=on CGO_ENABLED=0 go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-query-$(GOARCH) $(BUILD_INFO) ./cmd/tempo-query
$(GO_ENV) go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-query-$(GOARCH) $(BUILD_INFO) ./cmd/tempo-query
.PHONY: tempo-cli
tempo-cli: ## Build tempo-cli
GO111MODULE=on CGO_ENABLED=0 go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-cli-$(GOARCH) $(BUILD_INFO) ./cmd/tempo-cli
$(GO_ENV) go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-cli-$(GOARCH) $(BUILD_INFO) ./cmd/tempo-cli
.PHONY: tempo-vulture ## Build tempo-vulture
tempo-vulture:
GO111MODULE=on CGO_ENABLED=0 go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-vulture-$(GOARCH) $(BUILD_INFO) ./cmd/tempo-vulture
$(GO_ENV) go build $(GO_OPT) -o ./bin/$(GOOS)/tempo-vulture-$(GOARCH) $(BUILD_INFO) ./cmd/tempo-vulture
.PHONY: exe ## Build exe
exe: