snuids / trafficlights-panel

A Grafana version of the Kibana Traffic Lights Panel
MIT License
22 stars 13 forks source link

Mapping values (e.g. `null` to `0`) #14

Open ChristopherBull opened 4 years ago

ChristopherBull commented 4 years ago

An option to map values, such as null, would be beneficial.

When a query returns null, the traffic light is removed from the panel. This can be desirable behaviour, but in other situations a null may be a desirable query result - therefore the traffic light is removed instead of showing a traffic light value.

This behaviour is already available for the SingleStat panel. For usability and domain reasons, I am trying to consistently use traffic lights for various queries instead of mixing in SingleStat.

In one of my queries I want to show 0 results as green, and anything above 0 as red. I am using the following which returns null for 0 results:

SELECT count("a_field") FROM "a_bucket" WHERE $timeFilter

In this case, the visualisation will show a red traffic light or disappear (instead of showing green).

ckocyigit commented 3 years ago

I would also love this featue, since Iam trying to use these traffic lights to show availibility of services. And these do not respond with number but with strings like UP, DOWN etc.