When using labeled metrics, you can display a graph using the PromQL query language. The following PromQL features are supported in Mackerel.
Time series selector
- Vector selector
=(equality label matcher)!=(inequality label matcher)=~(regular expression label matcher)!~(negative regular expression label matcher)
- Range vector selector
Modifiers
Aggregation operators
Also, the by and without modifiers for controlling the labels used for aggregation are supported.
Binary operators
Defined in 4 patterns: (vector) x (vector), (vector) x (scalar), (scalar) x (vector), and (scalar) x (scalar).
To perform vector operations, a mechanism called vector matching is implemented. One-to-one correspondence (arithmetic and comparison operators) and many-to-many correspondence (set operators) have already been implemented.
One-to-many correspondence using the group_left and group_right modifiers is not implemented.
Arithmetic operators
Comparison operators
Logical/set binary operators
Functions
Counter Caluculation Functions
<aggregation>_over_time Functions
Label Functions
Type Conversion Functions
Variables
Variables related to the display time range are supported.
Range variables
$__intervalis the interval between points on the graph, determined by the display time range. It can be used with<aggregation>_over_timefunctions to express calculations between adjacent points.$__rate_intervalis an interval determined by the display time range. Since it is set to a value greater than or equal to the point interval$__interval, it is useful when combined withirate()orincrease().$__rangeis the display time range.
Range variables expand to seconds by default. They can be expanded in milliseconds using the ${<variable name>:milliseconds} syntax.
Time variables
$__from and $__to expand to the UNIX timestamp in seconds representing the start time and end time of the display time range, respectively.