Time-binned maximum elapsed query

influxql

#1

I’d like to do the following (from within Grafana, but that’s not really relevant): get the “elapsed” (time gaps) between values within a time range, then group those into 1-h intervals, and get the max time-gap within each interval. I think I’ve constructed the query correctly, but i’m getting ERR: aggregate function required inside the call to elapsed. Am I doing something obviously wrong?

select max("elapsed") from 
  (
   SELECT elapsed("value",1m) from "mymetric" 
   WHERE ("site" = 'site-name') 
   AND time >= 1515489833447ms 
   AND time <= 1517309498470ms
  ) 
GROUP BY time(1h)

#2

I’m facing the same issue here,
do we have more people with this issue?
And seems something related to the elapsed + group by time()
If you change your group by “any_other_column”, probably, just like me you will have your query working (with wrong data obviously… )