O'Reilly logo

Prometheus: Up & Running by Brian Brazil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Aggregation Operators

You already learned about aggregation in “Aggregation Basics”; however, this is only a small taste of what is possible. Aggregation is important. With applications with thousands or even just tens of instances it’s not practical for you to sift through each instance’s metrics individually. Aggregation allows you to summarise metrics not just within one application, but across applications too.

There are 11 aggregation operators in all, with 2 optional clauses, without and by. In this chapter you’ll learn about the different ways you can use aggregation.

Grouping

Before talking about the aggregation operators themselves, you need to know about how time series are grouped. Aggregation operators work only on instant vectors, and they also output instant vectors.

Let’s say you have the following time series in Prometheus:

node_filesystem_size_bytes{device="/dev/sda1",fstype="vfat", instance="localhost:9100",job="node",mountpoint="/boot/efi"} 100663296 node_filesystem_size_bytes{device="/dev/sda5",fstype="ext4", instance="localhost:9100",job="node",mountpoint="/"} 90131324928 node_filesystem_size_bytes{device="tmpfs",fstype="tmpfs", instance="localhost:9100",job="node",mountpoint="/run"} 826961920 node_filesystem_size_bytes{device="tmpfs",fstype="tmpfs", instance="localhost:9100",job="node",mountpoint="/run/lock"} 5242880 node_filesystem_size_bytes{device="tmpfs",fstype="tmpfs", instance="localhost:9100",job="node",mountpoint="/run/user/1000"} 826961920 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required