Functions such as rate, delta, increase, and {agg}_over_time support operations only on the original metrics. They do not support operations on the result sets of operators or functions. Examples:
- Supported
SQL
max_over_time(go_goroutines[1m]), This function calculates the maximum metric value one minute ago for each timeline.
- Not supported
SQL
max_over_time(max(go_goroutines)[1m]), This expression tries to calculate the maximum value between timelines and then select the maximum value one minute ago.
- Correct use
SQL
PromQL achieves the preceding purposes by using subqueries. You must change the PromQL statement to the following form:
max_over_time(max(go_goroutines)[1m:10s])
The two parameters a and b in a subquery represent the range and step.