The following Flux gives me DNS queries per second, but I'd like to not have a static value for the measurement interval (10 sec in the code below). How could this be done, is there a variable that can be used for this or is there a way to calculate the difference between _time
of the samples like difference()
does for _value
?
from(bucket: "dns")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "exec_pdns")
|> filter(fn: (r) => r["_field"] == "questions")
|> difference()
|> map(fn: (r) => ({r with _value: r._value / 10.0}))
Found the answer:
And if you're looking to grab the total between more than one host: