Trying to learn flux and have some problems with converting the following influxQL query in Grafana:
SELECT COUNT(“val1”) FROM “dbname”.“autogen”.“measurement” WHERE $timeFilter AND “id”=‘var1’ GROUP BY time(1h)
Flux query:
from(bucket: “dbname”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “measurement”)
|> filter(fn: (r) => r[“_field”] == “val1”)
|> filter(fn: (r) => r[“dev_id”] == “var1”)
|> window(every: 1h)
|> count()
I get somewhat the result I’m expecting, but the Grafana dashboard is laggy when I move the mouse over the graph, so most likely there is a much better way to do it than what I tried above.
Thanks