Why is test data not in sorted time order?

  • What Grafana version and what operating system are you using?

  • What are you trying to achieve?
    Use the diff() function for alerting

  • How are you trying to achieve it?
    Eval montonic increasing counter every 1m for 5m. Evaluate points from (1h, now). Get the diff and check if there has been any change. IE, diff() > 0.

  • What happened?
    diff() gets negative values when I know it’s not appropriate

  • What did you expect to happen?

When I test my alert, I see that the points do not come back in sorted time order. This seems like a problem. As I can’t find any docs on diff(), I checked the code (grafana/reducer.go at main · grafana/grafana · GitHub). It does seem to be doing what I expect. IE query(t1) - query(t0), except t1 and t0 here are not as expected. The test data looks like this -


Clearly Point 3 and 4 occurred before 0 and 1?

What is going on here?

This topic was automatically closed after 365 days. New replies are no longer allowed.