Cross-sectional aggregations are the easiest to understand. As we can see in the following data representation, we take a column of data and apply an aggregation function to it:
Location/Time | t=0 | t=1 | t=2 | t=3 | t=4 | t=5 | t=6 |
Factory | 1,045 | 1 | 2 | 3 | 4 | 5 | 6 |
Warehouse | 223 | 223 | 223 | 223 | 224 | 224 | 224 |
Headquarters | 40160 | 40,162 | 40,164 | 40,166 | 40,168 | 40,170 | 40,172 |
If we apply the max() aggregation, we can find out which location reported more coffees were dispensed—in this case, the result would be 40,172. Applying count() would give us the number of offices reporting data for the dimensions that were selected ({company=ACME, beverage=coffee}): 3.
This type of aggregation usually applies to the last data points in the requested set. The most common case where this is not true is when graphing the aggregation over time, as it needs to be calculated for each point in the graph.
You will notice that the selected data resembles a traditional column vector from linear algebra. As we'll see in Chapter 7, Prometheus Query Language – PromQL, dedicated to PromQL, these will be referred to as instant vectors.