(I copy pasted the wrong bit of screen from when I had eval_time: 5m30s, 
but it doesn't affect the result)

On Friday, 13 October 2023 at 12:30:16 UTC+1 Brian Candler wrote:

> I've been using "promtool test rules" to see how rate() behaves with a 
> timeseries that has recently started, and I am struggling to understand it.
>
> What would you think the following test should return?
>
> ```
> evaluation_interval: 1m
>
> tests:
>   - input_series:
>       - series: foo
>         values: '_ _ _ 17 137'
>     interval: 1m
>
>     promql_expr_test:
>       - expr: rate(foo[5m])
>         eval_time: 4m30s
>         exp_samples:
>           - value: 2   # I expected: increase of 120 in 60 seconds
>             labels: ""
> ```
>
> Result (with prometheus 2.45.0):
>
> ```
>   FAILED:
>     expr: "rate(foo[5m])", time: 5m30s,
>         exp: {} 2E+00
>         got: {} 6.566666666666666E-01
> ```
>
> That result is 197/300, and I have no idea how it derives this value!
>
> Now change the input data to:
>
> ```
>         values: '_ _ _ 1017 1137'
> ```
>
> and the result is 0.8 (=240/300, 192/240 or 48/60) - even though the input 
> values are still 120 apart.
>
> Any clues as to how it gets these results?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/bb931218-ec6b-46da-ab1a-65971ce03c46n%40googlegroups.com.

Reply via email to