Grafana Alerts got too many "no value"

Hello Everyone,

Currenty I use grafana Alerts to check how many nginx errors exist from a elasticsearch log source, and calculate the rate (the number of errors/ total nginx logs). But I always get so many “no values” from the alert. I also used the “preview” button to check, whether I can my query correct or not. They do work.

I also read many blogs, I know I can set the alert option, “no values” = ok. But I still want to know why I got so many “no value” or zero here. Could someone here just give me a tip, I really appreciate it.

You have all details in history:

B result was NaN (no data) → why? Because you have expression D>4 and D was NaN as well, so as why D was NaN → … and then iterate until you find root cause (BTW: you have terrible orders of refIDs (A, B, C, D…) for humans, make it properly ordered and your human life will be easier).

But I don’t understand why I got two zeros, E=0 and F=0. When I clicked “preview” buttons, I always get a right value. Maybe it took too lang time to get a value?

You have your data, so only you know how they behave. Maybe they have NaN, but you selected Strict mode, so result can be NaN → exactly how UI is saying:

Thank you so much for your reply. But from the state history I get two zeros E=0, F=0.
But when I clicked the “preview” Button, I got two real number from the query. Should I check the logs somewhere to know, how the grafana caculate the number?

Bildschirmfoto 2024-03-04 um 16.00.41
Bildschirmfoto 2024-03-04 um 16.00.48

You are showing FIRST value (red), but transformation uses LAST (blue), which can be NaN:

Thank you so much again. If I check the history state like this photo below at 14:10, at that time there are two real values not “NaN” in the Graph I posted here. That’s why I don’t understand I got the NaN at 14:10.

Let’s imagine:

  • it is 14:10:03
  • Query A returns this timeseries now (at 14:10:03):
    13:50 100
    14:00 200
    14:10 NaN
    (I’m not saying that YOUR query is doing that, because it’s not visible from the graph what is your LAST value, but probably this is happening in your case)
  • Expression E returns:
    NaN - because you have mode: Strict and LAST value is NaN
    (it may return last number e.g. 200 in this particular case, but you have to use mode “Drop Non-numeric values”, not Strict mode!!!)

Tell me, why you are using that “mode: Strict” in this case, without understanding/reading what is it doing?

Thank you for your reply. My question here is actually why I got the “14:10 NaN” at this moment. I do understand what does the strict mean, I also know I can cofigure many options like “Drop Non-numeric values” to make my alert right and do not send “no value” any more.

But I really want to figure out why can I got “NaN” so many times, I don’t think the value can be null at that point. Because the queries have already worked many times. Do you know some logs that I can check or some other ways to do some tests? Maybe I can find a theory to approve the “NaN” value here.