Telegraf aggregator derivative

I’m trying to understand the rollover concept with the aggregator.derivative plugin.

Can someone please explain the math on how you get .33 when period = "7s" from the example provided in the documentation?

Hmm I’m not sure. Based on a quick reading of this I would have expected the following calculations:

# max_roll_over = 0
(8-8) / (14-7) = 0

# max_roll-over = 1
(8-6) / (14-7) = 0.2857...?

Is that what you thought as well?

I think this is how its being calculated:

# max_roll_over = 1
(8-6) / (13 - 7) = .33...

Ah that makes the math work. My thinking was since it was using a period of “7s” it would use 7 and 14. In which case the math is wrong.

I would like to update that table with the explanation, seen on the other tables and I am inclined to update the result of that max_roll_over = 1 example. Thoughts?

Yea, I think that’s a good idea.

I put up a PR and in doing so realized the example at time period 7 didn’t look right either: docs(aggregators.derivative): add explanation of calculations by powersj · Pull Request #12758 · influxdata/telegraf · GitHub

Does that look closer to what you expect?

Yes, looks good. Thank you!