rate() and irate()
These two functions allow you to calculate the rate of increase of the given counters. Both automatically adjust for counter resets and take a range vector as an argument.
While the rate() function provides the per second average rate of change over the specified interval by using the first and last values in the range scaled to fit the range window, the irate() function uses the last two values in the range for the calculation, which produces the instant rate of change.
It's important to understand in what scenarios the usage of one is more suitable than the other. For example, when creating visualizations such as dashboards, we might want to increase the awareness of possible spikes; irate fits this criteria. Note that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access