mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-28 06:59:40 -08:00
Merge pull request #1892 from fstab/assume-counters-start-at-zero-after-reset
Assume counters start at zero after reset.
This commit is contained in:
commit
80b0e1b74c
|
@ -68,7 +68,7 @@ func extrapolatedRate(ev *evaluator, arg Expr, isCounter bool, isRate bool) mode
|
|||
for _, sample := range samples.Values {
|
||||
currentValue := sample.Value
|
||||
if isCounter && currentValue < lastValue {
|
||||
counterCorrection += lastValue - currentValue
|
||||
counterCorrection += lastValue
|
||||
}
|
||||
lastValue = currentValue
|
||||
}
|
||||
|
|
12
promql/testdata/functions.test
vendored
12
promql/testdata/functions.test
vendored
|
@ -69,6 +69,18 @@ eval instant at 50m increase(http_requests[100m])
|
|||
|
||||
clear
|
||||
|
||||
# Test for increase() with counter reset.
|
||||
# When the counter is reset, it always starts at 0.
|
||||
# So the sequence 3 2 (decreasing counter = reset) is interpreted the same as 3 0 1 2.
|
||||
# Prometheus assumes it missed the intermediate values 0 and 1.
|
||||
load 5m
|
||||
http_requests{path="/foo"} 0 1 2 3 2 3 4
|
||||
|
||||
eval instant at 30m increase(http_requests[30m])
|
||||
{path="/foo"} 7
|
||||
|
||||
clear
|
||||
|
||||
# Tests for irate().
|
||||
load 5m
|
||||
http_requests{path="/foo"} 0+10x10
|
||||
|
|
Loading…
Reference in a new issue