# rate(set[], options = {})¶

Given an arbitrary number of series, returns a set of equal length where each value has been converted to a rate over the defined duration. The duration of the period can be set with the following parameter:

`duration`

- This converts every value to a rate, where the period of the rate is defined by the given duration. For every value`x`

, the effective transform run is:`(x/p) * duration`

. Where`p`

is the automatic period of the data determined by the current rollup resolution, the saved metric period attribute, or the downsample period specified in a call to series(). For example, to get “rate per minute”, you would set duration to “60”`( x/p * 60 )`

. Whereas, to get “rate per second”, you would set duration to “1”`( x/p * 1)`

. The duration defaults to “1” if not specified, implying all rates are converted to per-second.

```
rate(s("http.requests.count", "*", {period: "300"}),{duration:"60"})
```

## How rate() detects the period¶

- If a metric does not have a period set, then period is defaulted to resolution of the data.
- If the series() was given a ‘period’ parameter, it will be used in place of the metric period.
- When you switch to a higher viewing window, the data switches to a rollup resolution. Therefore, the period is calculated as the Max of (period, rollup resolution).