Skip to content

Commit

Permalink
Upgraded Prometheus (#3473)
Browse files Browse the repository at this point in the history
* Upgraded Prometheus

Signed-off-by: Marco Pracucci <[email protected]>

* Fixed test

Signed-off-by: Marco Pracucci <[email protected]>
  • Loading branch information
pracucci authored Nov 19, 2020
1 parent 381dece commit 8ba87ae
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 52 deletions.
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ require (
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.5
github.com/go-openapi/strfmt v0.19.11
github.com/gogo/protobuf v1.3.1
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/googleapis/gax-go v2.0.2+incompatible
github.com/gophercloud/gophercloud v0.13.0
github.com/gophercloud/gophercloud v0.14.0
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/hashicorp/golang-lru v0.5.4
github.com/jpillora/backoff v1.0.0
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.31
github.com/miekg/dns v1.1.35
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,10 +45,10 @@ require (
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/alertmanager v0.21.1-0.20200911160112-1fdff6b3f939
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.14.0
github.com/prometheus/prometheus v1.8.2-0.20201029103703-63be30dceed9
github.com/prometheus/common v0.15.0
github.com/prometheus/prometheus v1.8.2-0.20201119142752-3ad25a6dc3d9
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-20200914083218-61ffdd448099
Expand All @@ -58,12 +58,12 @@ require (
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-20200902213428-5d25da1a8d43
golang.org/x/sync v0.0.0-20200930132711-30421366ff76
golang.org/x/text v0.3.3
google.golang.org/api v0.32.0
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.32.0
google.golang.org/grpc v1.33.1
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/fsnotify.v1 v1.4.7
gopkg.in/yaml.v2 v2.3.0
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.20201029103703-63be30dceed9
github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.8.2-0.20201119142752-3ad25a6dc3d9
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
129 changes: 101 additions & 28 deletions go.sum

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ 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 @@ -1024,7 +1025,7 @@ 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, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, 1000, tmpDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
testutil.Ok(t, err)
defer func() {
testutil.Ok(t, h.Close())
Expand Down Expand Up @@ -1399,7 +1400,7 @@ func TestBucketSeries_OneBlock_InMemIndexCacheSegfault(t *testing.T) {
// 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, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, 1, tmpDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand Down Expand Up @@ -1438,7 +1439,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, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, 1, tmpDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand Down Expand Up @@ -1684,7 +1685,7 @@ func TestSeries_BlockWithMultipleChunks(t *testing.T) {
// so that they will span across multiple chunks.
blkDir := filepath.Join(tmpDir, "block")

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

Expand Down Expand Up @@ -1955,7 +1956,7 @@ 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, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, int64(totalSamples)*step, dir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, h.Close()) }()

Expand Down
3 changes: 2 additions & 1 deletion pkg/store/postings_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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 @@ -23,7 +24,7 @@ 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, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, 1000, chunksDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
testutil.Ok(t, err)
defer func() {
testutil.Ok(t, h.Close())
Expand Down
4 changes: 1 addition & 3 deletions pkg/store/storepb/testutil/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ func allPostings(t testing.TB, ix tsdb.IndexReader) index.Postings {
return p
}

const RemoteReadFrameLimit = 1048576

type HeadGenOptions struct {
TSDBDir string
SamplesPerSeries, Series int
Expand Down Expand Up @@ -71,7 +69,7 @@ func CreateHeadWithSeries(t testing.TB, j int, opts HeadGenOptions) (*tsdb.Head,
testutil.Ok(t, os.MkdirAll(filepath.Join(opts.TSDBDir, "wal"), os.ModePerm))
}

h, err := tsdb.NewHead(nil, nil, w, tsdb.DefaultBlockDuration, opts.TSDBDir, nil, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, w, tsdb.DefaultBlockDuration, opts.TSDBDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
testutil.Ok(t, err)

app := h.Appender(context.Background())
Expand Down
5 changes: 3 additions & 2 deletions pkg/store/tsdb.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/storage"
"github.com/thanos-io/thanos/pkg/store/labelpb"
storetestutil "github.com/thanos-io/thanos/pkg/store/storepb/testutil"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand All @@ -24,6 +23,8 @@ import (
"github.com/thanos-io/thanos/pkg/store/storepb"
)

const RemoteReadFrameLimit = 1048576

type TSDBReader interface {
storage.ChunkQueryable
StartTime() (int64, error)
Expand Down Expand Up @@ -62,7 +63,7 @@ func NewTSDBStore(logger log.Logger, _ prometheus.Registerer, db TSDBReader, com
db: db,
component: component,
externalLabels: externalLabels,
maxBytesPerFrame: storetestutil.RemoteReadFrameLimit,
maxBytesPerFrame: RemoteReadFrameLimit,
}
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/testutil/e2eutil/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/prometheus/prometheus/pkg/timestamp"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/index"
"golang.org/x/sync/errgroup"

Expand Down Expand Up @@ -409,7 +410,7 @@ func createBlock(
tombstones bool,
) (id ulid.ULID, err error) {
chunksRootDir := filepath.Join(dir, "chunks")
h, err := tsdb.NewHead(nil, nil, nil, 10000000000, chunksRootDir, nil, tsdb.DefaultStripeSize, nil)
h, err := tsdb.NewHead(nil, nil, nil, 10000000000, chunksRootDir, nil, chunks.DefaultWriteBufferSize, tsdb.DefaultStripeSize, nil)
if err != nil {
return id, errors.Wrap(err, "create head block")
}
Expand Down

0 comments on commit 8ba87ae

Please sign in to comment.