Skip to content

Commit 8f7a874

Browse files
codesomepracucci
andauthored
Upgrade Prometheus to latest master (#3373)
* Upgrade Prometheus to latest master Signed-off-by: Ganesh Vernekar <[email protected]> * Add another commit Signed-off-by: Ganesh Vernekar <[email protected]> * Fixed test Signed-off-by: Marco Pracucci <[email protected]> * Upgrade Prometheus again to fix the panic Signed-off-by: Ganesh Vernekar <[email protected]> * Fix tests Signed-off-by: Ganesh Vernekar <[email protected]> * Fixed test Signed-off-by: Marco Pracucci <[email protected]> * CHANGELOG entry Signed-off-by: Ganesh Vernekar <[email protected]> * Re-formatted CHANGELOG entry Signed-off-by: Marco Pracucci <[email protected]> Co-authored-by: Marco Pracucci <[email protected]>
1 parent a6292c1 commit 8f7a874

File tree

57 files changed

+414
-337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+414
-337
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
* [ENHANCEMENT] Blocks storage: reduced number of bucket listing operations to list block content (applies to newly created blocks only). #3363
9090
* [ENHANCEMENT] Ruler: Include the tenant ID on the notifier logs. #3372
9191
* [ENHANCEMENT] Blocks storage Compactor: Added `-compactor.enabled-tenants` and `-compactor.disabled-tenants` to explicitly enable or disable compaction of specific tenants. #3385
92+
* [ENHANCEMENT] Blocks storage ingester: Creating checkpoint only once even when there are multiple Head compactions in a single `Compact()` call. #3373
93+
* [BUGFIX] Blocks storage ingester: Read repair memory-mapped chunks file which can end up being empty on abrupt shutdowns combined with faulty disks. #3373
94+
* [BUGFIX] Blocks storage ingester: Close TSDB resources on failed startup preventing ingester OOMing. #3373
9295
* [BUGFIX] No-longer-needed ingester operations for queries triggered by queriers and rulers are now canceled. #3178
9396
* [BUGFIX] Ruler: directories in the configured `rules-path` will be removed on startup and shutdown in order to ensure they don't persist between runs. #3195
9497
* [BUGFIX] Handle hash-collisions in the query path. #3192

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require (
4747
github.com/prometheus/client_golang v1.7.1
4848
github.com/prometheus/client_model v0.2.0
4949
github.com/prometheus/common v0.14.0
50-
github.com/prometheus/prometheus v1.8.2-0.20201014093524-73e2ce1bd643
50+
github.com/prometheus/prometheus v1.8.2-0.20201028100903-3245b3267b24
5151
github.com/segmentio/fasthash v0.0.0-20180216231524-a72b379d632e
5252
github.com/sony/gobreaker v0.4.1
5353
github.com/spf13/afero v1.2.2

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,8 @@ github.com/prometheus/prometheus v1.8.2-0.20200805082714-e0cf219f0de2/go.mod h1:
10811081
github.com/prometheus/prometheus v1.8.2-0.20200819132913-cb830b0a9c78 h1:tHIAD+hgCIb86T0/Du7vGyfHa6J1+XsImQoY8Ete+c8=
10821082
github.com/prometheus/prometheus v1.8.2-0.20200819132913-cb830b0a9c78/go.mod h1:zfAqy/MwhMFajB9E2n12/9gG2fvofIE9uKDtlZCDxqs=
10831083
github.com/prometheus/prometheus v1.8.2-0.20200923143134-7e2db3d092f3/go.mod h1:9VNWoDFHOMovlubld5uKKxfCDcPBj2GMOCjcUFXkYaM=
1084-
github.com/prometheus/prometheus v1.8.2-0.20201014093524-73e2ce1bd643 h1:BDAexvKlOVjE5A8MlqRxzwkEpPl1/v6ydU1/J7kJtZc=
1085-
github.com/prometheus/prometheus v1.8.2-0.20201014093524-73e2ce1bd643/go.mod h1:XYjkJiog7fyQu3puQNivZPI2pNq1C/775EIoHfDvuvY=
1084+
github.com/prometheus/prometheus v1.8.2-0.20201028100903-3245b3267b24 h1:V/4Cj2GytqdqK7OMEz6c4LNjey3SNyfw3pg5jPKtJvQ=
1085+
github.com/prometheus/prometheus v1.8.2-0.20201028100903-3245b3267b24/go.mod h1:MDRkz271loM/PrYN+wUNEaTMDGSP760MQzB0yEjdgSQ=
10861086
github.com/rafaeljusto/redigomock v0.0.0-20190202135759-257e089e14a1 h1:+kGqA4dNN5hn7WwvKdzHl0rdN5AEkbNZd0VjRltAiZg=
10871087
github.com/rafaeljusto/redigomock v0.0.0-20190202135759-257e089e14a1/go.mod h1:JaY6n2sDr+z2WTsXkOmNRUfDy6FN0L6Nk7x06ndm4tY=
10881088
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
@@ -1590,8 +1590,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
15901590
golang.org/x/tools v0.0.0-20200822203824-307de81be3f4/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
15911591
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
15921592
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
1593-
golang.org/x/tools v0.0.0-20201008025239-9df69603baec h1:RY2OghEV/7X1MLaecgm1mwFd3sGvUddm5pGVSxQvX0c=
1594-
golang.org/x/tools v0.0.0-20201008025239-9df69603baec/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
1593+
golang.org/x/tools v0.0.0-20201020161133-226fd2f889ca h1:pvScuB+UnCGDas2naNKUOXruM08MjwVcEdaweeynIqQ=
1594+
golang.org/x/tools v0.0.0-20201020161133-226fd2f889ca/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
15951595
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
15961596
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
15971597
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

integration/e2e/scenario_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/go-kit/kit/log"
13-
"github.com/prometheus/prometheus/util/testutil"
13+
"github.com/stretchr/testify/assert"
1414
"github.com/stretchr/testify/require"
1515
"github.com/thanos-io/thanos/pkg/objstore/s3"
1616
"gopkg.in/yaml.v2"
@@ -23,7 +23,7 @@ const bktName = "cheesecake"
2323

2424
func spinup(t *testing.T, networkName string) (*e2e.Scenario, *e2e.HTTPService, *e2e.HTTPService) {
2525
s, err := e2e.NewScenario(networkName)
26-
testutil.Ok(t, err)
26+
assert.NoError(t, err)
2727

2828
m1 := e2edb.NewMinio(9000, bktName)
2929
m2 := e2edb.NewMinio(9001, bktName)

pkg/configs/legacy_promql/functions_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
"github.com/prometheus/prometheus/pkg/labels"
2222
"github.com/prometheus/prometheus/pkg/timestamp"
23-
"github.com/prometheus/prometheus/util/testutil"
23+
"github.com/stretchr/testify/assert"
2424
)
2525

2626
func TestDeriv(t *testing.T) {
@@ -35,21 +35,21 @@ func TestDeriv(t *testing.T) {
3535

3636
metric := labels.FromStrings("__name__", "foo")
3737
_, err := a.Add(metric, 1493712816939, 1.0)
38-
testutil.Ok(t, err)
38+
assert.NoError(t, err)
3939

4040
_, err = a.Add(metric, 1493712846939, 1.0)
41-
testutil.Ok(t, err)
41+
assert.NoError(t, err)
4242

4343
err = a.Commit()
44-
testutil.Ok(t, err)
44+
assert.NoError(t, err)
4545

4646
query, err := engine.NewInstantQuery(storage, "deriv(foo[30m])", timestamp.Time(1493712846939))
47-
testutil.Ok(t, err)
47+
assert.NoError(t, err)
4848

4949
result := query.Exec(context.Background())
50-
testutil.Ok(t, result.Err)
50+
assert.NoError(t, result.Err)
5151

5252
vec, _ := result.Vector()
53-
testutil.Assert(t, len(vec) == 1, "Expected 1 result, got %d", len(vec))
54-
testutil.Assert(t, vec[0].V == 0.0, "Expected 0.0 as value, got %f", vec[0].V)
53+
assert.True(t, len(vec) == 1, "Expected 1 result, got %d", len(vec))
54+
assert.True(t, vec[0].V == 0.0, "Expected 0.0 as value, got %f", vec[0].V)
5555
}

pkg/ingester/ingester_v2_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,11 +1667,12 @@ func TestIngester_v2OpenExistingTSDBOnStartup(t *testing.T) {
16671667
"should fail and rollback if an error occur while loading a TSDB on concurrency > number of TSDBs": {
16681668
concurrency: 10,
16691669
setup: func(t *testing.T, dir string) {
1670-
// Create a fake TSDB on disk with an empty chunks head segment file (it's invalid and
1671-
// opening TSDB should fail).
1670+
// Create a fake TSDB on disk with an empty chunks head segment file (it's invalid unless
1671+
// it's the last one and opening TSDB should fail).
16721672
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user0", "wal", ""), 0700))
16731673
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user0", "chunks_head", ""), 0700))
16741674
require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "user0", "chunks_head", "00000001"), nil, 0700))
1675+
require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "user0", "chunks_head", "00000002"), nil, 0700))
16751676

