ignore histogram in dateWrapper

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
pull/15479/head
Neeraj Gartia 2024-11-28 01:57:04 +05:30
parent dd0252a774
commit 0de340c1b4
2 changed files with 24 additions and 0 deletions

View File

@ -1553,6 +1553,10 @@ func dateWrapper(vals []parser.Value, enh *EvalNodeHelper, f func(time.Time) flo
}
for _, el := range vals[0].(Vector) {
if el.H != nil {
// Ignore histogram sample.
continue
}
t := time.Unix(int64(el.F), 0).UTC()
if !enh.enableDelayedNameRemoval {
el.Metric = el.Metric.DropMetricName()

View File

@ -901,6 +901,9 @@ eval_warn instant at 1m (quantile_over_time(2, (data[2m])))
clear
# Test time-related functions.
load 5m
histogram_sample {{schema:0 sum:1 count:1}}
eval instant at 0m year()
{} 1970
@ -982,6 +985,23 @@ eval instant at 0m days_in_month(vector(1454284800))
eval instant at 0m days_in_month(vector(1485907200))
{} 28
# Test for histograms.
eval instant at 0m day_of_month(histogram_sample)
eval instant at 0m day_of_week(histogram_sample)
eval instant at 0m day_of_year(histogram_sample)
eval instant at 0m days_in_month(histogram_sample)
eval instant at 0m hour(histogram_sample)
eval instant at 0m minute(histogram_sample)
eval instant at 0m month(histogram_sample)
eval instant at 0m year(histogram_sample)
clear
# Test duplicate labelset in promql output.