Skip to content

Commit

Permalink
Merge branch 'main' into feat/optional-tls-version
Browse files Browse the repository at this point in the history
  • Loading branch information
pureiboi committed Oct 10, 2024
2 parents f6b66c8 + 55d0e09 commit 5e81f46
Show file tree
Hide file tree
Showing 227 changed files with 44,437 additions and 50,046 deletions.
24 changes: 0 additions & 24 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,12 @@ $(PROMU): $(BINGO_DIR)/promu.mod
@echo "(re)installing $(GOBIN)/promu-v0.5.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=promu.mod -o=$(GOBIN)/promu-v0.5.0 "github.com/prometheus/promu"

PROTOC_GEN_GO_GRPC := $(GOBIN)/protoc-gen-go-grpc-v1.5.1
$(PROTOC_GEN_GO_GRPC): $(BINGO_DIR)/protoc-gen-go-grpc.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/protoc-gen-go-grpc-v1.5.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-go-grpc.mod -o=$(GOBIN)/protoc-gen-go-grpc-v1.5.1 "google.golang.org/grpc/cmd/protoc-gen-go-grpc"

PROTOC_GEN_GO_VTPROTO := $(GOBIN)/protoc-gen-go-vtproto-v0.6.1-0.20240319094008-0393e58bdf10
$(PROTOC_GEN_GO_VTPROTO): $(BINGO_DIR)/protoc-gen-go-vtproto.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/protoc-gen-go-vtproto-v0.6.1-0.20240319094008-0393e58bdf10"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-go-vtproto.mod -o=$(GOBIN)/protoc-gen-go-vtproto-v0.6.1-0.20240319094008-0393e58bdf10 "github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto"

PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go-v1.34.2
$(PROTOC_GEN_GO): $(BINGO_DIR)/protoc-gen-go.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/protoc-gen-go-v1.34.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-go.mod -o=$(GOBIN)/protoc-gen-go-v1.34.2 "google.golang.org/protobuf/cmd/protoc-gen-go"

PROTOC_GEN_GOGOFAST := $(GOBIN)/protoc-gen-gogofast-v1.3.2
$(PROTOC_GEN_GOGOFAST): $(BINGO_DIR)/protoc-gen-gogofast.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/protoc-gen-gogofast-v1.3.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-gogofast.mod -o=$(GOBIN)/protoc-gen-gogofast-v1.3.2 "github.com/gogo/protobuf/protoc-gen-gogofast"

PROTOC_GO_INJECT_TAG := $(GOBIN)/protoc-go-inject-tag-v1.4.0
$(PROTOC_GO_INJECT_TAG): $(BINGO_DIR)/protoc-go-inject-tag.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/protoc-go-inject-tag-v1.4.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-go-inject-tag.mod -o=$(GOBIN)/protoc-go-inject-tag-v1.4.0 "github.com/favadi/protoc-go-inject-tag"

SHFMT := $(GOBIN)/shfmt-v3.8.0
$(SHFMT): $(BINGO_DIR)/shfmt.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
Expand Down
1 change: 0 additions & 1 deletion .bingo/minio.sum
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,6 @@ github.com/goccy/go-json v0.9.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGF
github.com/gocql/gocql v0.0.0-20220224095938-0eacd3183625/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofiber/fiber/v2 v2.11.0/go.mod h1:oZTLWqYnqpMMuF922SjGbsYZsdpE1MCfh416HNdweIM=
github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
Expand Down
5 changes: 0 additions & 5 deletions .bingo/protoc-gen-go-grpc.mod

This file was deleted.

4 changes: 0 additions & 4 deletions .bingo/protoc-gen-go-grpc.sum

This file was deleted.

5 changes: 0 additions & 5 deletions .bingo/protoc-gen-go-vtproto.mod

This file was deleted.

8 changes: 0 additions & 8 deletions .bingo/protoc-gen-go-vtproto.sum

This file was deleted.

5 changes: 0 additions & 5 deletions .bingo/protoc-gen-go.mod

This file was deleted.

2 changes: 0 additions & 2 deletions .bingo/protoc-gen-go.sum

This file was deleted.

5 changes: 0 additions & 5 deletions .bingo/protoc-go-inject-tag.mod

This file was deleted.

2 changes: 0 additions & 2 deletions .bingo/protoc-go-inject-tag.sum

This file was deleted.

8 changes: 0 additions & 8 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,7 @@ PROMTOOL="${GOBIN}/promtool-v0.47.0"

PROMU="${GOBIN}/promu-v0.5.0"

