promql-engine
promql-engine copied to clipboard
Update prometheus
Changes
Updating prometheus to: https://github.com/prometheus/prometheus/commit/e480cf21eb1dd39dcf59ae066bfc40d127eeb383
I think it won't be so easy due to https://github.com/thanos-io/promql-engine/issues/486.
I do not understand the new behavior, raised an issue here: https://github.com/prometheus/prometheus/issues/14961.
Quite a lot of tests failed due to round. Should we add my fix to round function to see how much it would help?
--- FAIL: TestInstantQuery/round/disableOptimizers=false/disableFallback=true#04 (0.00s)
testutil.go:91: engine_test.go:4215: "Query: round(http_requests_total)
Explanation:
[duplicateLabelCheck]:
└──[function] round([http_requests_total]):
└──[coalesce]:
├──[concurrent(buff=2)]:
│ └──[vectorSelector] {[__name__="http_requests_total"]} 0 mod 2
└──[concurrent(buff=2)]:
└──[vectorSelector] {[__name__="http_requests_total"]} 1 mod 2
"
exp: &promql.Result{Err:error(nil), Value:promql.Vector{promql.Sample{T:0, F:1, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-1"}, labels.Label{Name:"series", Value:"1"}}, DropName:true}, promql.Sample{T:0, F:2, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-2"}, labels.Label{Name:"series", Value:"2"}}, DropName:true}, promql.Sample{T:0, F:5, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-4"}, labels.Label{Name:"series", Value:"3"}}, DropName:true}, promql.Sample{T:0, F:8, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-5"}, labels.Label{Name:"series", Value:"1"}}, D...(output trimmed)
got: &promql.Result{Err:error(nil), Value:promql.Vector{promql.Sample{T:0, F:1, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-1"}, labels.Label{Name:"series", Value:"1"}}, DropName:false}, promql.Sample{T:0, F:2, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-2"}, labels.Label{Name:"series", Value:"2"}}, DropName:false}, promql.Sample{T:0, F:5, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-4"}, labels.Label{Name:"series", Value:"3"}}, DropName:false}, promql.Sample{T:0, F:8, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-5"}, labels.Label{Name:"series", Value:"1"}}, DropName:false}, promql.Sample{T:0, F:2, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-6"}, labels.Label{Name:"series", Value:"2"}}, DropName:false}}, Warnings:annotations.Annotations{}}
Diff:
--- Expected
+++ Actual
@@ -1,6 +1,6 @@
-(*promql.Result)({__name__="http_requests_total", pod="nginx-1", series="1"} => 1 @[0]
-{__name__="http_requests_total", pod="nginx-2", series="2"} => 2 @[0]
-{__name__="http_requests_total", pod="nginx-4", series="3"} => 5 @[0]
-{__name__="http_requests_total", pod="nginx-5", series="1"} => 8 @[0]
-{__name__="http_requests_total", pod="nginx-6", series="2"} => 2 @[0])
+(*promql.Result)({pod="nginx-1", series="1"} => 1 @[0]
+{pod="nginx-2", series="2"} => 2 @[0]
+{pod="nginx-4", series="3"} => 5 @[0]
+{pod="nginx-5", series="1"} => 8 @[0]
+{pod="nginx-6", series="2"} => 2 @[0])
Quite a lot of tests failed due to round. Should we add my fix to
roundfunction to see how much it would help?--- FAIL: TestInstantQuery/round/disableOptimizers=false/disableFallback=true#04 (0.00s) testutil.go:91: engine_test.go:4215: "Query: round(http_requests_total) Explanation: [duplicateLabelCheck]: └──[function] round([http_requests_total]): └──[coalesce]: ├──[concurrent(buff=2)]: │ └──[vectorSelector] {[__name__="http_requests_total"]} 0 mod 2 └──[concurrent(buff=2)]: └──[vectorSelector] {[__name__="http_requests_total"]} 1 mod 2 " exp: &promql.Result{Err:error(nil), Value:promql.Vector{promql.Sample{T:0, F:1, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-1"}, labels.Label{Name:"series", Value:"1"}}, DropName:true}, promql.Sample{T:0, F:2, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-2"}, labels.Label{Name:"series", Value:"2"}}, DropName:true}, promql.Sample{T:0, F:5, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-4"}, labels.Label{Name:"series", Value:"3"}}, DropName:true}, promql.Sample{T:0, F:8, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"__name__", Value:"http_requests_total"}, labels.Label{Name:"pod", Value:"nginx-5"}, labels.Label{Name:"series", Value:"1"}}, D...(output trimmed) got: &promql.Result{Err:error(nil), Value:promql.Vector{promql.Sample{T:0, F:1, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-1"}, labels.Label{Name:"series", Value:"1"}}, DropName:false}, promql.Sample{T:0, F:2, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-2"}, labels.Label{Name:"series", Value:"2"}}, DropName:false}, promql.Sample{T:0, F:5, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-4"}, labels.Label{Name:"series", Value:"3"}}, DropName:false}, promql.Sample{T:0, F:8, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-5"}, labels.Label{Name:"series", Value:"1"}}, DropName:false}, promql.Sample{T:0, F:2, H:(*histogram.FloatHistogram)(nil), Metric:labels.Labels{labels.Label{Name:"pod", Value:"nginx-6"}, labels.Label{Name:"series", Value:"2"}}, DropName:false}}, Warnings:annotations.Annotations{}} Diff: --- Expected +++ Actual @@ -1,6 +1,6 @@ -(*promql.Result)({__name__="http_requests_total", pod="nginx-1", series="1"} => 1 @[0] -{__name__="http_requests_total", pod="nginx-2", series="2"} => 2 @[0] -{__name__="http_requests_total", pod="nginx-4", series="3"} => 5 @[0] -{__name__="http_requests_total", pod="nginx-5", series="1"} => 8 @[0] -{__name__="http_requests_total", pod="nginx-6", series="2"} => 2 @[0]) +(*promql.Result)({pod="nginx-1", series="1"} => 1 @[0] +{pod="nginx-2", series="2"} => 2 @[0] +{pod="nginx-4", series="3"} => 5 @[0] +{pod="nginx-5", series="1"} => 8 @[0] +{pod="nginx-6", series="2"} => 2 @[0])
It feels like the issue is on prometheus side, we should bump prometheus to include your fix i think.
Quite a lot of tests failed due to round. Should we add my fix to round function to see how much it would help?
@yeya24, I tested your fix locally. The tests are passing.
It feels like the issue is on prometheus side, we should bump prometheus to include your fix i think.
Yes. This PR is intentionally only updating till https://github.com/prometheus/prometheus/commit/65f610353919. The next commit in Prometheus is the switching to log/slog which is a huge change.
My plan is to work on the Prometheus upgrade incrementally on this branch so that each PR will be small and easier to review.
In retro, the branch could have been named prometheus-v3-update.
@fpetkovski @MichaHoffmann Can you please take a look at the PR? I reviewed most of the code changes other than code relevant to https://github.com/prometheus/prometheus/pull/14413.
Let's get this PR merged as it targets a non main branch. We can iterate on top of it
Sorry missed this notification. Merging against a non-main branch makes perfect sense 👍