Skip to content

Commit

Permalink
Use new gate.Gate implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
kakkoyun committed Jun 16, 2020
1 parent 48485f2 commit 13f4ed1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/query/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/pkg/gate"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/storage"

"github.com/thanos-io/thanos/pkg/gate"
"github.com/thanos-io/thanos/pkg/store/storepb"
"github.com/thanos-io/thanos/pkg/tracing"
)
Expand All @@ -41,6 +41,7 @@ func NewQueryableCreator(logger log.Logger, reg prometheus.Registerer, proxy sto
maxResolutionMillis: maxResolutionMillis,
partialResponse: partialResponse,
skipChunks: skipChunks,
gateKeeper: gate.NewKeeper(reg),
maxConcurrentSelects: maxConcurrentSelects,
selectTimeout: selectTimeout,
}
Expand All @@ -56,13 +57,14 @@ type queryable struct {
maxResolutionMillis int64
partialResponse bool
skipChunks bool
gateKeeper *gate.Keeper
maxConcurrentSelects int
selectTimeout time.Duration
}

// Querier returns a new storage querier against the underlying proxy store API.
func (q *queryable) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error) {
return newQuerier(ctx, q.logger, q.reg, mint, maxt, q.replicaLabels, q.proxy, q.deduplicate, q.maxResolutionMillis, q.partialResponse, q.skipChunks, gate.New(q.maxConcurrentSelects), q.selectTimeout), nil
return newQuerier(ctx, q.logger, q.reg, mint, maxt, q.replicaLabels, q.proxy, q.deduplicate, q.maxResolutionMillis, q.partialResponse, q.skipChunks, q.gateKeeper.NewGate(q.maxConcurrentSelects), q.selectTimeout), nil
}

type querier struct {
Expand All @@ -77,7 +79,7 @@ type querier struct {
maxResolutionMillis int64
partialResponse bool
skipChunks bool
selectGate *gate.Gate
selectGate gate.Gate
selectTimeout time.Duration
}

Expand All @@ -93,7 +95,7 @@ func newQuerier(
deduplicate bool,
maxResolutionMillis int64,
partialResponse, skipChunks bool,
selectGate *gate.Gate,
selectGate gate.Gate,
selectTimeout time.Duration,
) *querier {
if logger == nil {
Expand Down

0 comments on commit 13f4ed1

Please sign in to comment.