1407 Commits

Author SHA1 Message Date
Faustas Butkus
e43f1bafca
chore: fix rangeEval comment (#17607)
Signed-off-by: Faustas Butkus <faustas.butkus@chronosphere.io>
2025-11-25 09:06:30 +00:00
Andrew Hall
1193e63896
PromQL: Modify RatioSampler to expose more methods for the benefit of downstream projects (#17516)
Methods added:
- `SampleOffset(metric *labels.Labels) float64` to calculate the sample offset for a given label set.
- `AddRatioSampleWithOffset(ratioLimit, sampleOffset float64) bool` to find out whether a given sample offset falls within a given ratio limit.

The already existing method `AddRatioSample(ratioLimit float64, sample *Sample) bool` is now implemented as a simple combination of the two other methods. Exposing these methods helps downstream projects to re-use the implementations including easier testing.

Signed-off-by: Andrew Hall <andrew.hall@grafana.com>
2025-11-18 15:44:40 +01:00
zenador
c64dd612ef
PromQL: Fix bug with inconsistent results for queries with OR expression and EnableDelayedNameRemoval (#17161)
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: zenador <zenador@users.noreply.github.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-11-15 21:07:36 +01:00
Linas Medziunas
85150f9dec [PERF] PromQL: only reset labels builder when needed
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2025-11-13 11:37:53 +02:00
Bryan Boreham
37d153e5b5 [PERF] PromQL: Only look up operation name if we need it
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-11-12 12:05:25 +00:00
Linas Medžiūnas
f330ccaf2f
[PERF] PromQL: eliminate string-keyed maps in binary vector matching (#17131)
In this PR, we are eliminating expensive string-keyed (by signature) maps that are accessed for every sample processed. During preprocessing in rangeEval, we assign a unique number from 0 to n-1 to each of the n string signature values, and later only use this number as a label set signature.

Signed-off-by: Linas Medžiūnas <linasm@users.noreply.github.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2025-11-12 10:43:05 +00:00
Andrew Hall
cc23e3760d Allow for promql tests to compare expected fail message during query preparation
Signed-off-by: Andrew Hall <andrew.hall@grafana.com>
2025-11-11 17:03:35 +08:00
Julien
2605fc9984
Merge pull request #17479 from roidelapluie/roidelapluie/fixResetChanges
promql: fix resets/changes to return empty for anchored selectors when samples outside range
2025-11-10 11:43:06 +01:00
Ben Kochie
204249fcb5
Update golangci-lint (#17478)
* Update golangci-lint to v2.6.0
* Fixup various linting issues.
* Fixup deprecations.
* Add exception for `labels.MetricName` deprecation.

Signed-off-by: SuperQ <superq@gmail.com>
2025-11-05 13:47:34 +01:00
Julien Pivotto
554ea9ebfe promql: fix resets/changes to return empty for anchored selectors when samples outside range
The funcResets and funcChanges functions now correctly return no result when all float samples are at or before the range start for anchored selectors, consistent with the behavior of rate/increase functions.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-11-05 12:07:18 +01:00
Ben Kochie
48956f60d7
Update modernize (#17471)
Apply additional Go modernize tool improvements.

Signed-off-by: SuperQ <superq@gmail.com>
2025-11-04 05:13:49 +00:00
geogrego
58dbe927d5 docs: minor improvement for docs
Signed-off-by: geogrego <geogrego@outlook.com>
2025-10-29 14:42:14 +08:00
Julius Volz
5318689046
Merge pull request #17380 from roidelapluie/roidelapluie/fixat
promql/parser: Add string representation for AT token
2025-10-27 16:21:14 +01:00
Linas Medžiūnas
042fe9d6bd
promql: benchmark for join queries with more labels (#17130)
* promql: benchmark for join queries with more labels

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>

* Add benchmark case for GROUP_LEFT

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>

* Address PR feedback

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>

---------

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2025-10-24 13:08:01 +01:00
Linas Medžiūnas
20815562d2
[BUGFIX] PromQL: fix more slice indexing bugs in info function (#17199)
* [BUGFIX] PromQL: fix more slice indexing bugs in info function

---------

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2025-10-23 17:39:22 +02:00
zenador
87eb072c0a
Move unit tests for info function from go file to testdata (#17307)
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2025-10-23 11:47:42 +02:00
Linas Medžiūnas
b2e7938e25
[BUGFIX] PromQL: avoid panic parsing malformed info call (#17379)
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2025-10-23 09:42:19 +02:00
Julien Pivotto
8d4876f944 promql/parser: Add string representation for AT token
Add the "@" string representation for the AT token in ItemTypeStr map to
ensure proper token-to-string conversion.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-10-21 16:50:56 +02:00
Linas Medžiūnas
44df626620
promql (histograms): reconcile mismatched NHCB bounds (#17278)
Fixes #17255.

The implementation happens mostly in the Add and Sub method, but the reconciliation works for all relevant operations. For example, you can now `rate` over a range wherein the custom bucket boundaries are changing.

Any custom bucket reconciliation is flagged with an info-level annotation.

---------

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
Signed-off-by: Linas Medžiūnas <linasm@users.noreply.github.com>
2025-10-18 01:03:52 +02:00
Julius Volz
a3e404755b
Merge pull request #17354 from prometheus/fix-smoothed-anchored-formatting
Fix formatting of range vector selectors with smoothed/anchored modifier
2025-10-17 13:36:24 +02:00
Julius Volz
9d7d544be1 Disable extended range selector modifiers again after test run
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-10-17 12:30:57 +02:00
Julius Volz
b7c3a2194f Fix formatting of range vector selectors with smoothed/anchored modifier
The modifiers were already printed as part of the VectorSelector, so for:

`foo[5m] anchored`

...the output was:

`foo anchored[5m] anchored`

Similar to how it was already done for `@` and `offset`, I now removed these
modifiers in the copy of the vector selector that is used to print the matrix
selector. I also removed some unused code that restored the copy of the vector
selector after overwriting its fields. AFAICS there was no use in doing that,
since it was a copy already that would just be thrown away after printing, and
the original selector wasn't affected. I also removed an erroneous comment in
`atOffset()` where no actual copying took place and no fields were overwritten.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-10-17 12:23:53 +02:00
Julien Pivotto
99c926b810 promql: allow 'anchored' and 'smoothed' as metric and label names
Add ANCHORED and SMOOTHED keywords to the maybe_label and
metric_identifier rules in the parser grammar, allowing them
to be used as metric names and label names, similar to other
keywords like 'offset', 'step', and 'bool'.

This fixes an issue where expressions like `anchored{job="test"}`
and `sum by (smoothed) (some_metric)` would fail to parse.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-10-17 12:10:52 +02:00
beorn7
ad7d1aed99 Phase out native histogram feature flag
The detailed plan for this is laid out in
https://github.com/prometheus/prometheus/issues/16572 .

This commit adds a global and local scrape config option
`scrape_native_histograms`, which has to be set to true to ingest
native histograms.

To ease the transition, the feature flag is changed to simply set the
default of `scrape_native_histograms` to true.

Further implications:

- The default scrape protocols now depend on the
  `scrape_native_histograms` setting.
- Everywhere else, histograms are now "on by default".

Documentation beyond the one for the feature flag and the scrape
config are deliberately left out. See
https://github.com/prometheus/prometheus/pull/17232 for that.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-10-15 14:50:52 +02:00
beorn7
e80a3e1b21 promql: Check 1st histogram's CRH in sum_over_time
avg_over_time already correctly checked the counter reset hint fo all
histograms, but in sum_over_time, the 1st histogram was missed. In
both cases, the 1st histogram is processed outside the loop.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-10-14 00:56:07 +02:00
beorn7
ff49406cba promql: Expose bug of not checking 1st histogram for CRH
avg_over_time already correctly checked the counter reset hint fo all
histograms, but in sum_over_time, the 1st histogram was missed in the
loop. This commit exposes the bug in a test.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-10-14 00:52:23 +02:00
Bryan Boreham
1c58399160
PromQL: Speed up parsing of variadic functions (#17316)
* PromQL: Add benchmark case with variadic function

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* PromQL: Speed up parsing of variadic functions

Defer formatting of an error message until we hit an error.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

---------

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-10-10 09:16:33 +01:00
beorn7
51e0982c91 promql(histograms): Fix counter reset hint handling when aggregating
Fixes #17308.

As explained adding the warn-annotation about conflicting counter
reset hints doesn't happen consistently. Furthermore, because of
incremental mean calculation being used so far (which includes
subtraction), avg calculation always created gauge histograms.

The fix is to make Sub behave like Add WRT counter reset handling, and
then set the result of a subtraction to gauge explicitly in actual
PromQL subtraction (rather than using Sub for something else, like
incremental mean calculation). Also, track the presence of a
CounterReset hint and a NotCounterReset hint separately for the
entirety of aggregated histograms and create the warn-annotation based
on that.

As a minor fix, this commit also consistently creates the warn
annotation in aggregation to be about "aggregation" rather than
"subtraction" or "addition", because the latter are just internal
operations within the aggregation, which is not of interest for the
user.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-10-09 19:40:00 +02:00
Linas Medziunas
8caf1f1c41 [NHCB] Separate CustomBucketBoundsMatch from floatBucketsMatch
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2025-10-05 22:38:07 +03:00
Jan Fajerski
c9e0e36701
Add comments clarifying why promql.Querylogger exists (#17231)
And why we only have one implementation in this code base.

Fixes: https://github.com/prometheus/prometheus/issues/15869

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2025-09-26 15:33:09 +01:00
Julien
4199c2f45a
Add anchored and smoothed to vector selectors. (#16457)
* Add anchored and smoothed to vector selectors.

This adds "anchored" and "smoothed" keywords that can be used following a matrix selector.

"Anchored" selects the last point before the range (or the first one after the range) and adds it at the boundary of the matrix selector.

"Smoothed" applies linear interpolation at the edges using the points around the edges. In the absence of a point before or after the edge, the first or the last point is added to the edge, without interpolation.

*Exemple usage*

* `increase(caddy_http_requests_total[5m] anchored)` (equivalent of *caddy_http_requests_total - caddy_http_requests_total offset 5m* but takes counter reset into consideration)
* `rate(caddy_http_requests_total[step()] smoothed)`

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

* Update docs/feature_flags.md

Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com>
Signed-off-by: Julien <291750+roidelapluie@users.noreply.github.com>

* Smoothed/Anchored rate: Add more tests

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

* Anchored/Smoothed modifier: error out with histograms

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

---------

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien <291750+roidelapluie@users.noreply.github.com>
Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com>
2025-09-25 11:34:59 +02:00
Björn Rabenstein
d5cc5e2738
Merge pull request #17071 from prometheus/beorn7/tsdb
tsdb: Fix commit order for mixed-typed series
2025-09-18 13:55:31 +02:00
beorn7
385d2800c9 promqltest: Add regression test for mixed-sample commit order
Regression test for:
- https://github.com/prometheus/prometheus/issues/14172
- https://github.com/prometheus/prometheus/issues/15177

Test cases are by @krajorama, taken from commit
b48bc9dc7e2ac553528763297cca73014357d542 .

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-17 19:22:25 +02:00
Andrew Hall
aa922ce3b6
Added support for string literals and range results for instant queries in test scripting framework (#17055)
Signed-off-by: Andrew Hall <andrew.hall@grafana.com>
Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-09-16 12:28:19 +01:00
NamanParlecha
594f9d63a5
refactor(textparse): Introduce Variadic options in textParse.New (#17155)
* refactor(textparse): introduce ParserOptions struct for cleaner parser initialization

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(fuzz): update fuzzParseMetricWithContentType to use ParserOptions

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parser): simplify ParserOptions usage in tests and implementations

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parse): using variadic options

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parser): add fallbackType & SymbolTable to variadic options

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parser): private fields

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(scrape): compose parser options

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parser): add comments

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parser): update to use ParserOptions struct for configuration

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(scrape): remove unused parserOptions field from scrapeLoop

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

* refactor(parser): update ParserOptions field names and add comments for clarity

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>

---------

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
2025-09-11 10:49:42 +01:00
beorn7
0fa70e0f6c promql: Use HistogramStatsIterator more often
The current code stops the walk after we have found the first relevant
function. However, in expressions with multiple legs, we will then use
the `HistogramStatsIterator` at most once. This change should make
sure we explore all legs.

The added tests make sure we are not using `HistogramStatsIterator`
where we shouldn't (but the opposite can only be seen in a benchmark
or with a more explicit test).

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-09 16:09:22 +02:00
beorn7
c84cf3622f promql: Add a two-legged benchmark for HistogramStatsIterator
Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-09 16:08:10 +02:00
Björn Rabenstein
fda99c6b35
Merge pull request #17127 from prometheus/beorn7/histogram2
Fix and optimize `HistogramStatsIterator` usage
2025-09-09 15:52:49 +02:00
beorn7
121de76cbb promqltest: Remove now needless 1* work-around
Prior to #17127, we needed to add another level in the AST to trigger
the usage of `HistogramStatsIterator`. This is fixed now.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-09 14:59:15 +02:00
beorn7
48c6c1a692 promql: Make HistogramStatsIterator.AtFloatHistogram idempotent
Previously, multiple calls returned a wrong counter reset hint.

This commit also includes a bunch of refactorings that partially have
value on their own. However, the need for them was triggered by the
additional work needed for idempotency, so I included them in this
commit.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-09 14:59:15 +02:00
George Krajcsovits
31e4d84edd
refactor(textparse): allow for parsers with direct NHCB support (#17153)
Hide adding NHCB parser on top another parser in New() function
so we can easily add direct NHCB capable parsers.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-09-06 11:45:44 +02:00
Linas Medžiūnas
5c2e43f09c
[BUGFIX] PromQL: fix slice indexing bug in info function (#17135)
* [BUGFIX] PromQL: fix slice indexing bug in info function

---------

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
Signed-off-by: Linas Medžiūnas <linasm@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-09-05 14:46:57 +02:00
Bryan Boreham
1cd746ebfb
Merge pull request #17067 from prometheus/faster-promql-printer
[PERF] PromQL: Speed up PromQL to string conversion
2025-09-04 13:41:21 +01:00
beorn7
0746f388b0 promql: Fix HistogramStatsIterator usage for subqueries
Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-04 14:36:56 +02:00
beorn7
4e94ee0109 promqltest: Add test to demonstrate sub-query bug with HistogramStatsIterator
To fix this, we need to make sure that HistogramStatsIterator is not
used with a sub-query in the path.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-04 14:33:28 +02:00
beorn7
0cef66b12a promql: Forget lastFH in HistogramStatsIterator after Seek
After an effective Seek, the lastFH isn't the lastFH anymore, so we
should nil it out.

In practice, this should only matter is sub-queries, because we are
otherwise not interested in a counter reset of the first sample
returned after a Seek.

Sub-queries, on the other hand, always do their own counter reset
detection. (For that, they would prefer to see the whole histogram, so
that's another problem for another commit.)

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-04 14:07:16 +02:00
beorn7
5010bd4bb1 promql: Optimize HistogramStatsIterator by disallowing integer histograms
The `HistogramStatsIterator` is only meant to be used within PromQL.
PromQL only ever uses float histograms. If `HistogramStatsIterator` is
capable of handling integer histograms, it will still be used, for
example by the `BufferedSeriesIterator`, which buffers samples and
will use an integer `Histogram` for it, if the underlying chunk is an
integer histogram chunk (which is common).

However, we can simply intercept the `Next` and `Seek` calls and
pretend to only ever be able te return float histograms. This has the
welcome side effect that we do not have to handle a mix of float and
integer histograms in the `HistogramStatsIterator` anymore.

With this commit, the `AtHistogram` call has been changed to panic so
that we ensure it is never called.

Benchmark differences between this and the previous commit:

name                                                                       old time/op    new time/op    delta
NativeHistograms/histogram_count_with_short_rate_interval-16                  837ms ± 3%     616ms ± 2%  -26.36%  (p=0.008 n=5+5)
NativeHistograms/histogram_count_with_long_rate_interval-16                   1.11s ± 1%     0.91s ± 3%  -17.75%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_short_rate_interval-16     751ms ± 6%     581ms ± 1%  -22.63%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_long_rate_interval-16      1.13s ±11%     0.85s ± 2%  -24.59%  (p=0.008 n=5+5)

name                                                                       old alloc/op   new alloc/op   delta
NativeHistograms/histogram_count_with_short_rate_interval-16                  531MB ± 0%     148MB ± 0%  -72.08%  (p=0.008 n=5+5)
NativeHistograms/histogram_count_with_long_rate_interval-16                   528MB ± 0%     145MB ± 0%  -72.60%  (p=0.016 n=5+4)
NativeHistogramsCustomBuckets/histogram_count_with_short_rate_interval-16     452MB ± 0%     145MB ± 0%  -67.97%  (p=0.016 n=5+4)
NativeHistogramsCustomBuckets/histogram_count_with_long_rate_interval-16      452MB ± 0%     141MB ± 0%  -68.70%  (p=0.016 n=5+4)

name                                                                       old allocs/op  new allocs/op  delta
NativeHistograms/histogram_count_with_short_rate_interval-16                  8.95M ± 0%     1.60M ± 0%  -82.15%  (p=0.008 n=5+5)
NativeHistograms/histogram_count_with_long_rate_interval-16                   8.84M ± 0%     1.49M ± 0%  -83.16%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_short_rate_interval-16     5.96M ± 0%     1.57M ± 0%  -73.68%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_long_rate_interval-16      5.86M ± 0%     1.46M ± 0%  -75.05%  (p=0.016 n=5+4)

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-04 14:06:19 +02:00
beorn7
87d7c12563 promql: Fix trigger for HistogramStatsIterator
PR #16702 introduced a regression because it was too strict in
detecting the condition for using the `HistogramStatsIterator`. It
essentially required the triggering function to be buried at least one
level deep.

`histogram_count(sum(rate(native_histogram_series[2m]))` would not
trigger anymore, but
`1*histogram_count(sum(rate(native_histogram_series[2m]))` would.

Ironically, PR #16682 made the performance of the
`HistogramStatsIterator` so much worse that _not_ using it was often
better, but this has to be addressed in a separate commit.

This commit reinstates the previous `HistogramStatsIterator` detection
behavior, as PR #16702 intended to keep it.

Relevant benchmark changes with this commit (i.e. old is without using
`HistogramStatsIterator`, new is with `HistogramStatsIterator`):

name                                                                       old time/op    new time/op    delta
NativeHistograms/histogram_count_with_short_rate_interval-16                  802ms ± 3%     837ms ± 3%    +4.42%  (p=0.008 n=5+5)
NativeHistograms/histogram_count_with_long_rate_interval-16                   1.22s ± 3%     1.11s ± 1%    -9.46%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_short_rate_interval-16     611ms ± 5%     751ms ± 6%   +22.87%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_long_rate_interval-16      975ms ± 4%    1131ms ±11%   +16.04%  (p=0.008 n=5+5)

name                                                                       old alloc/op   new alloc/op   delta
NativeHistograms/histogram_count_with_short_rate_interval-16                  222MB ± 0%     531MB ± 0%  +139.63%  (p=0.008 n=5+5)
NativeHistograms/histogram_count_with_long_rate_interval-16                   323MB ± 0%     528MB ± 0%   +63.81%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_short_rate_interval-16     179MB ± 0%     452MB ± 0%  +153.07%  (p=0.016 n=4+5)
NativeHistogramsCustomBuckets/histogram_count_with_long_rate_interval-16      175MB ± 0%     452MB ± 0%  +157.73%  (p=0.016 n=4+5)

name                                                                       old allocs/op  new allocs/op  delta
NativeHistograms/histogram_count_with_short_rate_interval-16                  4.48M ± 0%     8.95M ± 0%   +99.51%  (p=0.008 n=5+5)
NativeHistograms/histogram_count_with_long_rate_interval-16                   5.02M ± 0%     8.84M ± 0%   +75.89%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_short_rate_interval-16     3.00M ± 0%     5.96M ± 0%   +98.93%  (p=0.008 n=5+5)
NativeHistogramsCustomBuckets/histogram_count_with_long_rate_interval-16      2.89M ± 0%     5.86M ± 0%  +102.69%  (p=0.016 n=4+5)

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-04 13:57:31 +02:00
Björn Rabenstein
5b153f80a5
Merge pull request #17094 from prometheus/beorn7/histogram
promql: Fix when to emit a HistogramCounterResetCollisionWarning
2025-09-04 13:55:41 +02:00
beorn7
53a720eed5 promql: Minor improvements for HistogramStatsIterator
- Add a code comment about a counter reset edge case (which is
  hopefully not relevant in practice).

- Rename the receiver from `f` to `hsi`. (`f` seemed like completely
  off as a name. `i` or `it` might have worked, too, but I ended up
  with `hsi` as the easiest for the reader.)

Signed-off-by: beorn7 <beorn@grafana.com>
2025-09-03 18:00:03 +02:00