Understanding the distinction between "by" aggregations and "over" transformations is one of the highest-yield concepts on the SPLK-4001 exam.
Using the "by" parameter (spatial aggregation) combines multiple Metric Time Series together at each individual timestamp, grouped by one or more dimensions—for example, .sum(by=['region', 'service']) sums across all hosts in each region and service at every 10s interval. Omitting "by" aggregates all matching MTS into a single combined series.
Using the "over" parameter (temporal transformation) evaluates each MTS independently across a sliding time window—for example, .mean(over='5m') smooths noisy 10s spikes for every single host over a rolling 5-minute window. You can chain both operations (such as .mean(over='5m').sum(by='service')) to smooth per-host data before summing across a service.
# Step 1: Smooth each host over a 5m rolling window
# Step 2: Sum the smoothed values across hosts per service
data('http.requests').sum(over='5m').sum(by='service.name').publish(label='5m Req/Service')