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

This is known. I would check out this note, the related issue, and the new transformation for converting long to wide, which was added just for these SQL migrations to Grafana 8:

We were also facing the same issue. The way to resolve these errors in grafana 8+ is to format the panel as table instead of times series. Please see the image attached below

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.