How to set up alerts using last() reduce function if the latest value changes

Hi!
I’m trying to set up an alert for when the number of successful requests is less than 50% within the last 5 minutes (the order of data processing is indicated in the pictures).



The problem is that the extreme values ​​for a given interval change within a minute before the next value is obtained, even if I set the interval to -2 minutes. This results in incorrect alerts.

How can I set up alerts taking into account this Grafana feature?

Grafana v8.5.10

Grafana can work only with data obtained from your datasource. So just fix that latency, e. g. scale your ES cluster, so all records are indexed within 2minutes. That’s nothing what you can do, when source data are changing.