16761677
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user1", "dummy"), 0700))
16771678
},
@@ -1690,11 +1691,12 @@ func TestIngester_v2OpenExistingTSDBOnStartup(t *testing.T) {
16901691
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user3", "dummy"), 0700))
16911692
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user4", "dummy"), 0700))
16921693

1693-
// Create a fake TSDB on disk with an empty chunks head segment file (it's invalid and
1694-
// opening TSDB should fail).
1694+
// Create a fake TSDB on disk with an empty chunks head segment file (it's invalid unless
1695+
// it's the last one and opening TSDB should fail).
16951696
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user2", "wal", ""), 0700))
16961697
require.NoError(t, os.MkdirAll(filepath.Join(dir, "user2", "chunks_head", ""), 0700))
16971698
require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "user2", "chunks_head", "00000001"), nil, 0700))
1699+
require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "user2", "chunks_head", "00000002"), nil, 0700))
16981700
},
16991701
check: func(t *testing.T, i *Ingester) {
17001702
require.Equal(t, 0, len(i.TSDBState.dbs))

pkg/querier/chunk_tar_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
"github.com/pkg/errors"
1616
"github.com/prometheus/prometheus/promql"
17-
"github.com/prometheus/prometheus/util/testutil"
17+
"github.com/stretchr/testify/assert"
1818
"github.com/stretchr/testify/require"
1919
"github.com/weaveworks/common/user"
2020

@@ -53,7 +53,7 @@ func getTarDataFromEnv(t testing.TB) (query string, from, through time.Time, ste
5353

5454
func runRangeQuery(t testing.TB, query string, from, through time.Time, step time.Duration, store chunkstore.ChunkStore) {
5555
dir, err := ioutil.TempDir("", t.Name())
56-
testutil.Ok(t, err)
56+
assert.NoError(t, err)
5757
defer os.RemoveAll(dir)
5858
queryTracker := promql.NewActiveQueryTracker(dir, 1, util.Logger)
5959

pkg/querier/querier_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/prometheus/prometheus/promql"
2424
"github.com/prometheus/prometheus/scrape"
2525
"github.com/prometheus/prometheus/storage"
26-
"github.com/prometheus/prometheus/util/testutil"
2726
"github.com/stretchr/testify/assert"
2827
"github.com/stretchr/testify/require"
2928
"github.com/weaveworks/common/user"
@@ -262,7 +261,7 @@ func TestNoHistoricalQueryToIngester(t *testing.T) {
262261
}
263262

264263
dir, err := ioutil.TempDir("", t.Name())
265-
testutil.Ok(t, err)
264+
assert.NoError(t, err)
266265
defer os.RemoveAll(dir)
267266
queryTracker := promql.NewActiveQueryTracker(dir, 10, util.Logger)
268267

@@ -495,7 +494,7 @@ func mockDistibutorFor(t *testing.T, cs mockChunkStore, through model.Time) *moc
495494

496495
func testQuery(t testing.TB, queryable storage.Queryable, end model.Time, q query) *promql.Result {
497496
dir, err := ioutil.TempDir("", "test_query")
498-
testutil.Ok(t, err)
497+
assert.NoError(t, err)
499498
defer os.RemoveAll(dir)
500499
queryTracker := promql.NewActiveQueryTracker(dir, 10, util.Logger)
501500

@@ -646,7 +645,7 @@ func TestShortTermQueryToLTS(t *testing.T) {
646645
}
647646

648647
dir, err := ioutil.TempDir("", t.Name())
649-
testutil.Ok(t, err)
648+
assert.NoError(t, err)
650649
defer os.RemoveAll(dir)
651650
queryTracker := promql.NewActiveQueryTracker(dir, 10, util.Logger)
652651

pkg/ruler/ruler_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/prometheus/prometheus/promql"
2424
promRules "github.com/prometheus/prometheus/rules"
2525
"github.com/prometheus/prometheus/storage"
26-
"github.com/prometheus/prometheus/util/testutil"
2726
"github.com/stretchr/testify/assert"
2827
"github.com/stretchr/testify/require"
2928
"github.com/weaveworks/common/user"
@@ -87,7 +86,7 @@ func (r ruleLimits) RulerMaxRulesPerRuleGroup(_ string) int {
8786

8887
func testSetup(t *testing.T, cfg Config) (*promql.Engine, storage.QueryableFunc, Pusher, log.Logger, RulesLimits, func()) {
8988
dir, err := ioutil.TempDir("", filepath.Base(t.Name()))
90-
testutil.Ok(t, err)
89+
assert.NoError(t, err)
9190
cleanup := func() {
9291
os.RemoveAll(dir)
9392
}

vendor/github.com/prometheus/prometheus/discovery/discovery.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)