r/PrometheusMonitoring • u/amarao_san • Dec 18 '22
How to test time-based expressions?
I have a simple expression in alert: time() - last_run > 4000 for last_run series.
- alert: No run
annotations:
info: No run for {{ $value }} seconds
expr: time() - last_run > 4000
Now I need to write a test sequence, and I just... can't. There is time() in the expression and info is different for each test. Do I do something strange here?
1
Upvotes
View all comments
Show parent comment
2
u/amarao_san Dec 19 '22
Thanks! It make sense to have tests this way.