Bartlomiej Plotka
b53d7386d0
Merge pull request #17159 from linasm/optimize-join-performance-5
...
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 / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (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
[PERF] PromQL: replace maps with slices and reuse matching data structures in VectorBinop/And/Or/Unless
2026-02-25 13:50:31 +00:00
Linas Medžiūnas
c317f9254e
chore(histogram): Move histogram trimming code out of engine.go ( #18185 )
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-25 09:10:42 +01:00
George Krajcsovits
5d3f9ee39b
Merge pull request #17904 from linasm/trim_histogram
...
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 / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (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
promql: Implement </ and >/ operators for trimming native histograms
2026-02-24 17:16:24 +01:00
Björn Rabenstein
b2e63376da
Merge pull request #18105 from mmorel-35/staticcheck
...
chore: enable staticcheck linter and update golangci-lint to 2.10.1
2026-02-19 12:44:00 +01:00
Linas Medžiūnas
5bd0d00f8c
PromQL: Add experimental histogram_quantiles variadic function ( #17285 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (push) Has been cancelled
CI / Build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: beorn7 <beorn@grafana.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: beorn7 <beorn@grafana.com>
2026-02-18 17:32:29 +01:00
Matthieu MOREL
addc3dcb47
chore: enable staticcheck linter and update golangci-lint to 2.10.1
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2026-02-18 15:58:16 +00:00
Linas Medziunas
38a7befa14
Add test case with join
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-18 15:49:23 +02:00
Linas Medziunas
c753252028
Update/fix test comments
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-18 15:38:27 +02:00
Julien Pivotto
7d0a39ac93
chore(lint): enable wg.Go
...
Since our minimum supported go version is now go 1.25, we can use wg.Go.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-17 15:21:51 +01:00
Linas Medziunas
a448a5cfbf
Use matching.Card == parser.CardOneToOne for slice selection
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-17 13:55:34 +02:00
zenador
8937cbd395
promql: info function: support multiple name matchers ( #17968 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (push) Has been cancelled
CI / Build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
* Add new test cases for multiple name matchers in PromQL info function
* Fix handling of multiple name matchers in PromQL info function
---------
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-02-13 17:22:58 +01:00
Linas Medziunas
86248a5ceb
Fix for nhcb +Inf bucket
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-13 16:43:25 +02:00
Linas Medziunas
c657e859e3
Fix for nhcb [-Inf; -x) bucket
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-13 16:21:12 +02:00
Linas Medziunas
9a6c170d15
Fix midpoint of NHCB 1st bucket
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-13 15:39:42 +02:00
Linas Medziunas
538ad96136
Don't use extra digits in expected float values
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-13 15:39:27 +02:00
Dan Cech
32922edd7b
enable experimental functions in promql benchmarks
...
Signed-off-by: Dan Cech <dcech@grafana.com>
2026-02-12 18:40:14 -05:00
Björn Rabenstein
b84d7dcc56
Merge pull request #18058 from zenador/fix-avg-over-time-nh
...
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 (push) Waiting to run
CI / Build Prometheus for all architectures (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
promql: fix avg_over_time for single native histogram
2026-02-11 12:42:27 +01:00
Martin Valiente Ainz
eb5a0e1eed
Refactor parse.go into an instance-based Parser interface
...
Signed-off-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
2026-02-11 11:21:49 +01:00
Martin Valiente Ainz
539936c861
Replace per-component parser options with default instance
...
Signed-off-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
2026-02-11 11:16:04 +01:00
Martin Valiente Ainz
af16f35ad6
PromQL: Refactor parser to use instance configuration instead of global flags
...
Parser configuration is now per-engine/API/loader and no longer uses package-level flags, so behavior is consistent and tests don't rely on save/restore of global variables.
Signed-off-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
2026-02-11 11:16:04 +01:00
Jeanette Tan
d2bb5605dc
promql: Fix avg_over_time for single histogram
...
avg_over_time would produce +Inf count/sum and NaN zero bucket when
averaging a single histogram, because the count variable was initialized
to 0 instead of 1. This caused a division by zero at the end of the
function.
The float version of avg_over_time already correctly initializes count
to 1, this change makes the histogram version consistent with that.
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-02-11 05:06:53 +08:00
Jeanette Tan
9fddb70b8c
promql: Add test case for avg_over_time single histogram fix
...
Add regression test for the bug where avg_over_time with a single
histogram sample would produce +Inf count/sum and NaN zero bucket
due to division by zero. The test verifies that both regular
exponential histograms and native histograms with custom buckets
(NHCB) correctly return the histogram unchanged when averaging
a single sample.
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-02-11 05:06:53 +08:00
Linas Medziunas
0615b6af4f
Handle zero_bucket_only case (plus more tests)
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-10 16:02:01 +02:00
Linas Medziunas
5c49187719
Fix NHCB first bucket handling
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-10 14:37:13 +02:00
Linas Medziunas
34f71ba96f
Detect more noop trimmings
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-10 14:32:30 +02:00
Linas Medziunas
b3066144d1
Add test cases trimming a biased zero bucket
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-10 13:42:24 +02:00
Linas Medziunas
16c801d04e
Change interpolation within zero bucket
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-09 17:40:23 +02:00
Sasha
1dcdb07d30
promql: use Kahan summation for Native Histograms ( #15687 )
...
As for float samples, Kahan summation is used for the `sum` and `avg` aggregation and for the respective `_over_time` functions.
Kahan summation is not perfect. This commit also adds tests that even Kahan summation cannot reliably pass.
These tests are commented out.
Note that the behavior might be different on other hardware platforms. We have to keep an eye on test failing on other hardware platforms and adjust them accordingly.
Signed-off-by: Aleksandr Smirnov <5targazer@mail.ru>
2026-02-08 00:52:22 +01:00
Linas Medziunas
a3a52004ba
Update native_histograms.test following the feedback
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-06 13:41:51 +02:00
Julien
eaf47798af
promql: fix panic with @ modifier on empty ranges ( #18020 )
...
When using the @ modifier with a timestamp that has no data, several
PromQL range functions were panicking with "index out of range [0]
with length 0". This was introduced by #16797 which changed function
signatures to use concrete types instead of interfaces.
The panic occurred because functions were accessing array elements
(matrixVal[0], vectorVals[0][0]) without checking if the arrays were
empty first.
Fixes #18018
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-06 08:30:15 +00:00
zenador
4321a5573c
Use custom annotation for histogram quantile monotonicity info to provide more details ( #15578 )
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-02-05 18:35:48 +01:00
Bryan Boreham
02c68154bc
Merge pull request #17548 from linasm/improve-BenchmarkJoinQuery
...
PromQL: Improve BenchmarkJoinQuery
2026-02-03 11:53:08 +00:00
Linas Medziunas
35aba0bbde
Compute resulting sum based on surviving buckets
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-02-02 15:46:32 +02:00
Julien Pivotto
55193c3058
promql: fix smoothed interpolation across counter resets
...
Fix incorrect interpolation when counter resets occur in smoothed range
selector evaluation. Previously, the asymmetric handling of counter
resets (y1=0 on left edge, y2+=y1 on right edge) produced wrong values.
Now uniformly set y1=0 when a counter reset is detected, correctly
modeling the counter as starting from 0 post-reset.
This fixes rate calculations across counter resets. For example,
rate(metric[10s] smoothed) where metric goes from 100 to 10 (a reset)
now correctly computes 0.666... by treating the counter as resetting
to 0 rather than producing inflated values from the old behavior.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-02 11:54:35 +01:00
Linas Medziunas
b69ec3f39c
Only track signs of surviving buckets
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-01-28 15:11:10 +02:00
Linas Medziunas
e6c07126a6
Midpoint of negative bucket must be negative
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-01-28 15:07:24 +02:00
Linas Medziunas
cde7bbf9e7
[PERF] PromQL: reuse matching data structures in VectorBinop/And/Or/Unless
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-01-28 09:39:30 +02:00
beorn7
b812c6457d
promqltest: Document testing for counter reset hints in histograms
...
Signed-off-by: beorn7 <beorn@grafana.com>
2026-01-27 14:53:38 +01:00
Linas Medziunas
d0b7fe402f
Edge test cases with Exponential Histogram
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-01-27 11:17:26 +02:00
Linas Medziunas
001fc1bfea
Handle infinity buckets conservatively
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-01-27 09:37:27 +02:00
Arve Knudsen
65f8482335
fix(promql): prevent panic in trimStringByBytes on invalid UTF-8
...
Add bounds check to prevent index out of range panic when
trimStringByBytes receives a string containing only UTF-8 continuation
bytes (0x80-0xBF). Previously, the loop would decrement size below 0
when no valid rune start byte was found, causing a panic.
A malicious query string with only continuation bytes could crash
the Prometheus server via the ActiveQueryTracker before the query
was parsed or validated.
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2026-01-24 16:06:42 +01:00
Bartlomiej Plotka
0d116b0994
tests(teststorage): Close Storage in the helper ( #17902 )
...
Signed-off-by: bwplotka <bwplotka@gmail.com>
2026-01-23 08:41:35 +00:00
zenador
9a49316c59
promql: info function: fix unit test for ignoring info metrics themselves ( #17911 )
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-01-22 15:24:41 +01:00
Björn Rabenstein
82fec75982
Merge pull request #17626 from aviralgarg05/fix-promqltest-counter-reset-hint-comparison
...
promqltest: Add optional counter reset hint comparison for native histograms
2026-01-22 15:03:20 +01:00
Linas Medziunas
25bd93f9ef
Address PR comments
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2026-01-22 15:41:02 +02:00
sujal shah
8528d5c446
promql: Implement </ and >/ operators for trimming native histograms.
...
This implements the TRIM_UPPER (</) and TRIM_LOWER (>/) operators
that allow removing observations below or above a threshold from
a histogram. The implementation zeros out buckets outside the desired
range. It also recalculates the sum, including only bucket counts within
the specified threshold range.
Fixes #14651 .
Signed-off-by: sujal shah <sujalshah28092004@gmail.com>
2026-01-22 15:22:47 +02:00
sujal shah
e8bfcfcf1a
promql: Implement </ and >/ operators for trimming native histograms.
...
This implements the TRIM_UPPER (</) and TRIM_LOWER (>/) operators
that allow removing observations below or above a threshold from
a histogram. The implementation zeros out buckets outside the desired
range. It also recalculates the sum, including only bucket counts within
the specified threshold range.
Fixes #14651 .
Signed-off-by: sujal shah <sujalshah28092004@gmail.com>
2026-01-22 15:22:43 +02:00
Bartlomiej Plotka
04a3ef75f2
chore: remove testutil.T which is no longer needed since Go 1.13 ( #17903 )
...
testutil.T was needed before https://go.dev/doc/go1.13#testingpkgtesting
Now it's inconsistent and confusing, so let's kill it.
Signed-off-by: bwplotka <bwplotka@gmail.com>
2026-01-21 13:02:58 +00:00
zenador
e3b6eee437
promql: info function: fix series without identifying labels not being returned ( #17898 )
...
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 (push) Waiting to run
CI / Build Prometheus for all architectures (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
* promql: info function: fix series without identifying labels not being returned
---------
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-01-20 16:53:27 +01:00
Julius Volz
1d3d98ed16
Merge pull request #17644 from prometheus/binop-fill-modifier
...
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 (push) Waiting to run
CI / Build Prometheus for all architectures (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
PromQL: Add `fill*()` binop modifiers to provide default values for missing series
2026-01-19 20:05:52 +01:00