grafana/influxdb-flux-datasource

The expanded values of $__interval in Flux and InfluxQL are different

Closed this issue · 2 comments

I made a dashboard with two graph panels. The first one uses InfluxQL and the second one Flux.

I discuss it here : https://community.grafana.com/t/flux-query-to-select-group-by-time-and-calculate-the-mean/8332

InfluxQL

SELECT mean(“usage_idle”) FROM “cpu” WHERE (“cpu” = ‘cpu-total’) AND $timeFilter GROUP BY time($__interval) fill(null)

Flux

from(db: “telegraf”)
|> filter(fn: ® => r["_measurement"] == “cpu” AND r["_field"] == “usage_idle” AND r[“cpu”] == “cpu-total”)
|> range($range)
|> window(every:$__interval)
|> mean()
|> group(none: true)

When looking at the query inspector, I see that the InfluxQL query expanded $__interval to 1m and the Flux query expanded $__interval to 15s.

Hmm, I cant repro this.
Could you please check if you have a minimum interval set in any of the following locations:

  • Edit panel -> Metrics tabs -> Options
  • Datasource config -> Field "Min time interval"

You were right. I had the InfluxDB data source Min time interval set to 60s.

It might make sense to also add a Min time interval to the Flux datasource plugin.