VictoriaMetrics/lib/streamaggr
Roman Khavronenko 5df50e5645
lib/streamaggr: prevent rate_sum and rate_avg from producing NaNs (#6482)
### Describe Your Changes

* check if `lastValue` was seen at least twice with different
timestamps. Otherwise, the difference between last timestamp and
previous timestamp could be `0` and will result into `NaN` calculation
* check if there items left in lastValue map after staleness cleanup.
Otherwise, `rate_avg` could have produce `NaN` result.

### Checklist

The following checks are **mandatory**:

- [x] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).

---------

Signed-off-by: hagen1778 <roman@victoriametrics.com>
(cherry picked from commit 51d19485bb)
2024-06-14 13:26:42 +02:00
..
avg.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
count_samples.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
count_series.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
dedup_test.go lib/streamaggr: reduce memory allocations by using dedupAggrSample buffer per each dedupAggrShard 2024-06-10 16:39:26 +02:00
dedup_timing_test.go lib/streamaggr: reduce the number of duplicates per each sample in BenchmarkDedupAggr from 100 to 2 2024-06-10 16:39:26 +02:00
dedup.go lib/streamaggr: prevent from data race inside dedupAggrShard when samplesBuf can be updated in pushSamples() while their values are read in the flush() loop without das.mu lock 2024-06-11 17:31:38 +02:00
deduplicator_test.go lib/streamaggr: follow-up for 15e33d56f1 2024-03-17 23:23:57 +02:00
deduplicator_timing_test.go all: fix golangci-lint(revive) warnings after 0c0ed61ce7 2024-04-03 03:00:45 +03:00
deduplicator.go lib/streamaggr: remove flushState arg at dedupAggr.flush(), since it is always set to true in production 2024-06-10 16:00:05 +02:00
histogram_bucket.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
last.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
max.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
min.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
quantiles.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
rate.go lib/streamaggr: prevent rate_sum and rate_avg from producing NaNs (#6482) 2024-06-14 13:26:42 +02:00
stddev.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
stdvar.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
streamaggr_test.go lib/streamaggr: prevent rate_sum and rate_avg from producing NaNs (#6482) 2024-06-14 13:26:42 +02:00
streamaggr_timing_test.go lib/streamaggr: added rate_sum and rate_avg to benchmarks, lint fix (#6264) 2024-05-13 16:49:59 +02:00
streamaggr.go lib/streamaggr: remove flushState arg at dedupAggr.flush(), since it is always set to true in production 2024-06-10 16:00:05 +02:00
sum_samples.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
total.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00
unique_samples.go lib/streamaggr: follow-up for 7cb894a777 2024-06-07 16:35:53 +02:00