grafana / timestream-datasource

Amazon Timestream in Grafana
https://grafana.com/grafana/plugins/grafana-timestream-datasource
Apache License 2.0
24 stars 19 forks source link

Empty resultset causes error on grafana #168

Closed brunoleite closed 2 years ago

brunoleite commented 2 years ago

What happened: When a query returns an empty resultset, Grafana shows an error on the panel and a javascript error on the web developer console.

What you expected to happen: Empty panel with no errors or in case of multiple queries on the same panel, the query that does not return data should be ignored.

How to reproduce it (as minimally and precisely as possible): Create a time series chart with the following query (more than one might be needed):

WITH
    binnedTimeseries AS (
      SELECT BIN(time, 10000ms) AS binnedTime, SUM(measure_value::double) as value
      FROM $__database.$__table 
      WHERE $__timeFilter 
        AND measure_name = 'any_metric_name'
      GROUP BY BIN(time, 10000ms)
      ORDER BY binnedTime
    ),
    interpolatedTimeseries AS (
      SELECT 
        INTERPOLATE_FILL(
          CREATE_TIME_SERIES(binnedTime, value),
          SEQUENCE(min(binnedTime), max(binnedTime), 10000ms),
          sqrt(-1)
        ) AS interpolatedValue
      FROM binnedTimeseries
    )
    SELECT *
    FROM interpolatedTimeseries

Running the query in a standalone client, it returns the following result:

Query Result:

{
  "QueryId": "#QueryId#",
  "Rows": [
    {
      "Data": [
        {
          "NullValue": true
        }
      ]
    }
  ],
  "ColumnInfo": [
    {
      "Name": "interpolatedValue",
      "Type": {
        "TimeSeriesMeasureValueColumnInfo": {
          "Type": {
            "ScalarType": "DOUBLE"
          }
        }
      }
    }
  ],
  "QueryStatus": {
    "ProgressPercentage": 100,
    "CumulativeBytesScanned": 0,
    "CumulativeBytesMetered": 10000000
  }
}

Screenshots: Screen Shot 2022-05-19 at 12 47 54 PM Screen Shot 2022-05-19 at 1 20 47 PM

Anything else we need to know?:

Environment: Grafana version: 8.5.2 Plugin version: 1.5.2 OS Grafana is installed on: Debian User OS & Browser: Firefox Others:

sarahzinger commented 2 years ago

I can recreate this as well. Going to move it to our backlog, I'm not entirely sure if it's ok for us to just remove the error check or if it's necessary, but we should at least fix the typo.

kevinwcyu commented 2 years ago

This was released in v2.0.0. Null value data points no longer trigger the error.