How to make an alert based on a math expression for a time series?

  • What Grafana version and what operating system are you using?
    Using Grafana 8.2.0 on web browser

  • What are you trying to achieve?
    I’m using two Lucene queries (time series) and I’d like to perform binary math expressions (addition, division, etc) on the two queries and alert based on if it surpasses a threshold.

  • How are you trying to achieve it?
    I created two queries and an expression, used the “Expressions” feature, and selected “Math” - then I tried to type my expression into the box and set my alert based on this condition.

  • What happened?
    Any math expression I use (even something as simple as $A + $B > 0) results in “invalid format of evaluation results for the alert definition C: looks like time series data, only reduced data can be alerted on.”
    Reduce doesn’t allow me to perform the same binary operation I need to use.
    If I make my math expression C to be simply $A + $B and use classic condition to determine if that sum is over a threshold or not, I get: “Failed to evaluate queries and expressions: failed to execute conditions: only data source queries may be inputs to a classic condition, D is a Expression”
    Transforms allow me to successfully perform the necessary operations and visualize the transformed time series via the binary tranform feature, however Grafana doesn’t let me alert on the transform.

  • What did you expect to happen?
    I expected the expression to perform binary math on the points in the time series with corresponding timestamps.

2 Likes

i have the same question. do you sovled it?