prometheus/util
George Krajcsovits 5b7ff92d95
fix(promql): histogram_quantile and histogram_fraction NaN observed in native histogram (#16724)
* 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
..
almost [COMMENT] Improve comment on almost.Equal; add tests 2024-08-30 10:13:00 +01:00
annotations fix(promql): histogram_quantile and histogram_fraction NaN observed in native histogram (#16724) 2025-06-25 13:37:43 +02:00
compression Add util/compression package to consolidate snappy/zstd use in Prometheus. (#16156) 2025-03-10 10:36:26 +00:00
convertnhcb Set hasCount after setting count to be consistent 2024-11-26 13:56:22 +01:00
documentcli Standardize doc page title handling 2025-05-28 21:37:27 +02:00
fmtutil chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
gate Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
httputil util/httputil: Always add Vary header in SetCORS 2025-05-19 11:42:44 +02:00
jsonutil Name float values as "floats", not as "values" 2023-04-13 19:25:24 +02:00
junitxml promtool: JUnit-Format XML Test Results (#14506) 2024-07-29 21:28:08 +10:00
logging Bump prometheus/common to v0.63.0 (#16210) 2025-03-13 20:42:42 +01:00
netconnlimit Add support for multiple listening addresses 2024-08-20 13:09:16 +02:00
notifications Move notifications in utils 2024-10-04 10:11:56 +02:00
osutil Format Go source files using 'gofumpt -w -s -extra' 2021-11-02 19:52:34 +01:00
pool Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
runtime chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
runutil Append Created Timestamps (#12733) 2023-12-11 08:43:42 +00:00
stats Export QuerySamples StartTimestamp and Interval to enable custom statistics implementations to populate these fields as needed. 2025-06-06 15:31:37 +08:00
strutil Fix linting issues found by golangci-lint v2.0.2 (#16368) 2025-05-03 19:05:13 +02:00
teststorage TSDB: Fix some edge cases when OOO is enabled (#14710) 2024-10-23 17:34:28 +02:00
testutil Signed-off-by: crystalstall <crystalruby@qq.com> 2025-01-11 00:41:51 +08:00
treecache chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
zeropool chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00