diff --git a/promql/promqltest/test.go b/promql/promqltest/test.go index 148f11842d..35d1865776 100644 --- a/promql/promqltest/test.go +++ b/promql/promqltest/test.go @@ -1252,7 +1252,7 @@ func (t *test) clear() { if t.cancelCtx != nil { t.cancelCtx() } - t.storage = teststorage.New(t) + t.storage = teststorage.New(t, 24*time.Minute.Milliseconds()) t.context, t.cancelCtx = context.WithCancel(context.Background()) } @@ -1338,7 +1338,7 @@ func (ll *LazyLoader) clear() error { ll.cancelCtx() } var err error - ll.storage, err = teststorage.NewWithError() + ll.storage, err = teststorage.NewWithError(24 * time.Minute.Milliseconds()) if err != nil { return err } diff --git a/promql/promqltest/testdata/ooo.test b/promql/promqltest/testdata/ooo.test index ec72582eef..6b0c88eaa7 100644 --- a/promql/promqltest/testdata/ooo.test +++ b/promql/promqltest/testdata/ooo.test @@ -1,11 +1,28 @@ -# OOO samples +# OOO float samples -load 30s 150 - http_requests{path="/foo"} 1 2 3 4 8 9 +#load 30s 150 +# http_requests{path="/foo"} 1 2 3 4 8 9 -load 30s 0 - http_requests{path="/foo"} 1 2 3 0 1 +#load 30s 0 +# http_requests{path="/foo"} 1 2 3 0 1 -eval range from 0 to 5m step 30s sum by (path) (http_requests) - {path="/foo"} 1 2 3 0 1 1 2 3 4 5 +#eval range from 0 to 5m step 30s sum by (path) (http_requests) +# {path="/foo"} 1 2 3 0 1 1 2 3 4 5 +### OOO Native Histogram samples + +# +load 1s 1 + ooo_histograms {{schema:0 sum:50 count:40 buckets:[10 20 10]}} + +load 1s 4 + ooo_histograms {{schema:0 sum:50 count:30 buckets:[10 10 10]}} + +load 1s 2 + ooo_histograms {{schema:0 sum:50 count:40 buckets:[10 20 10]}} + +load 1s 3 + ooo_histograms {{schema:0 sum:10 count:10 buckets:[4 2 4]}} + +eval instant at 5s histogram_count(rate(ooo_histograms[5s])) + {} {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} diff --git a/util/teststorage/storage.go b/util/teststorage/storage.go index e15d591e0c..6a59fecc79 100644 --- a/util/teststorage/storage.go +++ b/util/teststorage/storage.go @@ -51,6 +51,7 @@ func NewWithError(outOfOrderTimeWindow ...int64) (*TestStorage, error) { opts.MaxBlockDuration = int64(24 * time.Hour / time.Millisecond) opts.RetentionDuration = 0 opts.EnableNativeHistograms = true + opts.EnableOOONativeHistograms = true // Set OutOfOrderTimeWindow if provided, otherwise use default (0) if len(outOfOrderTimeWindow) > 0 {