Matthieu MOREL
cef219c31c
chore: enable unused-receiver rule from revive
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-04 09:43:33 +00:00
Björn Rabenstein
b7f984d6d2
Merge pull request #16585 from kapillamba4/fix/16393-strict
...
Convert PromQL tests to new syntax via basic migration mode
2025-07-10 15:45:38 +02:00
Björn Rabenstein
eb3ea163fa
promqltest: add tests for `histogram_count(increase(...))` ( #16854 )
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
As `histogram_count` is playing tricks to improve performance, we
better make sure that the limitation of extrapolation below zero still
works as expected.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-10 15:44:02 +02:00
Björn Rabenstein
362141370d
Merge pull request #16828 from prometheus/beorn7/histogram2
...
promql(histograms): scale a histogram the same as the count
2025-07-10 13:26:15 +02:00
beorn7
107e4a00c3
promqltest: Test NaN sample values for quantile aggregator
...
Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-09 13:38:19 +02:00
Kapil Lamba
df0e034314
address code review comments
...
Signed-off-by: Kapil Lamba <kapillamba4@gmail.com>
2025-07-09 07:25:31 +05:30
Björn Rabenstein
dbee82267a
Merge pull request #16725 from MichaHoffmann/mhoffmann/fix-topk-nan-arg-error-on-nonexisting-series
...
promql: fix topk error on NaN argument for non-existing series
2025-07-08 19:42:20 +02:00
beorn7
bcf7a822a0
promql: Prevent extrapolation below zero for histogram count
...
CI / Go tests (push) Has been cancelled
Details
CI / More Go tests (push) Has been cancelled
Details
CI / Go tests with previous Go version (push) Has been cancelled
Details
CI / UI tests (push) Has been cancelled
Details
CI / Go tests on Windows (push) Has been cancelled
Details
CI / Mixins tests (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
Details
CI / Check generated parser (push) Has been cancelled
Details
CI / golangci-lint (push) Has been cancelled
Details
CI / fuzzing (push) Has been cancelled
Details
CI / codeql (push) Has been cancelled
Details
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
Details
CI / Publish main branch artifacts (push) Has been cancelled
Details
CI / Publish release artefacts (push) Has been cancelled
Details
CI / Publish UI on npm Registry (push) Has been cancelled
Details
This deals with the count field of native histograms in the same way
as with simple float counters. It then scale the whole histogram with
the same factor as it has scaled the count. This will still allow
individual buckets to get extrapolated below zero, but maybe that is
fine.
This implements approach (2) as described in
https://github.com/prometheus/prometheus/issues/15976#issuecomment-3032095158
Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-08 19:01:31 +02:00
Michael Hoffmann
44ee5e2ad6
promql: fix topk error on NaN argument for non-existing series
...
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
2025-07-07 06:19:39 +00:00
beorn7
c0a13223e7
promql: add tests to demonstrate extrapolation below zero
...
CI / Go tests (push) Has been cancelled
Details
CI / More Go tests (push) Has been cancelled
Details
CI / Go tests with previous Go version (push) Has been cancelled
Details
CI / UI tests (push) Has been cancelled
Details
CI / Go tests on Windows (push) Has been cancelled
Details
CI / Mixins tests (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
Details
CI / Check generated parser (push) Has been cancelled
Details
CI / golangci-lint (push) Has been cancelled
Details
CI / fuzzing (push) Has been cancelled
Details
CI / codeql (push) Has been cancelled
Details
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
Details
CI / Publish main branch artifacts (push) Has been cancelled
Details
CI / Publish release artefacts (push) Has been cancelled
Details
CI / Publish UI on npm Registry (push) Has been cancelled
Details
This shows how float counters cannot go below zero when extrapolationg
for rate/increase, and how histograms do not have that protection yet,
leading to an overestimation of the rate/increase.
This also demonstrates edge cases where the count extrapolation does
not need to be limited, but an individual bucket still goes below
zero.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-06 23:42:55 +02:00
Julien Pivotto
3af0bdee68
PromQL: min/max/step: add more tests
...
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-07-02 11:17:17 +02:00
Julien Pivotto
ee7d5158a7
Add step(), min(a,b) and max(a,b) in promql duration expressions
...
step() is a new keyword introduced to represent the query step width in duration expressions.
min(a,b) and max(a,b) return the min and max from two duration expressions.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-07-02 11:17:17 +02:00
Björn Rabenstein
9e73fb43b3
Merge pull request #16773 from prometheus/beorn7/promql
...
buf.build / lint and publish (push) Waiting to run
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
CI / Go tests (push) Has been cancelled
Details
CI / More Go tests (push) Has been cancelled
Details
CI / Go tests with previous Go version (push) Has been cancelled
Details
CI / UI tests (push) Has been cancelled
Details
CI / Go tests on Windows (push) Has been cancelled
Details
CI / Mixins tests (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
Details
CI / Check generated parser (push) Has been cancelled
Details
CI / golangci-lint (push) Has been cancelled
Details
CI / fuzzing (push) Has been cancelled
Details
CI / codeql (push) Has been cancelled
Details
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
Details
CI / Publish main branch artifacts (push) Has been cancelled
Details
CI / Publish release artefacts (push) Has been cancelled
Details
CI / Publish UI on npm Registry (push) Has been cancelled
Details
promql: Re-introduce direct mean calculation
2025-06-27 14:57:12 +02:00
beorn7
ce809e625f
promql: Re-introduce direct mean calculation for better accuracy
...
This commit brings back direct mean calculation (for `avg` and
`avg_over_time`) but isn't an outright revert of #16569 . It keeps the
improved incremental mean calculation and features generally a bit
cleaner code than before.
Also, this commit...
- ...updates the lengthy comment explaining the whole situation and
trade-offs.
- ...divides the running sum and the Kahan compensation term
separately (in direct mean calculation) to avoid the (unlikely)
possibility that sum and Kahan compensation together ovorflow
float64.
- ...uncomments the tests that should now work again on darwin/arm64.
- ...uncomments the test that should now reliably yield the
(inaccurate) value 0 on all hardware platforms. Also, the test
description has been updated accordingly.
- ...adds avg_over_time tests for zero and one sample in the range.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-27 14:34:46 +02:00
beorn7
f71daa7977
promql: Remove falsified comment from test
...
The test in question actually worked fine even before #16569 . The
finding reported in the comment has turned out to be caused by
something else.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-27 14:34:46 +02:00
beorn7
2b3fc1f115
promql: Add test cases for direct mean calculation
...
These demonstrate that direct mean calculation has some merits after
all.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-27 14:34:46 +02:00
George Krajcsovits
5b7ff92d95
fix(promql): histogram_quantile and histogram_fraction NaN observed in native histogram ( #16724 )
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
* fix(promql): histogram_quantile NaN observed in native histogram
Fixes : #16578
See the issue for detailed explanation.
When a histogram had only NaN observations and no normal observations,
we returned 0 from the quantile, which is completely wrong. If there were
normal observations but we went over them, we returned the upper bound of
the existing buckets, however that contradicts expectations on
histogram_fraction. Now we return NaN if the quantile is calculated to be
over all normal observations, falling into NaNs (in a virtual +Inf bucket).
We also return info level annotations if we see any NaN observations.
The annotation calls out if we returned NaN or even if we took the
virtual +Inf bucket into account.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* fix(promql): histogram_fraction NaN observed in native histogram
Fixes : #16580
According to the specification we should not take NaN observations
into account when calculating the fraction. This commit fixes that
and adds an info level annotation to let the user know about this.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-06-25 13:37:43 +02:00
Björn Rabenstein
8ed37d3c09
Merge pull request #16744 from harry671003/fix_last_over_time
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
PromQL: Fix native histogram last_over_time
2025-06-23 00:56:08 +02:00
Kapil Lamba
030835560b
promqltest: add/remove explicit annotation expectations to relevant tests
...
Signed-off-by: Kapil Lamba <kapillamba4@gmail.com>
2025-06-21 18:46:50 +05:30
Kapil Lamba
658e9c5155
promqltest: migrate test files to new syntax using basic mode
...
Signed-off-by: Kapil Lamba <kapillamba4@gmail.com>
2025-06-21 18:46:33 +05:30
Kapil Lamba
69906bb4f5
Add script for converting PromQL tests to new syntax format ( #16562 )
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
Signed-off-by: Kapil Lamba <kapillamba4@gmail.com>
Co-authored-by: Neeraj Gartia <80708727+NeerajGartia21@users.noreply.github.com>
2025-06-18 23:57:39 +02:00
🌲 Harry 🌊 John 🏔
59bf3d442b
PromQL: Fix native histogram last_over_time with offset
...
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
2025-06-17 10:49:06 -07:00
Michael Hoffmann
ec98e7f069
promql: fix ts_of_last_over_time for histogram vectors
...
This PR fixes a bug in ts_of_last_over_time where the float samples
where used when computing the last timestamp of the histogram samples.
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
2025-06-16 13:09:49 +00:00
Julien
998840c496
Merge pull request #16713 from roidelapluie/fix-pow-dur-expr
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
promql: Fix unary operator precedence in duration expressions
2025-06-16 11:13:34 +02:00
Julien Pivotto
6d56e77e0e
promql: Fix unary operator precedence in duration expressions
...
Split unary operator handling in duration expressions into two specific
cases to fix precedence conflicts:
- Handle unary operators with number literals directly
- Handle unary operators with parenthesized expressions separately
This prevents unary minus from incorrectly binding to subsequent
operators in expressions like `foo offset -1^1`, ensuring it parses
as `(foo offset -1) ^ 1` rather than `foo offset (-1^1)`.
Fixes #16711
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-06-13 13:40:50 +02:00
Michael Hoffmann
a5fa9431d8
promql: add ts_of_(max,min,last)_over_time functions
...
This commit adds the ts_of_(max,min,last)_over_time functions behind the experimental feature flag.
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
2025-06-12 15:03:28 +00:00
beorn7
68b1bcc648
promql: typo fix in comment
...
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-10 22:06:04 +02:00
beorn7
c3da460474
promql: Deactivate three failing tests for the time being
...
These tests fail on darwin/arm64.
One is expected, because the test demonstrates the limits of the
numerical accuracy of our methods, and different inaccurate outcomes
on different hardware are expected.
The other two are mysterious at the moment, see
https://github.com/prometheus/prometheus/issues/16714 for detailed
discussion and debugging.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-10 21:48:52 +02:00
beorn7
64431830b8
Add more avg_over_time test cases with extreme values
...
These tests were initially created by @crush-on-anechka. I modified
them slightly.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-06 23:50:08 +02:00
Björn Rabenstein
41594cebb4
Merge pull request #16566 from prometheus/beorn7/promql
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
promqltest: Adjust more tests to "left-open" ranges
2025-06-05 16:45:38 +02:00
beorn7
a4d57fce74
promqltest: Adjust more tests to "left-open" ranges
...
This was an oversight because the old tests still happened to pass
with the new behavior, but important test data was excluded at the
left end of the interval, rendering some tests not actually testing
what we want to test.
In the past, we also applied different strategies to adjust the test
(extend the range from 1m to 2m, or set the evaluation timestamp to
45s). This commit unifies things and reduces redundancy.
Signed-off-by: beorn7 <beorn@grafana.com>
2025-06-05 14:06:51 +02:00
Bartlomiej Plotka
8e6b008608
feature: type-and-unit-labels (PROM-39 implementation) ( #16228 )
...
buf.build / lint and publish (push) Has been cancelled
Details
CI / Go tests (push) Has been cancelled
Details
CI / More Go tests (push) Has been cancelled
Details
CI / Go tests with previous Go version (push) Has been cancelled
Details
CI / UI tests (push) Has been cancelled
Details
CI / Go tests on Windows (push) Has been cancelled
Details
CI / Mixins tests (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
Details
CI / Check generated parser (push) Has been cancelled
Details
CI / golangci-lint (push) Has been cancelled
Details
CI / fuzzing (push) Has been cancelled
Details
CI / codeql (push) Has been cancelled
Details
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Details
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
Details
CI / Publish main branch artifacts (push) Has been cancelled
Details
CI / Publish release artefacts (push) Has been cancelled
Details
CI / Publish UI on npm Registry (push) Has been cancelled
Details
* feature: type-and-unit-labels (extended MetricIdentity)
Experimental implementation of https://github.com/prometheus/proposals/pull/39
Previous (unmerged) experiments:
* https://github.com/prometheus/prometheus/compare/main...dashpole:prometheus:type_and_unit_labels
* https://github.com/prometheus/prometheus/pull/16025
Signed-off-by: bwplotka <bwplotka@gmail.com>
feature: type-and-unit-labels (extended MetricIdentity)
Experimental implementation of https://github.com/prometheus/proposals/pull/39
Previous (unmerged) experiments:
* https://github.com/prometheus/prometheus/compare/main...dashpole:prometheus:type_and_unit_labels
* https://github.com/prometheus/prometheus/pull/16025
Signed-off-by: bwplotka <bwplotka@gmail.com>
* Fix compilation errors
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Lint
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Revert change made to protobuf 'Accept' header
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Fix compilation errors for 'dedupelabels' tag
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* Rectored into schema.Metadata
Signed-off-by: bwplotka <bwplotka@gmail.com>
* texparse: Added tests for PromParse
Signed-off-by: bwplotka <bwplotka@gmail.com>
* add OM tests.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* add proto tests
Signed-off-by: bwplotka <bwplotka@gmail.com>
* Addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* add schema label tests.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* fix tests.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* add promql tests.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* lint
Signed-off-by: bwplotka <bwplotka@gmail.com>
* Addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com>
---------
Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
2025-05-17 09:37:25 +00:00
Neeraj Gartia
8b0d33e5b2
promql: support variable scalar parameter in aggregations in range queries ( #16404 )
...
buf.build / lint and publish (push) Has been cancelled
Details
CI / Go tests (push) Has been cancelled
Details
CI / More Go tests (push) Has been cancelled
Details
CI / Go tests with previous Go version (push) Has been cancelled
Details
CI / UI tests (push) Has been cancelled
Details
CI / Go tests on Windows (push) Has been cancelled
Details
CI / Mixins tests (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
Details
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
Details
CI / Check generated parser (push) Has been cancelled
Details
CI / golangci-lint (push) Has been cancelled
Details
CI / fuzzing (push) Has been cancelled
Details
CI / codeql (push) Has been cancelled
Details
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Details
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
Details
CI / Publish main branch artifacts (push) Has been cancelled
Details
CI / Publish release artefacts (push) Has been cancelled
Details
CI / Publish UI on npm Registry (push) Has been cancelled
Details
This fixes the regression introduced in https://github.com/prometheus/prometheus/issues/15971 while preserving the performance improvements.
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-05-11 15:40:31 +02:00
Julien
59874fd89c
Merge pull request #16478 from KofClubs/range-vector-1001ms
...
buf.build / lint and publish (push) Waiting to run
Details
CI / Go tests (push) Waiting to run
Details
CI / More Go tests (push) Waiting to run
Details
CI / Go tests with previous Go version (push) Waiting to run
Details
CI / UI tests (push) Waiting to run
Details
CI / Go tests on Windows (push) Waiting to run
Details
CI / Mixins tests (push) Waiting to run
Details
CI / Build Prometheus for common architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for common architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (0) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (1) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (10) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (11) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (2) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (3) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (4) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (5) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (6) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (7) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (8) (push) Waiting to run
Details
CI / Build Prometheus for all architectures (9) (push) Waiting to run
Details
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
Details
CI / Check generated parser (push) Waiting to run
Details
CI / golangci-lint (push) Waiting to run
Details
CI / fuzzing (push) Waiting to run
Details
CI / codeql (push) Waiting to run
Details
CI / Publish main branch artifacts (push) Blocked by required conditions
Details
CI / Publish release artefacts (push) Blocked by required conditions
Details
CI / Publish UI on npm Registry (push) Blocked by required conditions
Details
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Details
promql: function selector sometimes misses a sample on dense samples
2025-05-08 12:02:10 +02:00
George Krajcsovits
f0471ff74b
Merge pull request #16552 from charleskorn/charleskorn/fix-16551
...
promql: don't emit a value from `histogram_fraction` or `histogram_quantile` if classic and native histograms are present at the same timestamp
2025-05-08 09:28:14 +02:00
Neeraj Gartia
a177376d72
fix promql-test error message and readme
...
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-05-05 23:23:35 +05:30
Charles Korn
2c0f02a702
promql: don't emit a value from `histogram_fraction` or `histogram_quantile` if classic and native histograms are present at the same timestamp
...
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-05-05 16:23:08 +10:00
Aman
26bddcf068
promql: histogram_stddev and histogram_stdvar should use arithmetic mean for custom buckets
...
Signed-off-by: amanycodes <amanycodes@gmail.com>
2025-04-24 14:48:58 +02:00
Zhang Zhanpeng
0658923bf0
fix conversion from time range in seconds to time duration at parser
...
Signed-off-by: Zhang Zhanpeng <zhangzhanpeng.zzp@alibaba-inc.com>
2025-04-24 16:29:33 +08:00
Michael Hoffmann
d6d9f97bac
promql: histogram_fraction for bucket histograms ( #16095 )
...
* promql: histogram_fraction for bucket histograms
This PR extends the histogram_fraction function to also work with classic bucket histograms. This is beneficial because it allows expressions like sum(increase(my_bucket{le="0.5"}[10m]))/sum(increase(my_total[10m])) to be written without knowing the actual values of the "le" label, easing the transition to native histograms later on.
It also feels natural since histogram_quantile also can deal with classic histograms.
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
* promql: histogram_fraction for bucket histograms
* Add documentation and reduce code duplication
* Fix a bug in linear interpolation between bucket boundaries
* Add more PromQL tests
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
* Update docs/querying/functions.md
Co-authored-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
---------
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-04-23 00:28:31 +02:00
Julien
f4ca1368ff
Merge pull request #16249 from roidelapluie/arythmetics
...
PromQL: allow arithmetic operations in durations in PromQL parser
2025-04-22 10:17:41 +02:00
David Leadbeater
e647f7954f
promtool: Add feature flags for promql features ( #16443 )
...
These are supported in the main prometheus binary but the feature flags
weren't supported in promtool.
Fixes #16412 .
Signed-off-by: David Leadbeater <dgl@dgl.cx>
2025-04-17 10:29:44 +01:00
Björn Rabenstein
ba8609fbd0
Merge pull request #16352 from NeerajGartia21/promql/subquery_patch
...
[BUG] PromQL: Return early when `endtime` < `startime`
2025-04-16 01:00:19 +02:00
Neeraj Gartia
f83e964231
fix NH load expression with incrementation more than once
...
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-04-05 23:37:39 +05:30
Julien Pivotto
7370d62acf
PromQL: allow arithmetic in durations in PromQL parser
...
Updated the parser to allow calculations in PromQL durations.
This enables durations in the form of:
rate(http_requests_total[10m+2s])
The computation of the calculations is done directly at the parse level and does not hit the PromQL Engine.
The lexer has also been updated and improved, in particular for subqueries.
Buxfix: rate(http_requests_total[0]) is no longer allowed.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-04-03 10:56:02 +02:00
Neeraj Gartia
6e51c2dbd6
[FEATURE] Promltest: support to test expectation annotations ( #15995 )
...
promqltest: add new expect lines for promql testing framework
---------
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-04-01 12:12:23 +02:00
Neeraj Gartia
9084c5247f
fix subquery bug
...
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-03-31 00:41:08 +05:30
Owen Williams
0bfbd462ac
Merge pull request #16080 from prometheus/owilliams/escapeconfig-00-cleanup
...
utf8: Remove support for legacy global validation setting
2025-03-13 14:21:09 -04:00
Owen Williams
94b43c5d4c
utf8: Remove support for legacy global validation setting
...
Global and Data Source configurations can specify legacy mode, but Prometheus now requires that the overall validation mode be set to UTF-8
Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-03-13 10:47:24 -04:00
Charles Korn
c88d0b0e0a
promql: return NaN from `irate()` if second-last sample is NaN ( #16199 )
...
promql: return NaN from `irate()` if either of last two samples is NaN
Signed-off-by: Charles Korn <charles.korn@grafana.com>
---------
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-03-13 15:06:17 +01:00