Course contentsShow
← Cloud and Infrastructure
Lesson 637 of 2,98912. Monitoring FoundationsFree lesson

Metric Retention and Storage

Planning metric retention policies, downsampling strategies, and storage costs over time.

Metric Retention and Storage

What you'll learn: How to plan how long to keep metrics, reduce their detail over time, and manage the storage costs that come with long-term monitoring data.

Why Retention Matters

When you collect metrics, you're generating time-series data constantly—hundreds or thousands of data points per minute across your infrastructure. Storing all of this data forever would be enormously expensive and often unnecessary. You need a retention policy: a plan for how long you keep data at various levels of detail.

The Retention Lifecycle

Think of metric retention like old photos. You keep recent photos at full resolution, but older vacation shots might get downsampled to smaller sizes. You delete blurry test photos entirely.

Metrics work similarly:

  • High-resolution data (e.g., 10-second intervals) for recent time periods (last 7-30 days)
  • Medium-resolution data (e.g., 1-minute intervals) for mid-range history (last 90 days)
  • Low-resolution data (e.g., 5-minute or hourly intervals) for long-term trends (1-2 years)

Downsampling Strategies

Downsampling means reducing data granularity over time. Instead of keeping every 10-second CPU reading from last year, you might keep only hourly averages. This dramatically cuts storage costs while preserving trend visibility.

Common approaches:

  • Aggregate old data into longer intervals
  • Keep only specific percentiles (p95, p99) instead of full histograms
  • Archive critical metrics longer than routine ones

Storage Cost Considerations

Metric storage typically charges by:

  • Number of unique time series (metric name + dimensions)
  • Data points ingested per month
  • Query volume

High cardinality (many unique dimension combinations) multiplies costs quickly. Plan retention based on actual debugging needs, not "just in case."

Key Takeaway: Metric retention policies balance storage costs against troubleshooting needs by keeping recent data detailed and downsampling older data into coarser intervals—store what you need, when you need it.