From 407320c68163a24d603e09cf5db6dbb400705882 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 01:48:00 +0000 Subject: [PATCH] Bump github.com/thanos-io/thanos Bumps [github.com/thanos-io/thanos](https://github.com/thanos-io/thanos) from 0.40.1-0.20260112164636-49dde505913b to 0.41.0. - [Release notes](https://github.com/thanos-io/thanos/releases) - [Changelog](https://github.com/thanos-io/thanos/blob/main/CHANGELOG.md) - [Commits](https://github.com/thanos-io/thanos/commits/v0.41.0) --- updated-dependencies: - dependency-name: github.com/thanos-io/thanos dependency-version: 0.41.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 +- go.sum | 8 +- .../thanos/pkg/query/remote_engine.go | 156 +++++++++--------- .../thanos-io/thanos/pkg/store/batchable.go | 4 + vendor/modules.txt | 4 +- 5 files changed, 92 insertions(+), 84 deletions(-) diff --git a/go.mod b/go.mod index f349810f22..cf7468e8b9 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/stretchr/testify v1.11.1 github.com/thanos-io/objstore v0.0.0-20250804093838-71d60dfee488 github.com/thanos-io/promql-engine v0.0.0-20260119085929-dd5223783674 - github.com/thanos-io/thanos v0.40.1-0.20260204190131-802f43f3bc64 + github.com/thanos-io/thanos v0.41.0 github.com/uber/jaeger-client-go v2.30.0+incompatible github.com/weaveworks/common v0.0.0-20230728070032-dd9e68f319d5 go.etcd.io/etcd/api/v3 v3.5.17 @@ -303,7 +303,7 @@ require ( google.golang.org/api v0.252.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3 // indirect gopkg.in/telebot.v3 v3.3.8 // indirect k8s.io/apimachinery v0.34.1 // indirect k8s.io/client-go v0.34.1 // indirect diff --git a/go.sum b/go.sum index cd7b026778..e7f903cdde 100644 --- a/go.sum +++ b/go.sum @@ -1791,8 +1791,8 @@ github.com/thanos-io/objstore v0.0.0-20250804093838-71d60dfee488 h1:khBsQLLRoF1K github.com/thanos-io/objstore v0.0.0-20250804093838-71d60dfee488/go.mod h1:uDHLkMKOGDAnlN75EAz8VrRzob1+VbgYSuUleatWuF0= github.com/thanos-io/promql-engine v0.0.0-20260119085929-dd5223783674 h1:C5yBEuIZCaeLh90lcUGfnGepmwDfGGYLu6+w7RxR7og= github.com/thanos-io/promql-engine v0.0.0-20260119085929-dd5223783674/go.mod h1:uzn40oZHPXvfdP498h+MiRL2fN7RF519gNaV3LyhChc= -github.com/thanos-io/thanos v0.40.1-0.20260204190131-802f43f3bc64 h1:9gQnp3k3te0BIbLFA/diuOgoJMQ2vhvTo8hzrPMcfiI= -github.com/thanos-io/thanos v0.40.1-0.20260204190131-802f43f3bc64/go.mod h1:ZgknkTTliTvUeZy4lqVYrRp2l5TxUGLWcaonGyUbynw= +github.com/thanos-io/thanos v0.41.0 h1:GDPGynjHBa8ORAX7DfluBFjHbMeY1BzjLTGdviFvo7Q= +github.com/thanos-io/thanos v0.41.0/go.mod h1:ppdHafpAT8WAbcwgLiNU4jNtNe17Ct3xX9dXq+h6g2k= github.com/tinylib/msgp v1.6.1 h1:ESRv8eL3u+DNHUoSAAQRE50Hm162zqAnBoGv9PzScPY= github.com/tinylib/msgp v1.6.1/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tjhop/slog-gokit v0.1.4 h1:uj/vbDt3HaF0Py8bHPV4ti/s0utnO0miRbO277FLBKM= @@ -2696,8 +2696,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3 h1:C4WAdL+FbjnGlpp2S+HMVhBeCq2Lcib4xZqfPNF6OoQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.71.2 h1:KnzCueW4s+8ojAPZ+NnyZAELjsIMJGteKjKejieEC7M= google.golang.org/grpc v1.71.2/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= diff --git a/vendor/github.com/thanos-io/thanos/pkg/query/remote_engine.go b/vendor/github.com/thanos-io/thanos/pkg/query/remote_engine.go index c6bbec019a..1c75d7c494 100644 --- a/vendor/github.com/thanos-io/thanos/pkg/query/remote_engine.go +++ b/vendor/github.com/thanos-io/thanos/pkg/query/remote_engine.go @@ -26,15 +26,11 @@ import ( "github.com/thanos-io/thanos/pkg/api/query/querypb" "github.com/thanos-io/thanos/pkg/info/infopb" "github.com/thanos-io/thanos/pkg/server/http/middleware" - "github.com/thanos-io/thanos/pkg/store/labelpb" + "github.com/thanos-io/thanos/pkg/store" "github.com/thanos-io/thanos/pkg/store/storepb/prompb" grpc_tracing "github.com/thanos-io/thanos/pkg/tracing/tracing_middleware" ) -// defaultResponseBatchSize is the default number of timeseries to batch per gRPC response message. -// This value provides a good balance between reducing per-message overhead and keeping message sizes reasonable. -const defaultResponseBatchSize = 64 - type RemoteEndpointsCreator func( replicaLabels []string, partialResponse bool, @@ -121,15 +117,14 @@ func (r remoteEndpoints) Engines() []api.RemoteEngine { type remoteEngine struct { opts Opts logger log.Logger - client Client - mintOnce sync.Once - mint int64 - maxtOnce sync.Once - maxt int64 - labelSetsOnce sync.Once - labelSets []labels.Labels + initOnce sync.Once + + mint int64 + maxt int64 + labelSets []labels.Labels + partitionLabelSets []labels.Labels } func NewRemoteEngine(logger log.Logger, queryClient Client, opts Opts) *remoteEngine { @@ -140,100 +135,109 @@ func NewRemoteEngine(logger log.Logger, queryClient Client, opts Opts) *remoteEn } } -// MinT returns the minimum timestamp that is safe to query in the remote engine. -// In order to calculate it, we find the highest min time for each label set, and we return -// the lowest of those values. -// Calculating the MinT this way makes remote queries resilient to cases where one tsdb replica would delete -// a block due to retention before other replicas did the same. -// See https://github.com/thanos-io/promql-engine/issues/187. -func (r *remoteEngine) MinT() int64 { +func (r *remoteEngine) init() { + r.initOnce.Do(func() { + replicaLabelSet := make(map[string]struct{}) + for _, lbl := range r.opts.ReplicaLabels { + replicaLabelSet[lbl] = struct{}{} + } + partitionLabelsSet := make(map[string]struct{}) + for _, lbl := range r.opts.PartitionLabels { + partitionLabelsSet[lbl] = struct{}{} + } + + // strip out replica labels and scopes the remaining labels + // onto the partition labels if they are set. - r.mintOnce.Do(func() { + // partitionLabelSets are used to compute how to push down, they are the minimum set of labels + // that form a partition of the remote engines. + // labelSets are all labelsets of the remote engine, they are used for fan-out pruning on labels + // that dont meaningfully contribute to the partitioning but are still useful. var ( hashBuf = make([]byte, 0, 128) highestMintByLabelSet = make(map[uint64]int64) + + labelSetsBuilder labels.ScratchBuilder + partitionLabelSetsBuilder labels.ScratchBuilder + + labelSets = make([]labels.Labels, 0, len(r.client.tsdbInfos)) + partitionLabelSets = make([]labels.Labels, 0, len(r.client.tsdbInfos)) ) - for _, lset := range r.adjustedInfos() { - key, _ := labelpb.ZLabelsToPromLabels(lset.Labels.Labels).HashWithoutLabels(hashBuf) + for _, info := range r.client.tsdbInfos { + labelSetsBuilder.Reset() + partitionLabelSetsBuilder.Reset() + for _, lbl := range info.Labels.Labels { + if _, ok := replicaLabelSet[lbl.Name]; ok { + continue + } + labelSetsBuilder.Add(lbl.Name, lbl.Value) + if _, ok := partitionLabelsSet[lbl.Name]; !ok && len(partitionLabelsSet) > 0 { + continue + } + partitionLabelSetsBuilder.Add(lbl.Name, lbl.Value) + } + + partitionLabelSet := partitionLabelSetsBuilder.Labels() + labelSet := labelSetsBuilder.Labels() + labelSets = append(labelSets, labelSet) + partitionLabelSets = append(partitionLabelSets, partitionLabelSet) + + key, _ := partitionLabelSet.HashWithoutLabels(hashBuf) lsetMinT, ok := highestMintByLabelSet[key] if !ok { - highestMintByLabelSet[key] = lset.MinTime + highestMintByLabelSet[key] = info.MinTime continue } // If we are querying with overlapping intervals, we want to find the first available timestamp // otherwise we want to find the last available timestamp. - if r.opts.QueryDistributedWithOverlappingInterval && lset.MinTime < lsetMinT { - highestMintByLabelSet[key] = lset.MinTime - } else if !r.opts.QueryDistributedWithOverlappingInterval && lset.MinTime > lsetMinT { - highestMintByLabelSet[key] = lset.MinTime + if r.opts.QueryDistributedWithOverlappingInterval && info.MinTime < lsetMinT { + highestMintByLabelSet[key] = info.MinTime + } else if !r.opts.QueryDistributedWithOverlappingInterval && info.MinTime > lsetMinT { + highestMintByLabelSet[key] = info.MinTime } } - var mint int64 = math.MaxInt64 + + // mint is the minimum timestamp that is safe to query in the remote engine. + // In order to calculate it, we find the highest min time for each label set, and we return + // the lowest of those values. + // Calculating the MinT this way makes remote queries resilient to cases where one tsdb replica would delete + // a block due to retention before other replicas did the same. + // See https://github.com/thanos-io/promql-engine/issues/187. + var ( + mint = int64(math.MaxInt64) + maxt = r.client.tsdbInfos.MaxT() + ) for _, m := range highestMintByLabelSet { if m < mint { mint = m } } + r.mint = mint + r.maxt = maxt + r.labelSets = labelSets + r.partitionLabelSets = partitionLabelSets }) +} +func (r *remoteEngine) MinT() int64 { + r.init() return r.mint } func (r *remoteEngine) MaxT() int64 { - r.maxtOnce.Do(func() { - r.maxt = r.client.tsdbInfos.MaxT() - }) + r.init() return r.maxt } -func (r *remoteEngine) PartitionLabelSets() []labels.Labels { - r.labelSetsOnce.Do(func() { - r.labelSets = r.adjustedInfos().LabelSets() - }) - return r.labelSets -} - func (r *remoteEngine) LabelSets() []labels.Labels { - r.labelSetsOnce.Do(func() { - r.labelSets = r.adjustedInfos().LabelSets() - }) + r.init() return r.labelSets } -// adjustedInfos strips out replica labels and scopes the remaining labels -// onto the partition labels if they are set. -func (r *remoteEngine) adjustedInfos() infopb.TSDBInfos { - replicaLabelSet := make(map[string]struct{}) - for _, lbl := range r.opts.ReplicaLabels { - replicaLabelSet[lbl] = struct{}{} - } - partitionLabelsSet := make(map[string]struct{}) - for _, lbl := range r.opts.PartitionLabels { - partitionLabelsSet[lbl] = struct{}{} - } - - // Strip replica labels from the result. - infos := make(infopb.TSDBInfos, 0, len(r.client.tsdbInfos)) - var builder labels.ScratchBuilder - for _, info := range r.client.tsdbInfos { - builder.Reset() - for _, lbl := range info.Labels.Labels { - if _, ok := replicaLabelSet[lbl.Name]; ok { - continue - } - if _, ok := partitionLabelsSet[lbl.Name]; !ok && len(partitionLabelsSet) > 0 { - continue - } - builder.Add(lbl.Name, lbl.Value) - } - infos = append(infos, infopb.NewTSDBInfo( - info.MinTime, - info.MaxTime, - labelpb.ZLabelsFromPromLabels(builder.Labels())), - ) - } - return infos +func (r *remoteEngine) PartitionLabelSets() []labels.Labels { + r.init() + return r.partitionLabelSets } func (r *remoteEngine) NewRangeQuery(_ context.Context, _ promql.QueryOpts, plan api.RemoteQuery, start, end time.Time, interval time.Duration) (promql.Query, error) { @@ -345,7 +349,7 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result { ReplicaLabels: r.opts.ReplicaLabels, MaxResolutionSeconds: maxResolution, EnableDedup: true, - ResponseBatchSize: defaultResponseBatchSize, + ResponseBatchSize: store.DefaultResponseBatchSize, } qry, err := r.client.Query(qctx, request) @@ -424,7 +428,7 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result { ReplicaLabels: r.opts.ReplicaLabels, MaxResolutionSeconds: maxResolution, EnableDedup: true, - ResponseBatchSize: defaultResponseBatchSize, + ResponseBatchSize: store.DefaultResponseBatchSize, } qry, err := r.client.QueryRange(qctx, request) if err != nil { diff --git a/vendor/github.com/thanos-io/thanos/pkg/store/batchable.go b/vendor/github.com/thanos-io/thanos/pkg/store/batchable.go index 9a399a51f8..555c4e481b 100644 --- a/vendor/github.com/thanos-io/thanos/pkg/store/batchable.go +++ b/vendor/github.com/thanos-io/thanos/pkg/store/batchable.go @@ -66,3 +66,7 @@ func (b *batchableServer) Send(response *storepb.SeriesResponse) error { return nil } + +// DefaultResponseBatchSize is the default number of timeseries to batch per gRPC response message. +// This value provides a good balance between reducing per-message overhead and keeping message sizes reasonable. +const DefaultResponseBatchSize = 64 diff --git a/vendor/modules.txt b/vendor/modules.txt index a2c1af78a5..b4ecb3abfa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1238,7 +1238,7 @@ github.com/thanos-io/promql-engine/ringbuffer github.com/thanos-io/promql-engine/storage github.com/thanos-io/promql-engine/storage/prometheus github.com/thanos-io/promql-engine/warnings -# github.com/thanos-io/thanos v0.40.1-0.20260204190131-802f43f3bc64 +# github.com/thanos-io/thanos v0.41.0 ## explicit; go 1.25.0 github.com/thanos-io/thanos/pkg/api/query/querypb github.com/thanos-io/thanos/pkg/block @@ -1751,7 +1751,7 @@ google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/api/label google.golang.org/genproto/googleapis/api/metric google.golang.org/genproto/googleapis/api/monitoredres -# google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3 ## explicit; go 1.24.0 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails