Comparison operators
These binary operators compare scalars and instant vectors. By default they act as filters; with the bool modifier they return 0 or 1.
For the restrictions on comparisons in Elasticsearch, refer to Prometheus compatibility.
Compares elements for equality. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total == 256
Differences from Prometheus
Comparing two instant vectors, such as x > y, a scalar as the first operand, such as 100 < x, a second operand that isn't a number literal, such as x > time(), and a comparison inside another expression, such as (x > 100) + 1 or count(x > 100), aren't supported yet. Refer to Prometheus compatibility.
Compares elements where the left operand is greater than the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total > 256
Differences from Prometheus
Comparing two instant vectors, such as x > y, a scalar as the first operand, such as 100 < x, a second operand that isn't a number literal, such as x > time(), and a comparison inside another expression, such as (x > 100) + 1 or count(x > 100), aren't supported yet. Refer to Prometheus compatibility.
Compares elements where the left operand is greater than or equal to the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total >= 256
Differences from Prometheus
Comparing two instant vectors, such as x > y, a scalar as the first operand, such as 100 < x, a second operand that isn't a number literal, such as x > time(), and a comparison inside another expression, such as (x > 100) + 1 or count(x > 100), aren't supported yet. Refer to Prometheus compatibility.
Compares elements where the left operand is less than the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total < 256
Differences from Prometheus
Comparing two instant vectors, such as x > y, a scalar as the first operand, such as 100 < x, a second operand that isn't a number literal, such as x > time(), and a comparison inside another expression, such as (x > 100) + 1 or count(x > 100), aren't supported yet. Refer to Prometheus compatibility.
Compares elements where the left operand is less than or equal to the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total <= 256
Differences from Prometheus
Comparing two instant vectors, such as x > y, a scalar as the first operand, such as 100 < x, a second operand that isn't a number literal, such as x > time(), and a comparison inside another expression, such as (x > 100) + 1 or count(x > 100), aren't supported yet. Refer to Prometheus compatibility.
Compares elements for inequality. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_error != 0
Differences from Prometheus
Comparing two instant vectors, such as x > y, a scalar as the first operand, such as 100 < x, a second operand that isn't a number literal, such as x > time(), and a comparison inside another expression, such as (x > 100) + 1 or count(x > 100), aren't supported yet. Refer to Prometheus compatibility.