Merge pull request #16733 from MichaHoffmann/mhoffmann/fix-ts-of-last-over-time-histograms

promql: fix ts_of_last_over_time for histogram vectors
pull/16740/head
Julien 1 week ago committed by GitHub
commit e81132f162
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      promql/functions.go
  2. 8
      promql/promqltest/testdata/functions.test

@ -795,7 +795,7 @@ func funcTsOfLastOverTime(vals []parser.Value, _ parser.Expressions, enh *EvalNo
var th int64 var th int64
if len(el.Histograms) > 0 { if len(el.Histograms) > 0 {
th = el.Floats[len(el.Floats)-1].T th = el.Histograms[len(el.Histograms)-1].T
} }
return append(enh.Out, Sample{ return append(enh.Out, Sample{

@ -1201,6 +1201,8 @@ eval instant at 90s ts_of_max_over_time(metric[90s])
clear clear
load 10s53ms load 10s53ms
metric 1 2 3 _ _ metric 1 2 3 _ _
metric_histogram{type="only_histogram"} {{schema:1 sum:2 count:3}}x4
metric_histogram{type="mix"} 1 1 1 {{schema:1 sum:2 count:3}} {{schema:1 sum:2 count:3}} 1
eval instant at 90s ts_of_last_over_time(metric[90s]) eval instant at 90s ts_of_last_over_time(metric[90s])
{} 20.106 {} 20.106
@ -1208,6 +1210,12 @@ eval instant at 90s ts_of_last_over_time(metric[90s])
eval instant at 95s ts_of_last_over_time(metric[90s]) eval instant at 95s ts_of_last_over_time(metric[90s])
{} 20.106 {} 20.106
eval instant at 95s ts_of_last_over_time(metric_histogram{type="only_histogram"}[90s])
{type="only_histogram"} 40.212
eval instant at 95s ts_of_last_over_time(metric_histogram{type="mix"}[90s])
{type="mix"} 50.265
# Tests for quantile_over_time # Tests for quantile_over_time
clear clear

Loading…
Cancel
Save