Grafana 8 failed to convert long to wide series when converting from dataframe: long series must be sorted ascending by time to be converted

The following sql query works fine with grafana 7.3.5 but fails with an error message with grafana 8.

SELECT
  $__timeGroupAlias(date,$__interval),
  value AS value,
  server AS metric
FROM table
WHERE
  name = "some_data_name" AND
  server in ($server)
GROUP BY 1, server

The variable $server can be (multi-)selected with a combo box and expands to a string array e.g. “server1”,“server2”.

In grafana 7.3.5 the query works as expected and multiple graphs are displayed on the time chart (one for each selected server).

The query works also with grafana 8 if only a single server is selected but fails with the following error if more than one company is selected:

failed to convert long to wide series when converting from dataframe: long series must be sorted ascending by time to be converted

The chart shows “Data does not have a time field”

Any idea how to solve this?

Thanks and best regards

  • What Grafana version and what operating system are you using?
    Docker container with Grafana 8.1.3 and mysql running on CentOS