grafana / influxdb-flux-datasource

Grafana datasource plugin for Flux (InfluxDB)
Apache License 2.0
51 stars 21 forks source link

Datasource not always returning all dataframes #116

Closed alex88 closed 4 years ago

alex88 commented 4 years ago

I've a very weird issue, with a very simple query:

import "date"

from(bucket: "my-bucket")
  |> range(start: date.truncate(t: time(v: $__from * 1000000), unit: 5m), stop: date.truncate(t: time(v: $__to * 1000000), unit: 5m))
  |> filter(fn: (r) =>
    r._measurement == "metric"
    and r.machine == "83"
    and (r._field == "temp_1"
    or r._field == "temp_2"
    or r._field == "temp_3"
    or r._field == "temp_4"
    or r._field == "temp_5"
    or r._field == "temp_6")
  )
  |> aggregateWindow(every: 5m, fn: mean)

(which works fine on the influxdb editor, I've tried tens of times, response time is ~3s) on grafana 7.0.x if the dashboard time interval is 7 days or more, the table only shows temp_1 and the last timestamp is a few hours behind the real data shown in the influxdb editor. I can see in the ajax request that the server returns only 1 dataframe. If I then open the graph panel and click on refresh it returns all the 5 dataframes with all the data. If I refresh the whole dashboard instead, the problem persists. There are no logs on the grafana container nor the influxdb server.

Aqualie commented 4 years ago

I have this exact same problem and the behavior is very bizzare. I'm not able to reproduce this using InfluxDB all queries work as expected. However if I copy paste it over and then start to increase the time-frame from my default 15 minutes to instead 24 hours things start to fall apart. In one case I have a graph which displays numerous temperatures for a physical servers in a single graph, CPU, DIMM's, 10G ETC.. after the duration change I may end up only seeing one of the temperatures out of like 6 that should be displayed and then it will only show data for like 2 hours duration so the rest of the chart will be blank.

Looking at the same query in InfluxDB with the same 24 hours duration everything renders fine and all datapoints are present.

It's also important to note that after the change to 24 hours the graph essentially gets stuck in this broken state so if I drop the time-frame back down to 15 minutes it won't start to display the other 5 temperatures and it will only show the same 1-2 minutes with the rest of the graph being empty.

ryantxu commented 4 years ago

flux support was added to grafana 7.1 (released today :tada: ) https://www.influxdata.com/blog/how-grafana-dashboard-influxdb-flux-influxql/

Can you try the queries in 7.1? I think it will be fixed, but if not please post an issue on: https://github.com/grafana/grafana/issues

if possible, include an example CSV output that can reproduce your issue https://github.com/grafana/grafana/tree/master/pkg/tsdb/influxdb/flux/testdata

alex88 commented 4 years ago

The issue is still present and now the table doesn't even show one value per column, I'll open an issue there then