rate()
The rate of change of the counter over the observed time period. This is the raw or simple rate, equivalent to delta(summary) or time_delta(summary). After accounting for resets, the last value is subtracted from the first value and divided by the duration between the last observed time and the first observed time.
2. rate(
4. summary CounterSummary
6. ) RETURNS DOUBLE PRECISION
For more information about counter aggregation functions, see the hyperfunctions documentation.
Required arguments
| Name | Type | Description |
|---|---|---|
| summary | CounterSummary | The input CounterSummary from a counter_agg call |
Returns
| Name | Type | Description |
|---|---|---|
| rate | DOUBLE PRECISION | The per second observed rate computed from the CounterSummary |
Sample usage
2. SELECT
4. id,
6. rate(summary)
8. FROM (
10. SELECT
12. id,
14. counter_agg(ts, val) AS summary
16. FROM foo
18. GROUP BY id
20. ) t
