In Grafana, how do we deal with queries that return 0 rows in a chart/panel?

Viewed 1346

I’m running into a problem that might be self inflicted but I’m a noob and I’m still stumbling thru this dashboard I inherited.

We are using Grafana 8.1.5. I inherited a dashboard with a panel that is giving this error message:

“failed to convert long to wide series when converting from dataframe: can not convert to wide series, input has null time values” error.

enter image description here

I think I know the cause but I don’t know how to fix it. The data source is from a MySQL database. When we select “All” under the dropdown “Org”, we don’t get this error and we get 8 rows back and are expecting 8 rows. When we select one org (in this example “Data Protection”) under the dropdown “Org”, we do get the error and we get 5 rows back. I think because 3 queries return 0 rows, we are getting this error.

Each pie slice has its own SQL query to get data. For the queries that return 0 rows, I tried selecting some of the “Standard options” to fix it but it doesn’t seem to work. I tried to play around with the Min, Max, and “No Value” settings and enter values larger than 0 but I still get this error. The initial values for Min and Max were "auto" and "No Value" was blank but the screenshot is when I left them as "1" while I was messing with them.

enter image description here

What do I need to do to make the message go away? Is the message benign and I shouldn’t worry about it since it looks like we’re still printing out the pie chart?

2 Answers

Write SQL, which returns record with zero value instead of empty result. In theory zero value, won't be visible in the pie chart and you will have still record for dataframe transformation, so that one won't be failing.

So I accidentally stumbled across the answer. What happened is the query returned data formatted as "Time Series" instead of "Table". Because some of the data didn't have values for the specified time, the time value was Null.

Since it was Null, the chart returned this error message. The fix was to select "Table" as the format. Then the chart won't care about the time value being Null and the missing data appears as 0 in the legend and we don't get the error message anymore.

enter image description here

enter image description here

Related