Skip to content

Aggregate functions

group

  • All values in the resulting vector are 1
# all distinct metrics given a certain label value
group({service="insurance-payments"}) by (__name__)

sum

  • sum(q) by (group_labels)
  • Calculate sum over dimensions
sum(http_requests_total)
sum(http_requests_total) by (application, group)
sum(http_requests_total) without (instance)

count_values

  • Count number of elements with the same value
count_values("version", build_version)

topk

topk(5, http_requests_total)