프로메테우스 promQL을 사용할 경우 Aggregation Operators와 함께 사용하는 경우가 빈번하다.
-
sum
(calculate sum over dimensions)
-
min
(select minimum over dimensions)
-
max
(select maximum over dimensions)
-
avg
(calculate the average over dimensions)
-
stddev
(calculate population standard deviation over dimensions)
-
stdvar
(calculate population standard variance over dimensions)
-
count
(count number of elements in the vector)
-
count_values
(count number of elements with the same value)
-
bottomk
(smallest k elements by sample value)
-
topk
(largest k elements by sample value)
-
quantile
(calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions)
이 오퍼레이터들은 without 또는 by와 함께 사용가능하다.
- without : group by와 유사한데 해당 라벨만 제외하고 group by를 수행한다.
- by : 기존에 사용하던 group by와 동일하다.
예를 들어 process_count에 group이라는 라벨이 있을 경우 아래와 같이 사용할 수 있다.
sum(process_count_total) by (group)
sum(process_count_total) without (group)
으로 사용할 수 있다.
여기서 주의해야할 점은 by 또는 without 다음에 나오는 label list는 괄호로 묶여야 한다는 점이다. 괄호로 묶지 않으면 정상적인 쿼리문이 아니게 된다. 즉, 아래와 같은 쿼리는 동작하지 않는다.
sum(process_count_total) by group
추가로 vector expression이 길다면 by 또는 without구문을 앞으로 가져올 수도 있다.
sum by (group) (process_count_total)