prometheus/promql
Joshua Hesketh b6107cc888
Make rate possible non-counter annotation consistent (#14910)
* Make rate possible non-counter annotation consistent

Previously a PossibleNonCounterInfo annotation would be left in cases
where a range-vector selects 1 float data point, even if no more points
are selected in order to calculate a rate.

This change ensures an output float exists before emitting such an
annotation.

This fixes an inconsistency where a series with mixed data (ie, a float
and a native histogram) would emit an annotation without any points.

For example,

```

load 1m
series{label="a"} 1 {{schema:1 sum:10 count:5 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

```

Would have a PossibleNonCounterInfo annotation.

Wheras

```

load 1m
series{label="a"} {{schema:1 sum:10 count:5 buckets:[1 2 3]}} {{schema:1 sum:15 count:10 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

```

Would not. 

---------

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
2024-09-18 10:21:25 +00:00
..
fuzz-data
parser Merge pull request #14821 from charleskorn/nh-negative-multiplication-division 2024-09-10 15:23:00 +02:00
promqltest Merge branch 'main' into release-3.0-beta.0 2024-09-10 20:51:20 +02:00
bench_test.go Merge remote-tracking branch 'prometheus/main' into arve/close-engine 2024-08-26 12:17:10 +02:00
engine.go Make rate possible non-counter annotation consistent (#14910) 2024-09-18 10:21:25 +00:00
engine_internal_test.go refactor: extract some PromQL Engine tests which use unexported structs 2024-05-08 16:27:17 +01:00
engine_test.go Make rate possible non-counter annotation consistent (#14910) 2024-09-18 10:21:25 +00:00
functions.go Fix: optimize .* regexp performance 2024-09-17 12:18:31 +02:00
functions_internal_test.go Fix issue where summation of +/- infinity returns NaN instead of infinity 2024-06-28 11:26:54 +10:00
functions_test.go Refactor engine creation in tests 2024-07-14 13:58:51 +02:00
fuzz.go textparse: Implement `CreatedTimestamp()` in `openmetricsparse.go` (#14356) 2024-08-08 12:35:35 +01:00
fuzz_test.go remove obsolete build tag 2024-01-17 22:26:32 +08:00
histogram_stats_iterator.go Use CopyTo when resetting histogram in stats iterator 2024-07-31 11:18:47 +02:00
histogram_stats_iterator_test.go Add more test cases 2024-07-29 14:53:32 +02:00
promql_test.go Refactor engine creation in tests 2024-07-14 13:58:51 +02:00
quantile.go Merge branch 'main' into nhcb 2024-05-14 16:20:15 +08:00
quantile_test.go PromQL: ignore small errors for bucketQuantile (#13153) 2023-11-25 00:05:38 +01:00
query_logger.go chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
query_logger_test.go chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
value.go chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
value_test.go test: move most PromQL tests into separate test package 2024-05-08 16:28:56 +01:00