@ -7,7 +7,6 @@ import (
"math"
"strings"
// "math"
"testing"
"time"
@ -163,7 +162,7 @@ func TestEngine_LogsInstantQuery(t *testing.T) {
{ newSeries ( testSize , factor ( 5 , identity ) , ` { app="foo"} ` ) , newSeries ( testSize , factor ( 5 , identity ) , ` { app="bar"} ` ) } ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` rate( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum( rate({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Vector {
promql . Sample { Point : promql . Point { T : 60 * 1000 , V : 0.4 } , Metric : labels . Labels { } } ,
@ -175,7 +174,7 @@ func TestEngine_LogsInstantQuery(t *testing.T) {
{ newSeries ( testSize , factor ( 10 , identity ) , ` { app="foo"} ` ) , newSeries ( testSize , factor ( 10 , identity ) , ` { app="bar"} ` ) } ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` count_over_time( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum by (app)( count_over_time({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Vector {
promql . Sample { Point : promql . Point { T : 60 * 1000 , V : 6 } , Metric : labels . Labels { labels . Label { Name : "app" , Value : "bar" } } } ,
@ -191,7 +190,7 @@ func TestEngine_LogsInstantQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` count_over_time( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum by (namespace,app) ( count_over_time({ app=~"foo|bar"} |~".+bar" [1m])) ` } } ,
} ,
promql . Vector {
promql . Sample {
@ -432,8 +431,8 @@ func TestEngine_LogsInstantQuery(t *testing.T) {
{ } ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` count_over_time( { app="foo"}[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` count_over_time( { app="bar"}[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum without (app) ( count_over_time({ app="foo"}[1m]) ) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum without (app) ( count_over_time({ app="bar"}[1m]) ) ` } } ,
} ,
promql . Vector {
promql . Sample { Point : promql . Point { T : 60 * 1000 , V : 0 } , Metric : labels . Labels { } } ,
@ -449,8 +448,8 @@ func TestEngine_LogsInstantQuery(t *testing.T) {
{ newSeries ( testSize , identity , ` { app="bar"} ` ) } ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` count_over_time( { app="foo"}[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` count_over_time( { app="bar"}[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum without(app) ( count_over_time({ app="foo"}[1m]) ) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 60 , 0 ) , Selector : ` sum without(app) ( count_over_time({ app="bar"}[1m]) ) ` } } ,
} ,
promql . Vector {
promql . Sample { Point : promql . Point { T : 60 * 1000 , V : 60 } , Metric : labels . Labels { } } ,
@ -688,7 +687,7 @@ func TestEngine_RangeQuery(t *testing.T) {
{ newSeries ( testSize , factor ( 5 , identity ) , ` { app="foo"} ` ) , newSeries ( testSize , factor ( 5 , identity ) , ` { app="bar"} ` ) } ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` rate( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum( rate({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -703,7 +702,7 @@ func TestEngine_RangeQuery(t *testing.T) {
{ newSeries ( testSize , factor ( 10 , identity ) , ` { app="foo"} ` ) , newSeries ( testSize , factor ( 5 , identity ) , ` { app="bar"} ` ) } ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` count_over_time( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (app) ( count_over_time({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -727,7 +726,7 @@ func TestEngine_RangeQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` count_over_time( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (namespace,cluster, app)( count_over_time({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -759,7 +758,7 @@ func TestEngine_RangeQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` count_over_time( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (cluster, namespace, app) ( count_over_time({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -791,7 +790,7 @@ func TestEngine_RangeQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` count_over_time( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (namespace, app)( count_over_time({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -1224,7 +1223,7 @@ func TestEngine_RangeQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` rate( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (app) ( rate({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -1252,7 +1251,7 @@ func TestEngine_RangeQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` rate( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (app) ( rate({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {
@ -1280,7 +1279,7 @@ func TestEngine_RangeQuery(t *testing.T) {
} ,
} ,
[ ] SelectSampleParams {
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` rate( { app=~"foo|bar"}|~".+bar"[1m]) ` } } ,
{ & logproto . SampleQueryRequest { Start : time . Unix ( 0 , 0 ) , End : time . Unix ( 180 , 0 ) , Selector : ` sum by (app) ( rate({ app=~"foo|bar"} |~".+bar" [1m]) ) ` } } ,
} ,
promql . Matrix {
promql . Series {