const SUPPORTED: &str = "a selector — `x`, optionally with an `offset` — a range function over \
a matrix, where a matrix is `<selector>[<range>]` as in `rate(x[5m])` or \
`<expression>[<range>:<step>]` as in `rate(x[5m:1m])`, with the step \
optionally omitted as `[<range>:]`, where the subquery's `<expression>` \
is any shape here, so a subquery nests on a grid of its own as in \
`rate(rate(x[5m:1m])[10m:30s])`, and where either matrix shape carries the \
`offset` and `@` anchor written on it as in `rate(x[5m] @ 1234)`; a math \
function over any of them (`abs(rate(x[5m]))`, `clamp_min(x, 0)`), with \
`round` and the `clamp` functions also taking scalars \
(`round(x, time() / 10)`), a native \
histogram function over any of them (`histogram_count(x)`), a label \
function over any of them \
(`label_replace(x, \"a\", \"$1\", \"b\", \"(.*)\")`), a binary \
operation between one of them and a scalar (`2 / (x + 1)`, \
`x > bool time()`, `time() - timestamp(x)`), a scalar — a constant, \
`time()` or a binary operation between scalars — \
`vector(<scalar>)`, a date function without an argument (`hour()`), a \
negation of one of them (`-x`), a set operation between two of them \
(`x and on(job) y`, `x or y`, `x unless y`), `info` over any of them with \
one info metric (`info(x, {version=~\".+\"})`), or one of the \
aggregators that folds a group's values into one value per grid point — \
`sum`, `avg`, `count`, `min`, `max`, `group`, `stddev`, `stdvar` and \
`quantile(<constant>, <expression>)` — over any of them, optionally \
grouped by `by` or `without` as in `avg by(job)(rate(x[5m]) * 100)`; \
`topk`, `bottomk`, `limitk`, `limit_ratio` or `count_values` over any of \
them, as in `topk(3, x) by(job)` and `count_values(\"v\", x)`; a \
sort, `absent`, `absent_over_time` or `histogram_quantile` / \
`histogram_fraction` over any of them (`sort_desc(x)`, \
`absent(x{job=\"a\"})`, `absent_over_time(x{job=\"a\"}[5m])`, \
`histogram_quantile(0.9, rate(x[5m]))`); a range function's own \
constants sit where that function takes them, before \
the matrix for `quantile_over_time(0.9, x[5m])` and after it for \
`predict_linear(x[5m], 300)` and \
`double_exponential_smoothing(x[5m], 0.5, 0.1)`";Expand description
The shapes this compiler accepts, quoted in every rejection.
It is one sentence of grammar rather than a list of examples, because it is what a refused query reads: the shapes have to be true of every query the compiler binds, and the examples only show them. The two matrix shapes and the recursion through them are stated first, because that recursion is what a reader is most likely to get wrong.