Skip to content

Commit

Permalink
First code review pass
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski committed Jul 13, 2022
1 parent a5a2d87 commit 6743584
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pkg/querysharding/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func newShardableByLabels(labels []string, by bool) QueryAnalysis {
}
}

func (q QueryAnalysis) scopeToLabels(labels []string, by bool) QueryAnalysis {
func (q *QueryAnalysis) scopeToLabels(labels []string, by bool) QueryAnalysis {
labels = without(labels, excludedLabels)

if q.shardingLabels == nil {
Expand All @@ -52,19 +52,19 @@ func (q QueryAnalysis) scopeToLabels(labels []string, by bool) QueryAnalysis {
}
}

func (q QueryAnalysis) IsShardable() bool {
func (q *QueryAnalysis) IsShardable() bool {
return len(q.shardingLabels) > 0
}

func (q QueryAnalysis) ShardingLabels() []string {
func (q *QueryAnalysis) ShardingLabels() []string {
if len(q.shardingLabels) == 0 {
return nil
}

return q.shardingLabels
}

func (q QueryAnalysis) ShardBy() bool {
func (q *QueryAnalysis) ShardBy() bool {
return q.shardBy
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/querysharding/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewQueryAnalyzer() *QueryAnalyzer {

// Analyze uses the following algorithm:
// * if a query has subqueries, such as label_join or label_replace,
// then treat the query as non shardable.
// or has functions which cannot be sharded, then treat the query as non shardable.
// * if the query's root expression has grouping labels,
// then treat the query as shardable by those labels.
// * if the query's root expression has no grouping labels,
Expand Down
1 change: 0 additions & 1 deletion pkg/store/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ func (p *PrometheusStore) Series(r *storepb.SeriesRequest, s storepb.Store_Serie
}

q := &prompb.Query{StartTimestampMs: r.MinTime, EndTimestampMs: r.MaxTime}
level.Info(p.logger).Log("min_time", r.MinTime, "max_time", r.MaxTime)
for _, m := range matchers {
pm := &prompb.LabelMatcher{Name: m.Name, Value: m.Value}

Expand Down
5 changes: 2 additions & 3 deletions test/e2e/query_frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ import (
"testing"
"time"

"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/testutil/e2eutil"

"github.com/efficientgo/e2e"
"github.com/efficientgo/e2e/matchers"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/timestamp"

"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/cacheutil"
"github.com/thanos-io/thanos/pkg/promclient"
"github.com/thanos-io/thanos/pkg/queryfrontend"
"github.com/thanos-io/thanos/pkg/testutil"
"github.com/thanos-io/thanos/pkg/testutil/e2eutil"
"github.com/thanos-io/thanos/test/e2e/e2ethanos"
)

Expand Down

0 comments on commit 6743584

Please sign in to comment.