Grafana 8 Alert / Azure Resource Graph Query / Failed to evaluatie queries when adding expression

  • What is your Grafana version?
    Self Hosted Grafana Community edition, v8.5.1 on Ubuntu Server 18.04

  • Are you using legacy alerting or Unified Alerting?
    Unified/Grafana 8 Alerting

  • was the alert in question migrated from the legacy platform into Unified Alerting, or did you first create it inside the new platform?
    Newly created on new platform

  • Please list ALL configuration options related to alerting. You can find these in the Alerting and Unified Alerting sections of Grafana’s config file.
    Default Grafana config

  • What are you trying to achieve?
    I want to create an alert based on a numeric value (the amount of active high security alerts in the given Azure context). If the value is above 0, I should be notified.

  • How are you trying to achieve it?
    I try to create an alert and use an Azure Monitor datasource. When I add the query without expression and select “Stat”, the query return the correct data as shown below:

If I add an expression next without hitting “Run queries” again, I see that the expression works, as the formerly green number 2, turns red.

If I hit save now, Grafana will tell me that all was good and the alert is saved successfully. However, the alert is not working anymore. As soon as I (or grafana) tries to run the query after adding the expression, I get the follownig error:

It looks like as soon as I add the expression, Grafana interprets the query data as time series data, regardless of the selected “Stat” item, leaving me with an broken alert.

Anyone else having problems with this?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    "Failed to evaluate queries and expressions: failed to execute conditions: can only reduce type series, got type numberSet"

  • Did you follow any online instructions? If so, what is the URL?
    NA

linking the GH issue here:

@stefanpetter Do you get the same error when creating alerts on Azure Monitor timeseries data from metrics? One potential issue is that Azure Resource Graph query doesn’t include any time info. I was able to add the current time value to the query to convert the result to timeseries data.

1 Like

@kaprince you’re a lifesaver! Very nice and simple workaround! Addition of

| extend timestamp = now()

Indeed did the trick. I’ll update the issue in Github with the workaround. Would be nice if they fixed it, but the pressure is off :slight_smile:

Thank you very much!

1 Like