Commit 38a24dc3 authored by beorn7's avatar beorn7

Document offset modifier.

parent 102d9c86
...@@ -107,6 +107,30 @@ a `job` label set to `prometheus`: ...@@ -107,6 +107,30 @@ a `job` label set to `prometheus`:
http_requests_total{job="prometheus"}[5m] http_requests_total{job="prometheus"}[5m]
### Offset modifier
The `offset` modifier allows changing the time offset for individual
instant and range vectors in a query.
For example, the following expression returns the value of `foo` 5
minutes in the past relative to the current query evaluation time:
foo offset 5m
Note that the `offset` modifier always needs to follow the selector
immediately, i.e. the following would be correct:
sum(foo offset 5m) // GOOD.
While the following would be *incorrect*:
sum(foo) offset 5m // INVALID.
The same works for range vectors. This returns the 5-minutes rate that
`foo` had a week ago:
rate(foo[5m] offset 1w)
## Operators ## Operators
Prometheus supports many binary and aggregation operators. These are described Prometheus supports many binary and aggregation operators. These are described
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment