PromQL supports various operators, which enable you to perform secondary processing on time series data. These operators include mathematical operators, boolean operators, comparison operators, logical operators, and other operators. This topic describes PromQL operators.
Mathematical operators are relatively simple, including basic addition, subtraction, multiplication, and division. For example, you can use http_response_size_bytes_sum to query the total bytes of HTTP responses. If you want to use MB as the unit, you can use the following calculation method:
The following table shows the mathematical operators that are supported in PromQL.
Comparison operators
Comparison operators allow you to compare sample values in time series with specified values. For example, you can query the number of requests for each API by using http_requests_total. If you want to filter out APIs for which the number of requests exceeds 20, you can use the following PromQL expression to compare the value.
The following table shows the comparison operators that are supported in PromQL.