PROTOC_GEN_GO_GRPC="${GOBIN}/protoc-gen-go-grpc-v1.5.1"

PROTOC_GEN_GO_VTPROTO="${GOBIN}/protoc-gen-go-vtproto-v0.6.1-0.20240319094008-0393e58bdf10"

PROTOC_GEN_GO="${GOBIN}/protoc-gen-go-v1.34.2"

PROTOC_GEN_GOGOFAST="${GOBIN}/protoc-gen-gogofast-v1.3.2"

PROTOC_GO_INJECT_TAG="${GOBIN}/protoc-go-inject-tag-v1.4.0"

SHFMT="${GOBIN}/shfmt-v3.8.0"

1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ executors:
docker:
- image: cimg/go:1.22-node
golang-test:
resource_class: 'large'
docker:
- image: cimg/go:1.22-node
- image: quay.io/thanos/docker-swift-onlyone-authv2-keystone:v0.1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -60,7 +60,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
uses: github/codeql-action/autobuild@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -74,4 +74,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
5 changes: 1 addition & 4 deletions .promu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ build:
binaries:
- name: thanos
path: ./cmd/thanos
flags: -a
tags:
- netgo
- stringlabels
flags: -a -tags netgo
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#7679](https://github.com/thanos-io/thanos/pull/7679) Query: respect store.limit.* flags when evaluating queries

### Added

