Commit Graph

1238 Commits

Author SHA1 Message Date
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
Arve Knudsen
56929ffa42 Upgrade to Go v1.24 (#16180)
* Upgrade to Go v1.24
* Upgrade golangci-lint

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-03-07 11:28:26 +01:00
Giuliano Panzironi
2ef8706c27
fix: format float to avoid overflow (#16083)
Signed-off-by: giulianopz <panzironi.giuliano@gmail.com>
2025-03-03 09:03:45 +00:00
co63oc
0e4e5a71bd
Fix typos (#16076)
Signed-off-by: co63oc <co63oc@users.noreply.github.com>
2025-02-28 11:24:25 +11:00
Björn Rabenstein
7bbbb5cb97
Merge pull request #16006 from mmorel-35/revive/unused-parameter
chore: enable unused-parameter from revive
2025-02-21 13:56:04 +01:00
Charles Korn
8356990709
promql: fix double quoting in invalid label name error from count_values (#16054)
promql: fix double quoting in invalid label name error from `count_values`

---------

Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Charles Korn <charleskorn@users.noreply.github.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-02-21 00:37:04 +01:00
Björn Rabenstein
fcc8e49d65
Merge pull request #16018 from charleskorn/charleskorn/quantile_over_time-annotation
promql: emit correct annotation in `quantile_over_time` when run over a range with histograms and floats
2025-02-20 22:49:30 +01:00
Matthieu MOREL
c7d4b53ec1 chore: enable unused-parameter from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-19 19:50:28 +01:00
Charles Korn
0964b6e584
promql: emit correct annotation in quantile_over_time when run over a range with histograms and floats
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-12 16:46:57 +11:00
Björn Rabenstein
906f6a33b6
Merge pull request #15987 from prometheus/beorn7/histogram
promql: Fix counter reset detection in subqueries with histograms
2025-02-11 20:41:19 +01:00
beorn7
14bb63c467 promql: Fix counter reset detection in subqueries with histograms
Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-11 20:04:10 +01:00
beorn7
6518941d73 promql: Expose problem with histogram counter resets in subquery
Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-11 20:04:10 +01:00
Matthieu MOREL
b472ce7010 chore: enable early-return from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-10 22:08:43 +01:00
Neeraj Gartia
20371118b6
[FIX] PromQL: Ignore histograms in scalar, sort and sort_desc functions (#15964)
PromQL: Ignore histograms in scalar, sort and sort_desc functions

---------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-02-06 16:02:03 +01:00
Björn Rabenstein
cb096a8ea8
Merge pull request #15902 from prometheus/beorn7/promql
promql: fix rate calculation with a counter reset after the 1st sample
2025-02-05 22:10:45 +01:00
Björn Rabenstein
fa1bd02c99
Merge pull request #15974 from jhesketh/jhesketh/utf-label-replace
Allow UTF-8 labels in label_replace
2025-02-05 20:49:36 +01:00
Joshua Hesketh
5a5fdea7ad
Fix duplicate output vector if delayed name removal is disabled (#15975)
Fix duplicate output vector if delayed name removal is disabled

This error is emitted in cleanupMetricLabels, but is skipped if
enableDelayedNameRemoval is false.

This makes it consistent with label_replace

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>

---------

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-02-05 16:40:23 +01:00
Joshua Hesketh
5be3197701 Update the test to invalid utf-8
"invalid-label-name" is valid in utf-8 mode

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
2025-02-05 23:08:24 +11:00
Joshua Hesketh
e4037b3ec3 Allow UTF-8 labels in label_replace
This makes it consistent with label_join.

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
2025-02-05 22:24:13 +11:00
Charles Korn
69ce0c24db
Fix issue
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-05 11:48:47 +11:00
Charles Korn
2fc6ba1c94
Expand TestInstantQueryWithRangeVectorSelector to include histograms
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-05 11:45:16 +11:00
Charles Korn
026d0198d5
Add unit tests
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-05 11:40:54 +11:00
Neeraj Gartia
8be416a67c
[FIX] PromQL: Updates annotation for bin op between incompatible histograms (#15895)
PromQL: Updates annotation for bin op between incompatible histograms

---------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-02-01 22:57:29 +01:00
Neeraj Gartia
130cd024e0
[FEATURE] PromQL: Implements idelta and irate with histograms (#15853)
Add native histogram support to idelta and irate functions

---------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-01-31 23:11:03 +01:00
beorn7
9f6c1d9cd3 promqltest: Small formatting improvement for native histograms
A `HistogramTestExpression` was missed in one case, which made the
formatting weird in case a histogram got unexpectedly returned.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-01-29 17:26:08 +01:00
beorn7
2581c7d057 promql: fix rate calculation with a counter reset after the 1st histogram
If a rate (or increase) is calculated on native histograms, and there
is a counter reset between the 1st and 2nd histogram, we never have to
touch the 1st histogram, so it doesn't even matter if it has an
incompatible bucket layout. So we should not error out in that case.

This simply nulls out the 1st histogram in that case.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-01-29 15:42:47 +01:00
Jan Fajerski
d734afab4d
Merge pull request #15870 from NeerajGartia21/promql/func_over_time
PromQL: Adds tests for `sum_over_time` and `avg_over_time` with histograms
2025-01-28 15:52:09 +01:00
Neeraj Gartia
b9fcc81695 adds tests for timestamp()
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-01-28 02:10:36 +05:30
Neeraj Gartia
21afc0beb4 adds tests for sum_over_time and avg_over_time
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-01-28 02:05:30 +05:30
Jan Fajerski
54cf0d6879
Merge pull request #15472 from tjhop/ref/jsonfilelogger-slog-handler
ref: JSONFileLogger slog handler, add scrape.FailureLogger interface
2025-01-27 20:17:46 +01:00
Björn Rabenstein
2915b19773
Merge pull request #15859 from prometheus/krajo/abs-test
test(promql): abs function on native histograms
2025-01-25 00:33:37 +01:00
György Krajcsovits
9097f8f4e7 test(promql): some functions silently ignore native histograms
Functions that silently ignore native histograms, not covered by existing
tests: abs(), ceil(), clamp(), clamp_min(), clamp_max(), floor(), round().

Ref: https://github.com/prometheus/prometheus/pull/15845

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-01-24 11:16:20 +01:00
Björn Rabenstein
8846e42528
Merge pull request #15849 from linasm/use-histogram-stats-decoder-for-histogram_avg
promql: use histogram stats decoder for histogram_avg
2025-01-23 15:03:01 +01:00
Linas Medziunas
940016e002 promql: use histogram stats decoder for histogram_avg
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2025-01-23 08:49:47 +02:00
Joshua Hesketh
665d1ba0cc
Ensure metric name is present on histogram_quantile annotations (#15828)
Ensure metric name is present on histogram_quantile annotations

Previously the series __name__ label was dropped before the annotation
was emitted causing the annotation message to have a blank value.

This fix also allows delayed name removal for classic histograms.

This also adds a test for malformed le label

This annotation could be split into two to be clearer for the user
(one for missing, and one for malformed). This is outside of the scope
of this change.

Fixes: #15411

---------

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-01-22 14:35:43 +01:00
Mikel Olasagasti Uranga
9258e40589
parser: fix non-constant format string call (#15835)
Go 1.24 enhanced vet's printf analyzer to report calls of the form
fmt.Printf(s), where s is a non-constant format string, with no other
arguments. This change makes parser tests to fail.

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2025-01-18 13:21:51 +01:00
Fiona Liao
f46b984dd1
Add additional incompatible nhcb schemas tests for functions and comparison operators (#15813)
promql: Add additional incompatible nhcb schemas tests for functions and comparison operators

* Add agg_over_time tests for nhcb with incompatible schemas
* Add more function and comparison operator tests

---------

Signed-off-by: Fiona Liao <fiona.liao@grafana.com>
2025-01-17 17:17:11 +01:00
Owen Williams
7be00791ef
Merge pull request #15806 from prometheus/owilliams/error
parser: fix misleading error message in grouping processing
2025-01-14 10:21:55 -05:00
Owen Williams
47563d942e parser: fix misleading error message in grouping processing
Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-01-10 15:23:33 -05:00
Arve Knudsen
f030894c2c
Fix issues raised by staticcheck (#15722)
Fix issues raised by staticcheck

We are not enabling staticcheck explicitly, though, because it has too many false positives.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-01-09 17:51:26 +01:00
Neeraj Gartia
b3e30d52ce
[BUGFIX] PromQL: Fix <aggr_over_time> functions with histograms (#15711)
fix aggr_over_time with histograms

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>

---------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-01-09 16:38:42 +01:00
Fiona Liao
9d6f88cb73
Add additional tests for operators over incompatible nhcb (#15787)
* Add additional tests for operators over incompatible nhcb

Signed-off-by: Fiona Liao <fiona.liao@grafana.com>
2025-01-09 10:29:57 +01:00
beorn7
d9a80a91e3 docs: Document eval_warn and eval_info
This also improves the documentation in the following ways:

- Clarifies that `eval` requires no annotations.

- Clarifies that `eval_ordered` ignores annotations.

- Clarifies that `eval_ordered` does not work with matrix returns
  (which could very well be created by instant queries).

- Clarifies that there are more `eval` commands than just `eval`.

- Improves wording for `eval_ordered`.

- Replaces `...` by the typographical correct `…`.

- Fixes a numerical error in an example.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-01-08 13:57:13 +01:00
beorn7
7687661453 promqltest: make eval_ordered ignore annotations
Besides making eval_ordered ignore annotations, this does the following:

- Adds a test to verify that eval_ordered indeed ignores an info
  annotations now, while eval complains about it, eval_info recognizes
  it and, eval_warn flags the missing of the warn annotation.

- Refactors the annotation check into its own method.

- Moves closing of the query to the appropriate place where it wasn't
  so far.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-01-08 12:55:27 +01:00
machine424
9823a93c42
fix(main.go): avoid closing the query engine until it is guaranteed to no longer be in use.
partially reverts https://github.com/prometheus/prometheus/pull/14064

fixes https://github.com/prometheus/prometheus/issues/15232

supersedes https://github.com/prometheus/prometheus/pull/15533

reusing Engine.Close() outside of tests will require more consideration.

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2024-12-30 05:14:44 +01:00
beorn7
f7373a1f91 PromQL: improve some test comments
This amends #15686.

Signed-off-by: beorn7 <beorn@grafana.com>
2024-12-19 23:56:37 +01:00
Neeraj Gartia
8d5236f927
PromQL: Adds tests for delta with histograms (#15674)
PromQL: Adds tests for delta with histograms

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>

--------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-12-19 23:52:26 +01:00
Neeraj Gartia
0e99ca3e8c
[BUGFIX] PromQL: Fix deriv, predict_linear and double_exponential_smoothing with histograms (#15686)
PromQL: Fix deriv, predict_linear and double_exponential_smoothing with histograms

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>

---------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-12-19 23:50:28 +01:00