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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>