mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-07 06:37:17 +02:00
Merge pull request #16733 from MichaHoffmann/mhoffmann/fix-ts-of-last-over-time-histograms
promql: fix ts_of_last_over_time for histogram vectors
This commit is contained in:
commit
e81132f162
@ -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{
|
||||||
|
8
promql/promqltest/testdata/functions.test
vendored
8
promql/promqltest/testdata/functions.test
vendored
@ -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…
Reference in New Issue
Block a user