promql-engine icon indicating copy to clipboard operation
promql-engine copied to clipboard

Update prometheus

Open harry671003 opened this issue 1 year ago • 2 comments

Changes

Updating prometheus to: https://github.com/prometheus/prometheus/commit/e480cf21eb1dd39dcf59ae066bfc40d127eeb383

harry671003 avatar Sep 19 '24 20:09 harry671003

I think it won't be so easy due to https://github.com/thanos-io/promql-engine/issues/486.

GiedriusS avatar Sep 20 '24 13:09 GiedriusS

I do not understand the new behavior, raised an issue here: https://github.com/prometheus/prometheus/issues/14961.

fpetkovski avatar Sep 23 '24 06:09 fpetkovski

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])

yeya24 avatar Nov 22 '24 00:11 yeya24

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])

It feels like the issue is on prometheus side, we should bump prometheus to include your fix i think.

MichaHoffmann avatar Nov 22 '24 06:11 MichaHoffmann

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.

harry671003 avatar Nov 22 '24 16:11 harry671003

@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.

yeya24 avatar Nov 24 '24 18:11 yeya24

Let's get this PR merged as it targets a non main branch. We can iterate on top of it

yeya24 avatar Dec 01 '24 18:12 yeya24

Sorry missed this notification. Merging against a non-main branch makes perfect sense 👍

fpetkovski avatar Dec 02 '24 15:12 fpetkovski