Open errantspark opened 4 years ago
I have found this workaround. I hope it is helpful.
starttime = time(v: $__from * 1000000) //transform to ns.
stoptime = time(v: $__to * 1000000)
from(bucket: "telegraf/autogen")
|> range(start: starttime, stop: stoptime)
time() is a flux function to transform a number in ns to RFC3339
Thanks @MzazM it works. I used it as follows for comparing data in a given time range to timeshifted data 1hr back in Grafana.
starttime = time(v: ($__from - (1* 3600 * 1000)) * 1000000)
stoptime = time(v: ($__to - (1 * 3600 * 1000)) * 1000000)
the $range parameter (as i understand it, i don't fully grok the code) is expanded in datasource.ts to
start
andstop
values, it would be very useful to be able to split this out into two parameters such as$start
and$stop
as then you could(?) perform math on the start and end positions greatly simplifying and speeding up time-shifted querieswhat i'm envisioning is something like
to perform a timeshifted query to make it easy to compare from one day to the next