Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty resultset causes error on grafana #168

Closed
brunoleite opened this issue May 19, 2022 · 2 comments · Fixed by #170
Closed

Empty resultset causes error on grafana #168

brunoleite opened this issue May 19, 2022 · 2 comments · Fixed by #170

Comments

@brunoleite
Copy link

brunoleite commented May 19, 2022

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?:

  • Unrelated question: I added the external query with interpolation because I need to show gaps on the chart. This was the only way that I managed to have it working on grafana + time stream. I am not sure if I should open a feature request here or on grafana for this.
  • There is a typo in the message 'colum':
    dr.Error = fmt.Errorf("Expecting timeseries colum at: %d", timeseriesColumn.columnIdx)

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

@sarahzinger
Copy link
Member

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.

@sarahzinger sarahzinger removed their assignment May 23, 2022
@kevinwcyu kevinwcyu self-assigned this May 24, 2022
This was referenced Jun 2, 2022
@kevinwcyu
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants