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 prometheus and cortex #3804

Merged
merged 7 commits into from
Feb 19, 2021
Merged
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
40 changes: 20 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
module github.com/thanos-io/thanos

require (
cloud.google.com/go v0.65.0
cloud.google.com/go v0.74.0
cloud.google.com/go/storage v1.10.0
github.com/Azure/azure-pipeline-go v0.2.2
github.com/Azure/azure-storage-blob-go v0.8.0
github.com/NYTimes/gziphandler v1.1.1
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15
github.com/aliyun/aliyun-oss-go-sdk v2.0.4+incompatible
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/cespare/xxhash v1.1.0
github.com/chromedp/cdproto v0.0.0-20200424080200-0de008e41fa0
github.com/chromedp/chromedp v0.5.3
github.com/cortexproject/cortex v1.6.1-0.20210108144208-6c2dab103f20
github.com/cortexproject/cortex v1.6.1-0.20210215155036-dfededd9f331
github.com/davecgh/go-spew v1.1.1
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb
github.com/fatih/structtag v1.1.0
github.com/felixge/fgprof v0.9.1
github.com/fsnotify/fsnotify v1.4.9
github.com/go-kit/kit v0.10.0
github.com/go-openapi/strfmt v0.19.11
github.com/gogo/protobuf v1.3.1
github.com/go-openapi/strfmt v0.20.0
github.com/gogo/protobuf v1.3.2
github.com/gogo/status v1.0.3
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/snappy v0.0.2
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3
github.com/googleapis/gax-go v2.0.2+incompatible
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
Expand All @@ -32,7 +32,7 @@ require (
github.com/leanovate/gopter v0.2.4
github.com/lightstep/lightstep-tracer-go v0.18.1
github.com/lovoo/gcloud-opentracing v0.3.0
github.com/miekg/dns v1.1.35
github.com/miekg/dns v1.1.38
github.com/minio/minio-go/v7 v7.0.2
github.com/mozillazg/go-cos v0.13.0
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
Expand All @@ -45,29 +45,29 @@ require (
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/alertmanager v0.21.1-0.20201106142418-c39b78780054
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/client_golang v1.9.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.15.0
github.com/prometheus/prometheus v1.8.2-0.20201119181812-c8f810083d3f
github.com/prometheus/prometheus v1.8.2-0.20210215121130-6f488061dfb4
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/uber/jaeger-lib v2.4.0+incompatible
github.com/weaveworks/common v0.0.0-20201119133501-0619918236ec
github.com/weaveworks/common v0.0.0-20210112142934-23c8d7fa6120
go.elastic.co/apm v1.5.0
go.elastic.co/apm/module/apmot v1.5.0
go.uber.org/atomic v1.7.0
go.uber.org/automaxprocs v1.2.0
go.uber.org/goleak v1.1.10
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/text v0.3.4
google.golang.org/api v0.35.0
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d
google.golang.org/grpc v1.33.1
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9
golang.org/x/oauth2 v0.0.0-20210210192628-66670185b0cd
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/text v0.3.5
google.golang.org/api v0.39.0
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d
google.golang.org/grpc v1.34.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/fsnotify.v1 v1.4.7
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

replace (
Expand All @@ -77,7 +77,7 @@ replace (
// Update to v1.1.1 to make sure windows CI pass.
github.com/elastic/go-sysinfo => github.com/elastic/go-sysinfo v1.1.1
// Make sure Prometheus version is pinned as Prometheus semver does not include Go APIs.
github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.8.2-0.20201119142752-3ad25a6dc3d9
github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.8.2-0.20210215121130-6f488061dfb4
github.com/sercand/kuberesolver => github.com/sercand/kuberesolver v2.4.0+incompatible
google.golang.org/grpc => google.golang.org/grpc v1.29.1

Expand Down
246 changes: 189 additions & 57 deletions go.sum

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion pkg/query/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,24 @@ func sortDedupLabels(set []storepb.Series, replicaLabels map[string]struct{}) {
}

// LabelValues returns all potential values for a label name.
func (q *querier) LabelValues(name string) ([]string, storage.Warnings, error) {
func (q *querier) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error) {
span, ctx := tracing.StartSpan(q.ctx, "querier_label_values")
defer span.Finish()

// TODO(bwplotka): Pass it using the SeriesRequest instead of relying on context.
ctx = context.WithValue(ctx, store.StoreMatcherKey, q.storeDebugMatchers)

pbMatchers, err := storepb.PromMatchersToMatchers(matchers...)
if err != nil {
return nil, nil, errors.Wrap(err, "convert matchers")
}

resp, err := q.proxy.LabelValues(ctx, &storepb.LabelValuesRequest{
Label: name,
PartialResponseDisabled: !q.partialResponse,
Start: q.mint,
End: q.maxt,
Matchers: pbMatchers,
})
if err != nil {
return nil, nil, errors.Wrap(err, "proxy LabelValues()")
Expand Down
30 changes: 20 additions & 10 deletions pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/encoding"
"go.uber.org/atomic"

Expand Down Expand Up @@ -1025,7 +1024,10 @@ func BenchmarkBucketIndexReader_ExpandedPostings(b *testing.B) {
}

func uploadTestBlock(t testing.TB, tmpDir string, bkt objstore.Bucket, series int) ulid.ULID {
h, err := tsdb.NewHead(nil, nil, nil, 1000, tmpDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
headOpts := tsdb.DefaultHeadOptions()
headOpts.ChunkDirRoot = tmpDir
headOpts.ChunkRange = 1000
h, err := tsdb.NewHead(nil, nil, nil, headOpts)
testutil.Ok(t, err)
defer func() {
testutil.Ok(t, h.Close())
Expand Down Expand Up @@ -1396,13 +1398,16 @@ func TestBucketSeries_OneBlock_InMemIndexCacheSegfault(t *testing.T) {
var b1 *bucketBlock

const numSeries = 100
headOpts := tsdb.DefaultHeadOptions()
headOpts.ChunkDirRoot = tmpDir
headOpts.ChunkRange = 1

// Create 4 blocks. Each will have numSeriesPerBlock number of series that have 1 sample only.
// Timestamp will be counted for each new series, so each series will have unique timestamp.
// This allows to pick time range that will correspond to number of series picked 1:1.
{
// Block 1.
h, err := tsdb.NewHead(nil, nil, nil, 1, tmpDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, headOpts)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand Down Expand Up @@ -1441,7 +1446,7 @@ func TestBucketSeries_OneBlock_InMemIndexCacheSegfault(t *testing.T) {
var b2 *bucketBlock
{
// Block 2, do not load this block yet.
h, err := tsdb.NewHead(nil, nil, nil, 1, tmpDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, headOpts)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand Down Expand Up @@ -1686,9 +1691,11 @@ func TestSeries_BlockWithMultipleChunks(t *testing.T) {

// Create a block with 1 series but an high number of samples,
// so that they will span across multiple chunks.
blkDir := filepath.Join(tmpDir, "block")
headOpts := tsdb.DefaultHeadOptions()
headOpts.ChunkDirRoot = filepath.Join(tmpDir, "block")
headOpts.ChunkRange = 10000000000

h, err := tsdb.NewHead(nil, nil, nil, 10000000000, blkDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, headOpts)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand All @@ -1702,15 +1709,15 @@ func TestSeries_BlockWithMultipleChunks(t *testing.T) {
testutil.Ok(t, app.Commit())
}

blk := createBlockFromHead(t, blkDir, h)
blk := createBlockFromHead(t, headOpts.ChunkDirRoot, h)

thanosMeta := metadata.Thanos{
Labels: labels.Labels{{Name: "ext1", Value: "1"}}.Map(),
Downsample: metadata.ThanosDownsample{Resolution: 0},
Source: metadata.TestSource,
}

_, err = metadata.InjectThanos(log.NewNopLogger(), filepath.Join(blkDir, blk.String()), thanosMeta, nil)
_, err = metadata.InjectThanos(log.NewNopLogger(), filepath.Join(headOpts.ChunkDirRoot, blk.String()), thanosMeta, nil)
testutil.Ok(t, err)

// Create a bucket and upload the block there.
Expand All @@ -1721,7 +1728,7 @@ func TestSeries_BlockWithMultipleChunks(t *testing.T) {

instrBkt := objstore.WithNoopInstr(bkt)
logger := log.NewNopLogger()
testutil.Ok(t, block.Upload(context.Background(), logger, bkt, filepath.Join(blkDir, blk.String())))
testutil.Ok(t, block.Upload(context.Background(), logger, bkt, filepath.Join(headOpts.ChunkDirRoot, blk.String())))

// Instance a real bucket store we'll use to query the series.
fetcher, err := block.NewMetaFetcher(logger, 10, instrBkt, tmpDir, nil, nil, nil)
Expand Down Expand Up @@ -1959,7 +1966,10 @@ func createBlockWithLargeChunk(t testutil.TB, dir string, lbls labels.Labels, ra
}

func createBlockWithOneSeriesWithStep(t testutil.TB, dir string, lbls labels.Labels, blockIndex int, totalSamples int, random *rand.Rand, step int64) ulid.ULID {
h, err := tsdb.NewHead(nil, nil, nil, int64(totalSamples)*step, dir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
headOpts := tsdb.DefaultHeadOptions()
headOpts.ChunkDirRoot = dir
headOpts.ChunkRange = int64(totalSamples) * step
h, err := tsdb.NewHead(nil, nil, nil, headOpts)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand Down
6 changes: 4 additions & 2 deletions pkg/store/postings_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/index"
storetestutil "github.com/thanos-io/thanos/pkg/store/storepb/testutil"
"github.com/thanos-io/thanos/pkg/testutil"
Expand All @@ -24,7 +23,10 @@ func TestDiffVarintCodec(t *testing.T) {
chunksDir, err := ioutil.TempDir("", "diff_varint_codec")
testutil.Ok(t, err)

h, err := tsdb.NewHead(nil, nil, nil, 1000, chunksDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
headOpts := tsdb.DefaultHeadOptions()
headOpts.ChunkDirRoot = chunksDir
headOpts.ChunkRange = 1000
h, err := tsdb.NewHead(nil, nil, nil, headOpts)
testutil.Ok(t, err)
defer func() {
testutil.Ok(t, h.Close())
Expand Down
Loading