Merge pull request #15479 from NeerajGartia21/promql/datewrapper
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (0) (push) Waiting to run
CI / Build Prometheus for common architectures (1) (push) Waiting to run
CI / Build Prometheus for common architectures (2) (push) Waiting to run
CI / Build Prometheus for all architectures (0) (push) Waiting to run
CI / Build Prometheus for all architectures (1) (push) Waiting to run
CI / Build Prometheus for all architectures (10) (push) Waiting to run
CI / Build Prometheus for all architectures (11) (push) Waiting to run
CI / Build Prometheus for all architectures (2) (push) Waiting to run
CI / Build Prometheus for all architectures (3) (push) Waiting to run
CI / Build Prometheus for all architectures (4) (push) Waiting to run
CI / Build Prometheus for all architectures (5) (push) Waiting to run
CI / Build Prometheus for all architectures (6) (push) Waiting to run
CI / Build Prometheus for all architectures (7) (push) Waiting to run
CI / Build Prometheus for all architectures (8) (push) Waiting to run
CI / Build Prometheus for all architectures (9) (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

[BUGFIX] PromQL: Ignore histograms in all time related functions
This commit is contained in:
Björn Rabenstein 2024-11-29 00:26:52 +01:00 committed by GitHub
commit dfbfe8b5e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View file

@ -1586,6 +1586,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

@ -933,6 +933,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
@ -1014,6 +1017,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.