Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Thanos to latest and use label matchers in LabelValues call. #4133

Merged
merged 8 commits into from
Apr 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@
* [ENHANCEMENT] Store-gateway: retry synching blocks if a per-tenant sync fails. #3975 #4088
* [ENHANCEMENT] Add metric `cortex_tcp_connections` exposing the current number of accepted TCP connections. #4099
* [ENHANCEMENT] Querier: Allow federated queries to run concurrently. #4065
* [ENHANCEMENT] Label Values API call now supports `match[]` parameter when querying blocks on storage (assuming `-querier.query-store-for-labels-enabled` is enabled). #4133
* [BUGFIX] Ruler-API: fix bug where `/api/v1/rules/<namespace>/<group_name>` endpoint return `400` instead of `404`. #4013
* [BUGFIX] Distributor: reverted changes done to rate limiting in #3825. #3948
* [BUGFIX] Ingester: Fix race condition when opening and closing tsdb concurrently. #3959
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ require (
github.com/sony/gobreaker v0.4.1
github.com/spf13/afero v1.2.2
github.com/stretchr/testify v1.7.0
github.com/thanos-io/thanos v0.19.1-0.20210423085824-268cc30e2dd8
github.com/thanos-io/thanos v0.19.1-0.20210427154226-d5bd651319d2
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/weaveworks/common v0.0.0-20210419092856-009d1eebd624
go.etcd.io/bbolt v1.3.5
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1351,8 +1351,8 @@ github.com/thanos-io/thanos v0.13.1-0.20210204123931-82545cdd16fe/go.mod h1:ZLDG
github.com/thanos-io/thanos v0.13.1-0.20210224074000-659446cab117/go.mod h1:kdqFpzdkveIKpNNECVJd75RPvgsAifQgJymwCdfev1w=
github.com/thanos-io/thanos v0.13.1-0.20210226164558-03dace0a1aa1/go.mod h1:gMCy4oCteKTT7VuXVvXLTPGzzjovX1VPE5p+HgL1hyU=
github.com/thanos-io/thanos v0.13.1-0.20210401085038-d7dff0c84d17/go.mod h1:zU8KqE+6A+HksK4wiep8e/3UvCZLm+Wrw9AqZGaAm9k=
github.com/thanos-io/thanos v0.19.1-0.20210423085824-268cc30e2dd8 h1:M1t8SnLQgsF8x6HWS4TMUB7SmrmJBffnXZKu0CmYZcg=
github.com/thanos-io/thanos v0.19.1-0.20210423085824-268cc30e2dd8/go.mod h1:zvSf4uKtey4KjSVcalV/5oUuGthaTzI8kVDrO42I8II=
github.com/thanos-io/thanos v0.19.1-0.20210427154226-d5bd651319d2 h1:L6U4VYeIConcO4GaFOAaZW4Gwr+lIVfBprW9a0+py/k=
github.com/thanos-io/thanos v0.19.1-0.20210427154226-d5bd651319d2/go.mod h1:zvSf4uKtey4KjSVcalV/5oUuGthaTzI8kVDrO42I8II=
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab h1:7ZR3hmisBWw77ZpO1/o86g+JV3VKlk3d48jopJxzTjU=
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab/go.mod h1:eheTFp954zcWZXCU8d0AT76ftsQOTo4DTqkN/h3k1MY=
github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
4 changes: 2 additions & 2 deletions integration/e2ecortex/client.go
Original file line number Diff line number Diff line change
@@ -185,8 +185,8 @@ func (c *Client) Series(matches []string, start, end time.Time) ([]model.LabelSe
}

// LabelValues gets label values
func (c *Client) LabelValues(label string, start, end time.Time) (model.LabelValues, error) {
result, _, err := c.querierClient.LabelValues(context.Background(), label, nil, start, end)
func (c *Client) LabelValues(label string, start, end time.Time, matches []string) (model.LabelValues, error) {
result, _, err := c.querierClient.LabelValues(context.Background(), label, matches, start, end)
return result, err
}

4 changes: 2 additions & 2 deletions integration/getting_started_single_process_config_test.go
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ func TestGettingStartedSingleProcessConfigWithChunksStorage(t *testing.T) {
require.Equal(t, model.ValVector, result.Type())
assert.Equal(t, expectedVector, result.(model.Vector))

labelValues, err := c.LabelValues("foo", time.Time{}, time.Time{})
labelValues, err := c.LabelValues("foo", time.Time{}, time.Time{}, nil)
require.NoError(t, err)
require.Equal(t, model.LabelValues{"bar"}, labelValues)

@@ -100,7 +100,7 @@ func TestGettingStartedSingleProcessConfigWithBlocksStorage(t *testing.T) {
require.Equal(t, model.ValVector, result.Type())
assert.Equal(t, expectedVector, result.(model.Vector))

labelValues, err := c.LabelValues("foo", time.Time{}, time.Time{})
labelValues, err := c.LabelValues("foo", time.Time{}, time.Time{}, nil)
require.NoError(t, err)
require.Equal(t, model.LabelValues{"bar"}, labelValues)

53 changes: 50 additions & 3 deletions integration/querier_test.go
Original file line number Diff line number Diff line change
@@ -483,8 +483,9 @@ func testMetadataQueriesWithBlocksStorage(
resp []prompb.Label
}
type labelValuesTest struct {
label string
resp []string
label string
matches []string
resp []string
}

testCases := map[string]struct {
@@ -520,6 +521,16 @@ func testMetadataQueriesWithBlocksStorage(
label: labels.MetricName,
resp: []string{firstSeriesInIngesterHeadName},
},
{
label: labels.MetricName,
resp: []string{firstSeriesInIngesterHeadName},
matches: []string{firstSeriesInIngesterHeadName},
},
{
label: labels.MetricName,
resp: []string{},
matches: []string{lastSeriesInStorageName},
},
},
labelNames: []string{labels.MetricName, firstSeriesInIngesterHeadName},
},
@@ -546,6 +557,17 @@ func testMetadataQueriesWithBlocksStorage(
label: labels.MetricName,
resp: []string{lastSeriesInIngesterBlocksName},
},

{
label: labels.MetricName,
resp: []string{lastSeriesInIngesterBlocksName},
matches: []string{lastSeriesInIngesterBlocksName},
},
{
label: labels.MetricName,
resp: []string{},
matches: []string{firstSeriesInIngesterHeadName},
},
},
labelNames: []string{labels.MetricName, lastSeriesInIngesterBlocksName},
},
@@ -574,6 +596,21 @@ func testMetadataQueriesWithBlocksStorage(
label: labels.MetricName,
resp: []string{lastSeriesInStorageName, lastSeriesInIngesterBlocksName, firstSeriesInIngesterHeadName},
},
{
label: labels.MetricName,
resp: []string{lastSeriesInStorageName},
matches: []string{lastSeriesInStorageName},
},
{
label: labels.MetricName,
resp: []string{lastSeriesInIngesterBlocksName},
matches: []string{lastSeriesInIngesterBlocksName},
},
{
label: labels.MetricName,
resp: []string{lastSeriesInStorageName, lastSeriesInIngesterBlocksName},
matches: []string{lastSeriesInStorageName, lastSeriesInIngesterBlocksName},
},
},
labelNames: []string{labels.MetricName, lastSeriesInStorageName, lastSeriesInIngesterBlocksName, firstSeriesInIngesterHeadName},
},
@@ -601,6 +638,16 @@ func testMetadataQueriesWithBlocksStorage(
label: labels.MetricName,
resp: []string{lastSeriesInStorageName, firstSeriesInIngesterHeadName},
},
{
label: labels.MetricName,
resp: []string{lastSeriesInStorageName},
matches: []string{lastSeriesInStorageName},
},
{
label: labels.MetricName,
resp: []string{firstSeriesInIngesterHeadName},
matches: []string{firstSeriesInIngesterHeadName},
},
},
labelNames: []string{labels.MetricName, lastSeriesInStorageName, firstSeriesInIngesterHeadName},
},
@@ -620,7 +667,7 @@ func testMetadataQueriesWithBlocksStorage(
}

