Diff() and percent_diff() not working as intended in alert condition

Hello,

I have a small problem with an alert condition that is not working as I understand it should work.
I would say it’s the exact same problem as this old Github issue.
I would just like to know if what is happening is expected behaviour and if there’s any way to accomplish what I want to do.

I’m no Grafana or ES expert but I will try to explain the issue as I understand it after debugging the alert test logs for a while:

  • Data source is an ES index pattern, I do not use a custom query in Grafana. The data I’m receiving is a numerical amount and it gets updated in ES every second.
  • Query and query options look like this:
  • Alert looks like this:
    ccccc

Let’s say for example that I’m testing the alert at 15:35:30, what I would expect this condition to do given that my query interval is 2m is:

Calculate the percentage difference between:

  • the amount of data between15:28:00 - 15:30:00
    and
  • the amount of data between 15:33:00 - 15:35:00

What actually happens is that the condition calculates the percentage difference between:

  • the amount of data between 15:28:30 - 15:30:00
    and
  • the amount of data between 15:33:00 - 15:33:30

Basically, what I’m saying is that this condition is not comparing the whole interval values, is this normal and is there a way I can achieve my intended behaviour ?

Thanks beforehand, hope I was clear enough.