SingleStat color issue for null mapped to "0"

Hello-

I recently upgraded to 4.6.3 (from 4.2.0) and have noticed an issue with the SingleStat panel. I am trying to understand if this was a deliberate change and when/why it happened or if this is a bug. I tried to look thru all the release notes but I did not see any reference to this.

I am using influx and am getting a count of alerts. If this count is zero influx sends a null value which I have mapped to “0” in the panel config. I was then able to set a threshold of 1,1 to show zero as green and any value above zero as red.

This no longer works in 4.6.3 for some reason. Can anyone provide any guidance here?

4.2.0:
image

After upgrade to 4.6.3:
image

The history for this looks a bit messy. It got fixed and then reverted. Will ask Alex what the latest is on this issue.

Here is the issue for it:

https://github.com/grafana/grafana/issues/8404

https://github.com/grafana/grafana/commit/3184942aebf4b86c0c215b9dbaed2d36ed5a7df0

Looks like the fix for https://github.com/grafana/grafana/issues/9012 is the reason for the change. Hard to say what is correct here.

This is how I workaround this issue: maxSeries(ORIGINAL_SERIES, scale(timeFunction(“a”), 0))
So this eliminates the null values.
Then I add value mapping accordingly.

Hope it helps,
Tal

Is it possible to color the “no value”? I want to color the “no value” background.

2 Likes

Thanks Tal for the workaround, but it’s probably data-source specific (which one did you used?)
Prometheus doesn’t have the functions you mention.

Yes, you are right. It is Metrictank / Graphite data source. I would like to offer my help in Prometheus Data sourcer. Could you please share details the issue in Prometheus? in Prometheus it should be easier to solve.

for example a single-stat panel with up metric:
up{instance="machine01:9021"}

when the value is “1” it means the server is running. in that case, it’s easy to map the value to string “UP” and set threshold color green. but in case that there is no data, you’d see the string “no value” and this can’t be mapped to numerical value so that the thresholds be able to change the panel color.

thanks

Firstly sorry for the late response.

What about trying this: max(up{job="alertmanger"} or vector(-1))?

See also here:

  1. Booleans, logic and math – Robust Perception | Prometheus Monitoring Experts
  2. Combining alert conditions – Robust Perception | Prometheus Monitoring Experts

Also feel free to connect to in Linkedin - for DMs

Please let me know if it help, if not please ping me again