Metric Aggregation and Resolution
What you'll learn: How monitoring systems compress time-series data over time and why choosing the right resolution matters for storage, cost, and accuracy.
The Core Idea
When you collect metrics every second, storing every single data point forever becomes prohibitively expensive and impractical. Metric aggregation is the process of combining multiple raw data points into summary statistics over time intervals (like taking 60 one-second measurements and creating a single one-minute average). Resolution refers to the granularity of time intervals at which metrics are stored or queried—higher resolution means more frequent data points, lower resolution means broader time windows.
Why Aggregate?
Imagine a temperature sensor that reports every second. After a year, that's 31.5 million data points per metric! Most systems aggregate older data progressively:
- High resolution (1-second intervals): Keep for 1 hour
- Medium resolution (1-minute averages): Keep for 7 days
- Low resolution (1-hour averages): Keep for 1 year
Aggregation Methods
Common aggregation functions include:
avg— smooth trends, good for general monitoringmax/min— capture peaks/troughs, critical for SLA compliancesum— totals for counters (like request counts)percentiles— understand distribution (p95, p99 latency)
The Trade-Off
Higher resolution gives precise detail but costs more storage and query performance. Lower resolution saves money but loses spike visibility. You can't detect a 5-second outage if you only store 1-minute averages.
Key Takeaway: Metric aggregation reduces time-series data storage by combining points into summary statistics at different resolutions—balance detail needs against cost and retention requirements.