- [#7763](https://github.com/thanos-io/thanos/pull/7763) Ruler: use native histograms for client latency metrics.
- [#7609](https://github.com/thanos-io/thanos/pull/7609) API: Add limit param to metadata APIs (series, label names, label values).
- [#7429](https://github.com/thanos-io/thanos/pull/7429): Reloader: introduce `TolerateEnvVarExpansionErrors` to allow suppressing errors when expanding environment variables in the configuration file. When set, this will ensure that the reloader won't consider the operation to fail when an unset environment variable is encountered. Note that all unset environment variables are left as is, whereas all set environment variables are expanded as usual.
- [#7560](https://github.com/thanos-io/thanos/pull/7560) Query: Added the possibility of filtering rules by rule_name, rule_group or file to HTTP api.
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| Bartłomiej Płotka | [email protected] | `@bwplotka` | [@bwplotka](https://github.com/bwplotka) | Google |
| Frederic Branczyk | [email protected] | `@brancz` | [@brancz](https://github.com/brancz) | Polar Signals |
| Giedrius Statkevičius | [email protected] | `@Giedrius Statkevičius` | [@GiedriusS](https://github.com/GiedriusS) | Vinted |
| Kemal Akkoyun | [email protected] | `@kakkoyun` | [@kakkoyun](https://github.com/kakkoyun) | Fal |
| Kemal Akkoyun | [email protected] | `@kakkoyun` | [@kakkoyun](https://github.com/kakkoyun) | Independent |
| Lucas Servén Marín | [email protected] | `@squat` | [@squat](https://github.com/squat) | Red Hat |
| Prem Saraswat | [email protected] | `@Prem Saraswat` | [@onprem](https://github.com/onprem) | Red Hat |
| Ben Ye | [email protected] | `@yeya24` | [@yeya24](https://github.com/yeya24) | Amazon Web Services |
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ARCH ?= $(shell uname -m)

# Tools.
PROTOC ?= $(GOBIN)/protoc-$(PROTOC_VERSION)
PROTOC_VERSION ?= 3.20.0
PROTOC_VERSION ?= 3.20.1
GIT ?= $(shell which git)

# Support gsed on OSX (installed via brew), falling back to sed. On Linux
Expand Down Expand Up @@ -292,8 +292,8 @@ go-format: $(GOIMPORTS)

.PHONY: proto
proto: ## Generates Go files from Thanos proto files.
proto: check-git $(GOIMPORTS) $(PROTOC) $(PROTOC_GEN_GOGOFAST) $(PROTOC_GO_INJECT_TAG) $(PROTOC_GEN_GO_VTPROTO) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) $(PROTOC_GEN_GO_VTPROTO)
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" PROTOC_GEN_GOGOFAST_BIN="$(PROTOC_GEN_GOGOFAST)" PROTOC_VERSION="$(PROTOC_VERSION)" PROTOC_GO_INJECT_TAG_BIN="$(PROTOC_GO_INJECT_TAG)" PROTOC_GEN_GO_VTPROTO_BIN="$(PROTOC_GEN_GO_VTPROTO)" PROTOC_GEN_GO_BIN="$(PROTOC_GEN_GO)" PROTOC_GEN_GO_GRPC_BIN="$(PROTOC_GEN_GO_GRPC)" scripts/genproto.sh
proto: check-git $(GOIMPORTS) $(PROTOC) $(PROTOC_GEN_GOGOFAST)
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" PROTOC_GEN_GOGOFAST_BIN="$(PROTOC_GEN_GOGOFAST)" PROTOC_VERSION="$(PROTOC_VERSION)" scripts/genproto.sh

.PHONY: tarballs-release
tarballs-release: ## Build tarballs.
Expand All @@ -312,7 +312,7 @@ test: export THANOS_TEST_ALERTMANAGER_PATH= $(ALERTMANAGER)
test: check-git install-tool-deps
@echo ">> install thanos GOOPTS=${GOOPTS}"
@echo ">> running unit tests (without /test/e2e). Do export THANOS_TEST_OBJSTORE_SKIP=GCS,S3,AZURE,SWIFT,COS,ALIYUNOSS,BOS,OCI,OBS if you want to skip e2e tests against all real store buckets. Current value: ${THANOS_TEST_OBJSTORE_SKIP}"
@go test -race -tags stringlabels -timeout 15m $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e);
@go test -race -timeout 15m $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e);

.PHONY: test-local
test-local: ## Runs test excluding tests for ALL object storage integrations.
Expand Down Expand Up @@ -397,9 +397,6 @@ go-lint: check-git deps $(GOLANGCI_LINT) $(FAILLINT)
@# TODO(bwplotka): Add, Printf, DefaultRegisterer, NewGaugeFunc and MustRegister once exception are accepted. Add fmt.{Errorf}=github.com/pkg/errors.{Errorf} once https://github.com/fatih/faillint/issues/10 is addressed.
@$(FAILLINT) -paths "errors=github.com/pkg/errors,\
github.com/prometheus/tsdb=github.com/prometheus/prometheus/tsdb,\
github.com/prometheus/prometheus/prompb=github.com/thanos-io/thanos/pkg/store/storepb/prompb,\
github.com/gogo/protobuf=google.golang.org/protobuf,\
github.com/gogo/protobuf/proto=google.golang.org/protobuf/proto,\
github.com/prometheus/prometheus/pkg/testutils=github.com/thanos-io/thanos/pkg/testutil,\
github.com/prometheus/client_golang/prometheus.{DefaultGatherer,DefBuckets,NewUntypedFunc,UntypedFunc},\
github.com/prometheus/client_golang/prometheus.{NewCounter,NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,\
Expand Down
69 changes: 0 additions & 69 deletions cmd/thanos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,77 +30,8 @@ import (
"github.com/thanos-io/thanos/pkg/extkingpin"
"github.com/thanos-io/thanos/pkg/logging"
"github.com/thanos-io/thanos/pkg/tracing/client"

// use the original golang/protobuf package we can continue serializing
// messages from our dependencies, particularly from OTEL. Original version
// from Vitess.
"google.golang.org/grpc/encoding"
"google.golang.org/grpc/mem"

// Guarantee that the built-in proto is called registered before this one
// so that it can be replaced.
_ "google.golang.org/grpc/encoding/proto"
)

// Name is the name registered for the proto compressor.
const Name = "proto"

// vtprotoCodec is like the vtprotobuf codec
// but also handles non-vtproto messages that are needed
// for stuff like OpenTelemetry. Otherwise, such errors appear:
// error while marshaling: failed to marshal, message is *v1.ExportTraceServiceRequest (missing vtprotobuf helpers).
type vtprotoCodec struct {
fallback encoding.CodecV2
}

type vtprotoMessage interface {
MarshalVT() ([]byte, error)
UnmarshalVT([]byte) error
MarshalToSizedBufferVT(data []byte) (int, error)
SizeVT() int
}

func (c *vtprotoCodec) Marshal(v any) (mem.BufferSlice, error) {
if m, ok := v.(vtprotoMessage); ok {
size := m.SizeVT()
if mem.IsBelowBufferPoolingThreshold(size) {
buf := make([]byte, size)
if _, err := m.MarshalToSizedBufferVT(buf); err != nil {
return nil, err
}
return mem.BufferSlice{mem.SliceBuffer(buf)}, nil
}
pool := mem.DefaultBufferPool()
buf := pool.Get(size)
if _, err := m.MarshalToSizedBufferVT((*buf)[:size]); err != nil {
pool.Put(buf)
return nil, err
}
return mem.BufferSlice{mem.NewBuffer(buf, pool)}, nil
}

return c.fallback.Marshal(v)
}

func (c *vtprotoCodec) Unmarshal(data mem.BufferSlice, v any) error {
if m, ok := v.(vtprotoMessage); ok {
buf := data.MaterializeToBuffer(mem.DefaultBufferPool())
defer buf.Free()
return m.UnmarshalVT(buf.ReadOnlyData())
}

return c.fallback.Unmarshal(data, v)
}
func (vtprotoCodec) Name() string {
return Name
}

func init() {
encoding.RegisterCodecV2(&vtprotoCodec{
fallback: encoding.GetCodecV2("proto"),
})
}

func main() {
// We use mmaped resources in most of the components so hardcode PanicOnFault to true. This allows us to recover (if we can e.g if queries
// are temporarily accessing unmapped memory).
Expand Down
16 changes: 8 additions & 8 deletions cmd/thanos/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ func TestRegression4960_Deadlock(t *testing.T) {
id, err = e2eutil.CreateBlock(
ctx,
dir,
[]labels.Labels{labels.FromStrings("a", "1")},
[]labels.Labels{{{Name: "a", Value: "1"}}},
1, 0, downsample.ResLevel1DownsampleRange+1, // Pass the minimum ResLevel1DownsampleRange check.
labels.FromStrings("e1", "1"),
labels.Labels{{Name: "e1", Value: "1"}},
downsample.ResLevel0, metadata.NoneFunc)
testutil.Ok(t, err)
testutil.Ok(t, block.Upload(ctx, logger, bkt, path.Join(dir, id.String()), metadata.NoneFunc))
Expand All @@ -134,9 +134,9 @@ func TestRegression4960_Deadlock(t *testing.T) {
id2, err = e2eutil.CreateBlock(
ctx,
dir,
[]labels.Labels{labels.FromStrings("a", "2")},
[]labels.Labels{{{Name: "a", Value: "2"}}},
1, 0, downsample.ResLevel1DownsampleRange+1, // Pass the minimum ResLevel1DownsampleRange check.
labels.FromStrings("e1", "2"),
labels.Labels{{Name: "e1", Value: "2"}},
downsample.ResLevel0, metadata.NoneFunc)
testutil.Ok(t, err)
testutil.Ok(t, block.Upload(ctx, logger, bkt, path.Join(dir, id2.String()), metadata.NoneFunc))
Expand All @@ -145,9 +145,9 @@ func TestRegression4960_Deadlock(t *testing.T) {
id3, err = e2eutil.CreateBlock(
ctx,
dir,
[]labels.Labels{labels.FromStrings("a", "2")},
[]labels.Labels{{{Name: "a", Value: "2"}}},
1, 0, downsample.ResLevel1DownsampleRange+1, // Pass the minimum ResLevel1DownsampleRange check.
labels.FromStrings("e1", "2"),
labels.Labels{{Name: "e1", Value: "2"}},
downsample.ResLevel0, metadata.NoneFunc)
testutil.Ok(t, err)
testutil.Ok(t, block.Upload(ctx, logger, bkt, path.Join(dir, id3.String()), metadata.NoneFunc))
Expand Down Expand Up @@ -185,9 +185,9 @@ func TestCleanupDownsampleCacheFolder(t *testing.T) {
id, err = e2eutil.CreateBlock(
ctx,
dir,
[]labels.Labels{labels.FromStrings("a", "1")},
[]labels.Labels{{{Name: "a", Value: "1"}}},
1, 0, downsample.ResLevel1DownsampleRange+1, // Pass the minimum ResLevel1DownsampleRange check.
labels.FromStrings("e1", "1"),
labels.Labels{{Name: "e1", Value: "1"}},
downsample.ResLevel0, metadata.NoneFunc)
testutil.Ok(t, err)
testutil.Ok(t, block.Upload(ctx, logger, bkt, path.Join(dir, id.String()), metadata.NoneFunc))
Expand Down
2 changes: 1 addition & 1 deletion cmd/thanos/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ func runQuery(

infoSrv := info.NewInfoServer(
component.Query.String(),
info.WithLabelSetFunc(func() []*labelpb.LabelSet { return proxyStore.LabelSet() }),
info.WithLabelSetFunc(func() []labelpb.ZLabelSet { return proxyStore.LabelSet() }),
info.WithStoreInfoFunc(func() (*infopb.StoreInfo, error) {
if httpProbe.IsReady() {
mint, maxt := proxyStore.TimeRange()
Expand Down
Loading

0 comments on commit 5e81f46

Please sign in to comment.