for _, lvt := range tc.labelValuesTests {
labelsRes, err := c.LabelValues(lvt.label, tc.from, tc.to)
labelsRes, err := c.LabelValues(lvt.label, tc.from, tc.to, lvt.matches)
require.NoError(t, err)
exp := model.LabelValues{}
for _, val := range lvt.resp {
8 changes: 4 additions & 4 deletions pkg/querier/blocks_store_queryable.go
Original file line number Diff line number Diff line change
@@ -875,11 +875,11 @@ func createLabelNamesRequest(minT, maxT int64, blockIDs []ulid.ULID) (*storepb.L
}

func createLabelValuesRequest(minT, maxT int64, label string, blockIDs []ulid.ULID, matchers ...*labels.Matcher) (*storepb.LabelValuesRequest, error) {
// TODO(replay): add matchers to LabelValuesRequest once it has that property
req := &storepb.LabelValuesRequest{
Start: minT,
End: maxT,
Label: label,
Start: minT,
End: maxT,
Label: label,
Matchers: convertMatchersToLabelMatcher(matchers),
}

// Selectively query only specific blocks.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

199 changes: 144 additions & 55 deletions vendor/github.com/thanos-io/thanos/pkg/store/bucket.go
192 changes: 124 additions & 68 deletions vendor/github.com/thanos-io/thanos/pkg/store/storepb/rpc.pb.go
2 changes: 1 addition & 1 deletion vendor/modules.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.