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 master. #3271

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/Masterminds/squirrel v0.0.0-20161115235646-20f192218cf5
github.com/NYTimes/gziphandler v1.1.1
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/alicebob/miniredis v2.5.0+incompatible
github.com/armon/go-metrics v0.3.3
github.com/aws/aws-sdk-go v1.34.9
Expand Down Expand Up @@ -53,10 +52,9 @@ require (
github.com/sony/gobreaker v0.4.1
github.com/spf13/afero v1.2.2
github.com/stretchr/testify v1.6.1
github.com/thanos-io/thanos v0.13.1-0.20200923175059-57035bf8f843
github.com/thanos-io/thanos v0.13.1-0.20201002105236-bb1662a1d13c
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect
go.etcd.io/bbolt v1.3.5-0.20200615073812-232d8fc87f50
go.etcd.io/etcd v0.5.0-alpha.5.0.20200520232829-54ba9589114f
go.uber.org/atomic v1.6.0
Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbp
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cortexproject/cortex v0.6.1-0.20200228110116-92ab6cbe0995/go.mod h1:3Xa3DjJxtpXqxcMGdk850lcIRb81M0fyY1MQ6udY134=
github.com/cortexproject/cortex v1.2.1-0.20200805064754-d8edc95e2c91/go.mod h1:PVPxNLrxKH+yc8asaJOxuz7TiRmMizFfnSMOnRzM6oM=
github.com/cortexproject/cortex v1.3.1-0.20200901115931-255ff3306960/go.mod h1:ub8BpRZrRa02BOM8NJTnI2YklxW/mGhEkJDrhsDfcfg=
github.com/cortexproject/cortex v1.3.1-0.20200923145333-8587ea61fe17/go.mod h1:dJ9gpW7dzQ7z09cKtNN9PfebumgyO4dtNdFQ6eQEed0=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8=
Expand Down Expand Up @@ -1114,8 +1114,8 @@ github.com/thanos-io/thanos v0.8.1-0.20200109203923-552ffa4c1a0d/go.mod h1:usT/T
github.com/thanos-io/thanos v0.13.1-0.20200731083140-69b87607decf/go.mod h1:G8caR6G7pSDreRDvFm9wFuyjEBztmr8Ag3kBYpa/fEc=
github.com/thanos-io/thanos v0.13.1-0.20200807203500-9b578afb4763 h1:c84P3YUu8bxLWE2csCSK4XJNi5FxcC+HL4WDNDEbTwA=
github.com/thanos-io/thanos v0.13.1-0.20200807203500-9b578afb4763/go.mod h1:KyW0a93tsh7v4hXAwo2CVAIRYuZT1Kkf4e04gisQjAg=
github.com/thanos-io/thanos v0.13.1-0.20200923175059-57035bf8f843 h1:juk6GFI+MPKmTKaOzcYnBOUYSIYk9cEFwfVPAHkqh4I=
github.com/thanos-io/thanos v0.13.1-0.20200923175059-57035bf8f843/go.mod h1:U7HVxfAHYptOk9xCuxr8WoILGL1wWdXVqZD3t6JifNA=
github.com/thanos-io/thanos v0.13.1-0.20201002105236-bb1662a1d13c h1:zrh4jhgC8AUtoQSdHoiavvpwmtIWuev4q9PypxzLN+g=
github.com/thanos-io/thanos v0.13.1-0.20201002105236-bb1662a1d13c/go.mod h1:XcBmJEI7zAdrF9h7mSH2+C2pMFefq60ayosWsIE8CPY=
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=
Expand All @@ -1140,7 +1140,6 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
github.com/weaveworks/common v0.0.0-20200206153930-760e36ae819a/go.mod h1:6enWAqfQBFrE8X/XdJwZr8IKgh1chStuFR0mjU/UOUw=
github.com/weaveworks/common v0.0.0-20200625145055-4b1847531bc9/go.mod h1:c98fKi5B9u8OsKGiWHLRKus6ToQ1Tubeow44ECO1uxY=
github.com/weaveworks/common v0.0.0-20200820123129-280614068c5e/go.mod h1:hz10LOsAdzC3K/iXaKoFxOKTDRgxJl+BTGX1GY+TzO4=
github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099 h1:MS5M2antM8wzMUqVxIfAi+yb6yjXvDINRFvLnmNXeIw=
github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099/go.mod h1:hz10LOsAdzC3K/iXaKoFxOKTDRgxJl+BTGX1GY+TzO4=
github.com/weaveworks/promrus v1.2.0 h1:jOLf6pe6/vss4qGHjXmGz4oDJQA+AOCqEL3FvvZGz7M=
Expand Down
7 changes: 4 additions & 3 deletions pkg/querier/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"

"github.com/cortexproject/cortex/pkg/querier/series"
Expand Down Expand Up @@ -63,7 +64,7 @@ func (bqss *blockQuerierSeriesSet) Next() bool {
// Merge chunks for current series. Chunks may come in multiple responses, but as soon
// as the response has chunks for a new series, we can stop searching. Series are sorted.
// See documentation for StoreClient.Series call for details.
for bqss.next < len(bqss.series) && storepb.CompareLabels(currLabels, bqss.series[bqss.next].Labels) == 0 {
for bqss.next < len(bqss.series) && labels.Compare(labelpb.LabelsToPromLabels(currLabels), labelpb.LabelsToPromLabels(bqss.series[bqss.next].Labels)) == 0 {
currChunks = append(currChunks, bqss.series[bqss.next].Chunks...)
bqss.next++
}
Expand All @@ -85,12 +86,12 @@ func (bqss *blockQuerierSeriesSet) Warnings() storage.Warnings {
}

// newBlockQuerierSeries makes a new blockQuerierSeries. Input labels must be already sorted by name.
func newBlockQuerierSeries(lbls []storepb.Label, chunks []storepb.AggrChunk) *blockQuerierSeries {
func newBlockQuerierSeries(lbls []labelpb.Label, chunks []storepb.AggrChunk) *blockQuerierSeries {
sort.Slice(chunks, func(i, j int) bool {
return chunks[i].MinTime < chunks[j].MinTime
})

return &blockQuerierSeries{labels: storepb.LabelsToPromLabelsUnsafe(lbls), chunks: chunks}
return &blockQuerierSeries{labels: labelpb.LabelsToPromLabels(lbls), chunks: chunks}
}

type blockQuerierSeries struct {
Expand Down
11 changes: 6 additions & 5 deletions pkg/querier/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"

"github.com/cortexproject/cortex/pkg/util"
Expand All @@ -39,7 +40,7 @@ func TestBlockQuerierSeries(t *testing.T) {
},
"should return series on success": {
series: &storepb.Series{
Labels: []storepb.Label{
Labels: []labelpb.Label{
{Name: "foo", Value: "bar"},
},
Chunks: []storepb.AggrChunk{
Expand All @@ -56,7 +57,7 @@ func TestBlockQuerierSeries(t *testing.T) {
},
"should return error on failure while reading encoded chunk data": {
series: &storepb.Series{
Labels: []storepb.Label{{Name: "foo", Value: "bar"}},
Labels: []labelpb.Label{{Name: "foo", Value: "bar"}},
Chunks: []storepb.AggrChunk{
{MinTime: minTimestamp.Unix() * 1000, MaxTime: maxTimestamp.Unix() * 1000, Raw: &storepb.Chunk{Type: storepb.Chunk_XOR, Data: []byte{0, 1}}},
},
Expand Down Expand Up @@ -262,11 +263,11 @@ func createAggrChunk(minTime, maxTime int64, samples ...promql.Point) storepb.Ag
}
}

func mkLabels(s ...string) []storepb.Label {
result := []storepb.Label{}
func mkLabels(s ...string) []labelpb.Label {
var result []labelpb.Label

for i := 0; i+1 < len(s); i = i + 2 {
result = append(result, storepb.Label{
result = append(result, labelpb.Label{
Name: s[i],
Value: s[i+1],
})
Expand Down
11 changes: 6 additions & 5 deletions pkg/querier/blocks_store_queryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/store/hintspb"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"
"github.com/weaveworks/common/user"
"google.golang.org/grpc"
Expand Down Expand Up @@ -624,8 +625,8 @@ func TestBlocksStoreQuerier_SelectSortedShouldHonorQueryStoreAfter(t *testing.T)
func TestBlocksStoreQuerier_PromQLExecution(t *testing.T) {
block1 := ulid.MustNew(1, nil)
block2 := ulid.MustNew(2, nil)
series1 := []storepb.Label{{Name: "__name__", Value: "metric_1"}}
series2 := []storepb.Label{{Name: "__name__", Value: "metric_2"}}
series1 := []labelpb.Label{{Name: "__name__", Value: "metric_1"}}
series2 := []labelpb.Label{{Name: "__name__", Value: "metric_2"}}

series1Samples := []promql.Point{
{T: 1589759955000, V: 1},
Expand Down Expand Up @@ -737,8 +738,8 @@ func TestBlocksStoreQuerier_PromQLExecution(t *testing.T) {
require.NoError(t, err)
require.Len(t, matrix, 2)

assert.Equal(t, storepb.LabelsToPromLabels(series1), matrix[0].Metric)
assert.Equal(t, storepb.LabelsToPromLabels(series2), matrix[1].Metric)
assert.Equal(t, labelpb.LabelsToPromLabels(series1), matrix[0].Metric)
assert.Equal(t, labelpb.LabelsToPromLabels(series2), matrix[1].Metric)
assert.Equal(t, series1Samples, matrix[0].Points)
assert.Equal(t, series2Samples, matrix[1].Points)
}
Expand Down Expand Up @@ -840,7 +841,7 @@ func mockSeriesResponse(lbls labels.Labels, timeMillis int64, value float64) *st
return &storepb.SeriesResponse{
Result: &storepb.SeriesResponse_Series{
Series: &storepb.Series{
Labels: storepb.PromLabelsToLabels(lbls),
Labels: labelpb.LabelsFromPromLabels(lbls),
Chunks: []storepb.AggrChunk{
{MinTime: timeMillis, MaxTime: timeMillis, Raw: &storepb.Chunk{Type: storepb.Chunk_XOR, Data: chunkData}},
},
Expand Down
5 changes: 3 additions & 2 deletions pkg/storegateway/bucket_stores_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/thanos-io/thanos/pkg/store"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"
"github.com/weaveworks/common/logging"
"go.uber.org/atomic"
Expand Down Expand Up @@ -68,7 +69,7 @@ func TestBucketStores_InitialSync(t *testing.T) {
require.NoError(t, err)
assert.Empty(t, warnings)
require.Len(t, seriesSet, 1)
assert.Equal(t, []storepb.Label{{Name: labels.MetricName, Value: metricName}}, seriesSet[0].Labels)
assert.Equal(t, []labelpb.Label{{Name: labels.MetricName, Value: metricName}}, seriesSet[0].Labels)
}

// Query series of another user.
Expand Down Expand Up @@ -146,7 +147,7 @@ func TestBucketStores_SyncBlocks(t *testing.T) {
require.NoError(t, err)
assert.Empty(t, warnings)
assert.Len(t, seriesSet, 1)
assert.Equal(t, []storepb.Label{{Name: labels.MetricName, Value: metricName}}, seriesSet[0].Labels)
assert.Equal(t, []labelpb.Label{{Name: labels.MetricName, Value: metricName}}, seriesSet[0].Labels)

assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
# HELP cortex_bucket_store_blocks_loaded Number of currently loaded blocks.
Expand Down
3 changes: 2 additions & 1 deletion pkg/storegateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/extprom"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"

"github.com/cortexproject/cortex/pkg/ring"
Expand Down Expand Up @@ -695,7 +696,7 @@ func TestStoreGateway_SeriesQueryingShouldRemoveExternalLabels(t *testing.T) {
actual := srv.SeriesSet[seriesID]

// Ensure Cortex external labels have been removed.
assert.Equal(t, []storepb.Label{{Name: "series_id", Value: strconv.Itoa(seriesID)}}, actual.Labels)
assert.Equal(t, []labelpb.Label{{Name: "series_id", Value: strconv.Itoa(seriesID)}}, actual.Labels)

// Ensure samples have been correctly queried. The Thanos store also deduplicate samples
// in most cases, but it's not strictly required guaranteeing deduplication at this stage.
Expand Down
6 changes: 4 additions & 2 deletions tools/blocksconvert/builder/tsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/index"
"github.com/thanos-io/thanos/pkg/block"
"github.com/thanos-io/thanos/pkg/block/metadata"

"github.com/cortexproject/cortex/pkg/chunk"
Expand Down Expand Up @@ -204,8 +205,9 @@ func (d *tsdbBuilder) finishBlock(source string, labels map[string]string) (ulid
},

Thanos: metadata.Thanos{
Labels: labels,
Source: metadata.SourceType(source),
Labels: labels,
Source: metadata.SourceType(source),
SegmentFiles: block.GetSegmentFiles(d.tmpBlockDir),
},
}

Expand Down
18 changes: 18 additions & 0 deletions vendor/github.com/thanos-io/thanos/pkg/block/block.go

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

1 change: 1 addition & 0 deletions vendor/github.com/thanos-io/thanos/pkg/block/index.go

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

3 changes: 3 additions & 0 deletions vendor/github.com/thanos-io/thanos/pkg/block/metadata/meta.go

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

7 changes: 4 additions & 3 deletions vendor/github.com/thanos-io/thanos/pkg/compact/compact.go

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

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

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

56 changes: 0 additions & 56 deletions vendor/github.com/thanos-io/thanos/pkg/promclient/matchers.go

This file was deleted.

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

Loading