clickhouse-grafana icon indicating copy to clipboard operation
clickhouse-grafana copied to clipboard

Tooltip is not formatted - TimeSeries panel - 9.3.X+

Open sbengo opened this issue 1 year ago • 7 comments

Hi @Slach ,

Description:

After upgrading to Grafana 9.3.X, with the latest version of plugin (2.5.3), on TimeSeries panel, the tooltip information is not formated as the legend:

image

It happens when the user tries to change the timerange or the series changes due to variables/templating.

I have tried to debug a bit and test other Datasources and the problems seems to the way that the Dataframe is built and the current Grafana version is not able to format it...

Apologies for opening this issue here instead of Grafana, but wanted to share with you, as I'm not sure that the Draframe is being built as it should

Tested with:

  • plugin version: 2.5.3
  • grafana 9.3.0 (KO), 9.3.7(KO), 9.4.7 (KO), main[pre 9.5] (KO)

Note:

  • grafana 9.2.15 (OK)

Repro case:

  1. Create a Dashboard with altinity-grafana as DS and use some query like the following:
  SELECT
      $timeSeries as t,
      count(<field>) as field,
      <group_column>
  FROM $table
  WHERE $timeFilter
  
  GROUP BY t, <group_column>
  ORDER BY t, <group_column>
  1. Validate that when the user changes the timeRange the tooltip differs from legend and it takes format as:
{name="<group_column_value>"}
  1. Extract the Dataframe image

  2. Create new panel using TestDB as Datasource, select RAW Frame and paste the extracted Dataframe: image

  3. Validate that the problem is directly related with the current Dataframe spec

Example:

The following Dataframe has been extracted from CH query and modified in order to let you to reproduce the case: group_column_value = {"serie A"|"serie B"}

[
  {
    "schema": {
      "name": "serie A",
      "fields": [
        {
          "name": "Time",
          "type": "time",
          "config": {}
        },
        {
          "name": "Value",
          "type": "number",
          "config": {}
        }
      ]
    },
    "data": {
      "values": [
        [
          1681776060000
        ],
        [
          1
        ]
      ]
    }
  },
  {
    "schema": {
      "name": "serie B",
      "fields": [
        {
          "name": "Time",
          "type": "time",
          "config": {}
        },
        {
          "name": "Value",
          "type": "number",
          "config": {}
        }
      ]
    },
    "data": {
      "values": [
        [
          1681776060000
        ],
        [
          1
        ]
      ]
    }
  }
]

sbengo avatar Apr 18 '23 09:04 sbengo

Hi @Slach , to add more info, I found that on the following Grafana dashboard there is the same behaviour, as the legend values is different than the shown tooltip

https://play.grafana.org/d/data-frame-scenarios-timeseries-panel/data-frame-scenarios-timeseries-panel?orgId=1&var-scenario=multi-frame&var-resultState=success&var-generator=frontend

Note that if you edit the panel and you add a "dummy" transformation like Join by fields -> OUTER Time and then you disable it again, the tooltip is well formatted. For some reason its the first time that it renders the panel...

image

sbengo avatar Apr 27 '23 11:04 sbengo

My experience has been that the tooltips are correctly formatted on first load, but any change after that causes this issue to occur. That includes an automatic reload of the data on the page...

cjw296 avatar May 18 '23 17:05 cjw296

@Slach , @cjw296 as I supposed, it was a Grafana problem. The following PR https://github.com/grafana/grafana/pull/69289 fixes it (tested locally with docker :main) and working fine.

Note the related issue, as some other DS plugin owner reported it to Grafana

@Slach , as it is suggested, a legacy format (Time/Value) is being used, it would be convenient to adapt to the recommended dataframe format

Closing this issue. Thanks, Regards

sbengo avatar Jun 01 '23 04:06 sbengo

@sbengo thanks for sharing your feedback

Slach avatar Jun 01 '23 13:06 Slach

Hi @Slach , we have upgraded Grafana to 10.0.3 and I was wrong: the issue has been fixed when the user changes the variables, but for some reason, when the user changes the range time, the panel renders with bad format, as explained on this issue.

I think that Grafana team missed that case, as I reproduced it on the play.grafana dashboard:

https://play.grafana.org/d/data-frame-scenarios-timeseries-panel/data-frame-scenarios-timeseries-panel?orgId=1&var-scenario=multi-frame&var-resultState=success&var-generator=frontend

sbengo avatar Aug 31 '23 05:08 sbengo

@Slach , I have already asked on the original issue: https://github.com/grafana/grafana/issues/69207#issuecomment-1700392085

sbengo avatar Aug 31 '23 05:08 sbengo

@sbengo let's wait when https://github.com/grafana/grafana/issues/74281 will resolve

Slach avatar Sep 13 '23 04:09 Slach