When a PromQL query is evaluated, the order in which binary operators are applied is dictated by the operator precedence. The following table shows the precedence order, from higher to lower:
Precedence | Operator | Description |
1 |
^ | Evaluated right to left, for example, 1 ^ 2 ^ 3 is evaluated as 1 ^ (2 ^ 3) |
2 | *, /, % | Evaluated left to right, for example, 1 / 2 * 3 is evaluated as (1 / 2) * 3 |
3 | +, - | Evaluated left to right |
4 | ==, !=, <=, <, >=, > | Evaluated left to right |
5 | and, unless | Evaluated left to right |
6 | or | Evaluated left to right |