Label matching operators
These operators are used inside instant vector selectors ({...}) to match series by label.
Matches labels exactly equal to the provided string.
Operands
label(string)- The label name to match on, used inside a selector (
{...}). value(string)- The string or regular expression to compare the label value against.
Returns
Used inside an instant vector selector ({...}) to select an instant_vector, rather than as a standalone expression.
Example
requests_total{method="GET"}
Matches labels not equal to the provided string.
Operands
label(string)- The label name to match on, used inside a selector (
{...}). value(string)- The string or regular expression to compare the label value against.
Returns
Used inside an instant vector selector ({...}) to select an instant_vector, rather than as a standalone expression.
Example
requests_total{method!="DELETE"}
Matches labels whose value does not satisfy the provided regular expression.
Operands
label(string)- The label name to match on, used inside a selector (
{...}). value(string)- The string or regular expression to compare the label value against.
Returns
Used inside an instant vector selector ({...}) to select an instant_vector, rather than as a standalone expression.
Example
requests_total{method!~"DELETE|PUT"}
Matches labels whose value satisfies the provided regular expression.
Operands
label(string)- The label name to match on, used inside a selector (
{...}). value(string)- The string or regular expression to compare the label value against.
Returns
Used inside an instant vector selector ({...}) to select an instant_vector, rather than as a standalone expression.
Example
requests_total{method=~"GET|POST"}