Relative Content

Tag Archive for promqlvictoriametrics

promql Compare the current label values with the past label values when the past label values do not exist

I have a counter type metric named request_count, which has labels route and status_code. I need to trigger an alert when the growth rate within the same minute compared to one week ago exceeds 1.5. The expression I’m using is:
sum by (route, status_code) (increase_pure(request_count{route=~".+", status_code=~".+"}[1m])) / sum by (route, status_code) (increase_pure(request_count{route=~".+", status_code=~".+"}[1m] offset 1w)) > 1.5