InfluxQL derivative function question


#1

I am using InfluxDB and Grafana to graph systems level metrics for our compute infrastructure. I am using examples from both the canned snippets in the Chronograf source tree and the READMEs from the Telegraf system plugins source tree.

I have seen slightly different ways that diskio is being queried and can not seem to figure out if there is a “right” way to format the query or if it just a matter of personal choice on how you want the data sampled.

If you look at the below queries you can see that we are pulling the max value of each data point per bucket to be sampled for rate of change when computing diskio read/write bytes. When computing the io_time we are simply pulling the last point from each but for the derivative function.

Is there a rule of thumb as to which format works best with which type of data. I am having a difficult time understanding if there really is a significant different between the accuracy of these slightly different queries

SELECT non_negative_derivative(max("read_bytes"), 1s)  FROM "diskio" WHERE time > now() - 30m GROUP BY "host","name",time(60s)
SELECT non_negative_derivative(max("write_bytes"), 1s) FROM "diskio" WHERE time > now() - 30m GROUP BY "host","name",time(60s)

SELECT non_negative_derivative(last("io_time"),1ms) FROM "diskio" WHERE time > now() - 30m GROUP BY "host","name",time(60s)