Commit 1d8a2fe3 authored by Brian Brazil's avatar Brian Brazil

Add docs for new ^ operator

parent 9b602d3c
...@@ -19,6 +19,7 @@ The following binary arithmetic operators exist in Prometheus: ...@@ -19,6 +19,7 @@ The following binary arithmetic operators exist in Prometheus:
* `*` (multiplication) * `*` (multiplication)
* `/` (division) * `/` (division)
* `%` (modulo) * `%` (modulo)
* `^` (power/exponentiation)
Binary arithmetic operators are defined between scalar/scalar, vector/scalar, Binary arithmetic operators are defined between scalar/scalar, vector/scalar,
and vector/vector value pairs. and vector/vector value pairs.
...@@ -237,11 +238,13 @@ To get the 5 largest HTTP requests counts across all instances we could write: ...@@ -237,11 +238,13 @@ To get the 5 largest HTTP requests counts across all instances we could write:
The following list shows the precedence of binary operators in Prometheus, from The following list shows the precedence of binary operators in Prometheus, from
highest to lowest. highest to lowest.
1. `*`, `/`, `%` 1. `^`
2. `+`, `-` 2. `*`, `/`, `%`
3. `==`, `!=`, `<=`, `<`, `>=`, `>` 3. `+`, `-`
4. `and`, `unless` 4. `==`, `!=`, `<=`, `<`, `>=`, `>`
5. `or` 5. `and`, `unless`
6. `or`
Operators on the same precedence level are left-associative. For example, Operators on the same precedence level are left-associative. For example,
`2 * 3 % 2` is equivalent to `(2 * 3) % 2`. `2 * 3 % 2` is equivalent to `(2 * 3) % 2`. However `^` is right associative,
so `2 * 3 ^ 2` is equivilent to `2 * (3 ^ 2)`.
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