Skip to content

Commit

Permalink
misc: bump prometheus to latest nightly
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hoffmann <[email protected]>
  • Loading branch information
MichaHoffmann committed Oct 3, 2023
1 parent 17cf9a9 commit 2c93073
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 241 deletions.
7 changes: 4 additions & 3 deletions engine/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ func BenchmarkChunkDecoding(b *testing.B) {
storage := setupStorage(b, 1000, 3, 720)
defer storage.Close()

ctx := context.Background()
start := time.Unix(0, 0)
end := start.Add(6 * time.Hour)
step := time.Second * 30

querier, err := storage.Querier(context.Background(), start.UnixMilli(), end.UnixMilli())
querier, err := storage.Querier(start.UnixMilli(), end.UnixMilli())
testutil.Ok(b, err)

matcher, err := labels.NewMatcher(labels.MatchEqual, labels.MetricName, "http_requests_total")
Expand All @@ -41,7 +42,7 @@ func BenchmarkChunkDecoding(b *testing.B) {
for c := 0; c < b.N; c++ {
numIterations := 0

ss := querier.Select(false, nil, matcher)
ss := querier.Select(ctx, false, nil, matcher)
series := make([]chunkenc.Iterator, 0)
for ss.Next() {
series = append(series, ss.At().Iterator(nil))
Expand All @@ -60,7 +61,7 @@ func BenchmarkChunkDecoding(b *testing.B) {
b.ResetTimer()
for c := 0; c < b.N; c++ {
numIterations := 0
ss := querier.Select(false, nil, matcher)
ss := querier.Select(ctx, false, nil, matcher)
series := make([]chunkenc.Iterator, 0)
for ss.Next() {
series = append(series, ss.At().Iterator(nil))
Expand Down
16 changes: 4 additions & 12 deletions engine/distributed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/util/annotations"

"github.com/thanos-io/promql-engine/api"
"github.com/thanos-io/promql-engine/engine"
Expand Down Expand Up @@ -289,14 +290,7 @@ func TestDistributedAggregations(t *testing.T) {
testutil.Ok(t, err)
promResult := promQry.Exec(ctx)

roundValues(promResult)
roundValues(distResult)

// Instant queries have no guarantees on result ordering.
sortByLabels(promResult)
sortByLabels(distResult)

testutil.Equals(t, promResult, distResult)
testutil.WithGoCmp(comparer).Equals(t, promResult, distResult)
})
}

Expand All @@ -316,9 +310,7 @@ func TestDistributedAggregations(t *testing.T) {
testutil.Ok(t, err)
promResult := promQry.Exec(ctx)

roundValues(promResult)
roundValues(distResult)
testutil.Equals(t, promResult, distResult)
testutil.WithGoCmp(comparer).Equals(t, promResult, distResult)
})
})
}
Expand All @@ -334,7 +326,7 @@ func TestDistributedEngineWarnings(t *testing.T) {
querier := &storage.MockQueryable{
MockQuerier: &storage.MockQuerier{
SelectMockFunction: func(sortSeries bool, hints *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet {
return newWarningsSeriesSet(storage.Warnings{errors.New("test warning")})
return newWarningsSeriesSet(annotations.New().Add(errors.New("test warning")))
},
},
}
Expand Down
5 changes: 1 addition & 4 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,7 @@ type compatibilityQuery struct {
func (q *compatibilityQuery) Exec(ctx context.Context) (ret *promql.Result) {
ctx = warnings.NewContext(ctx)
defer func() {
warns := warnings.FromContext(ctx)
if len(warns) > 0 {
ret.Warnings = warns
}
ret.Warnings = warnings.FromContext(ctx)
}()

// Handle case with strings early on as this does not need us to process samples.
Expand Down
Loading

0 comments on commit 2c93073

Please sign in to comment.