grafana / influxdb-flux-datasource

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

Internal Server Error when using filter in Flux #65

Closed m50434 closed 4 years ago

m50434 commented 4 years ago

Hi, Im playing with Flux (influxdb 1.7) using Grafana.

When I type

from(bucket: "iobroker")
|> range(start: -5m)

I get the data displayed… so the connection works fine.

`#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,boolean,string,string

group,false,false,true,true,false,false,true,true

default,_result,

,result,table,_start,_stop,_time,_value,_field,_measurement ,0,2019-12-28T07:53:31.724972723Z,2019-12-28T07:58:31.724972723Z,2019-12-28T07:53:37.45Z,true,ack,mqtt.0.Stromzaehler_Aktuell ,0,2019-12-28T07:53:31.724972723Z,2019-12-28T07:58:31.724972723Z,2019-12-28T07:53:49.287Z,true,ack,mqtt.0.Stromzaehler_Aktuell ,0,2019-12-28T07:53:31.724972723Z,2019-12-28T07:58:31.724972723Z,2019-12-28T07:54:01.418Z,true,ack,mqtt.0.Stromzaehler_Aktuell …`

But when Im starting to use any filter function, for example

from(bucket: "iobroker")
|> filter(fn: (r) => r["_measurement"] == "mqtt.0.Stromzaehler_Aktuell")
|> range(start: -5m)

I get “InfluxDB Error: Internal Server Error”. This is the Json-Error-Object:

message:"InfluxDB Error: Internal Server Error"
data:Object
error:"Internal Server Error"
response:"error "error in building plan while starting program: cannot submit unbounded read to ""iobroker""; try bounding 'from' with a call to 'range'" "
message:"Internal Server Error"
config:Object
method:"POST"
url:"api/datasources/proxy/5/flux/api/v2/query?org=undefined"
params:Object
data:"from(bucket: "iobroker") |> filter(fn: (r) => r["_measurement"] == "mqtt.0.Stromzaehler_Aktuell") |> range(start: -5m) "
precision:"ms"

Any ideas what I did wrong??? Is it a bug?

m50434 commented 4 years ago

Hi there: I changed the name of the measurement to names without dots! For example mqtt.0.Stromzaehler_Aktuell to StromzaehlerAktuell. Now it works.