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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/4b774846-d0e4-4a3a-b334-bc7f326940een%40googlegroups.com.

Reply via email to