Grafana should not hide Gauges with "no data"

There is no mapping ‘1 query == 1 gauge’ for Grafana. For example I could have 2 queries, providing data for 6 gauges:

Or 1 query providing data for 7 gauges:

So that’s a query task to return data (either real or dummy), and Grafana’s task is just to visualize it.

With flux I use the following approach if I always need to have data:

import "array"

isEmpty = (tables) => {
    columnsArray =
        tables
            |> columns()
            |> findColumn(fn: (key) => true, column: "_value")

    return length(arr: columnsArray) == 0
}

dummyData =
    array.from(
        rows: [
            { ...  },
        ],
    )

realData =
    from(bucket: "my-bucket")
        |> ...

if not isEmpty(tables: realData) then
    realData
else
    dummyData

Another approach is to have 1 panel == 1 gauge. May be it fits in your case?

3 Likes