From 8dd9ef44cdd1c69072c6fcc04fae650957355d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Date: Fri, 27 Jan 2023 11:03:22 +0200 Subject: [PATCH] query: rework to use gate pkg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use our own gate package which allows disabling max concurrent Select() calls. Signed-off-by: Giedrius Statkevičius --- pkg/query/querier.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkg/query/querier.go b/pkg/query/querier.go index 1e5806b8c0..cb0f417e61 100644 --- a/pkg/query/querier.go +++ b/pkg/query/querier.go @@ -16,11 +16,9 @@ import ( "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/storage" - promgate "github.com/prometheus/prometheus/util/gate" "github.com/thanos-io/thanos/pkg/dedup" "github.com/thanos-io/thanos/pkg/extprom" @@ -71,10 +69,6 @@ func NewQueryableCreator( maxConcurrentSelects int, selectTimeout time.Duration, ) QueryableCreator { - duration := promauto.With( - extprom.WrapRegistererWithPrefix("concurrent_selects_", reg), - ).NewHistogram(gate.DurationHistogramOpts) - return func( deduplicate bool, replicaLabels []string, @@ -96,7 +90,7 @@ func NewQueryableCreator( partialResponse: partialResponse, skipChunks: skipChunks, gateProviderFn: func() gate.Gate { - return gate.InstrumentGateDuration(duration, promgate.New(maxConcurrentSelects)) + return gate.New(extprom.WrapRegistererWithPrefix("concurrent_selects_", reg), maxConcurrentSelects) }, maxConcurrentSelects: maxConcurrentSelects, selectTimeout: selectTimeout,