Filtering duration between timestamps

I’m trying to find missing data in my buckets using the duration function. My thought process is:

  • Telegraf is storing data every 3 min from some temperature sensors
  • I first calculate the duration between time records
  • then filter tables based on elapsed time > 3 min
    The duration function is working fine, it’s returning 3 min except for a few timestamps when i shut telegraf off to have some missing, they have 15 min elapsed. When I filter the table using the following nothing is return? How do I filter a table based on durations between timestamps.
 |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
 |> filter(fn: (r) => r["_measurement"] == "xxxxxxx")
 |> elapsed(unit: 1m, timeColumn: "_time", columnName: "elapsed" ) 
 |> filter(fn: (r) => r.table > 17)
 |> yield()

I posted the wrong code, the filter should be r.elapsed > 3 not r.table. I was trying a work around and posted the wrong snippet.

the issues resolved itself, must have been oversight

1 Like