Retention & Downsampling

Retention Rules

Retention rules define how long metrics data is stored. By default, data is retained indefinitely.

The Thanos Compactor manages retention through a single parameter: compactor.retention.days. This setting applies uniformly to all data resolutions:

  • Raw metrics
  • 5-minute downsampled data
  • 1-hour downsampled data

Configure Retention via API

Note: Retention configuration is currently only available via the REST API. The Exoscale Portal does not support this feature.

Use the Update Thanos Service API to set the compactor.retention.days parameter:

curl -X PUT "https://api-{zone}.exoscale.com/v2/dbaas-thanos/{service-name}" \
  -H "Content-Type: application/json" \
  -d '{
    "thanos-settings": {
      "compactor.retention.days": 90
    }
  }'

Retention Considerations

  • Cost: Longer retention periods increase storage costs
  • Compliance: Some regulations require specific retention periods
  • Query performance: Downsampled data (5-min and 1-hour intervals) improves query performance for older data

Downsampling

Thanos automatically downsamples metrics data to optimize query performance over large time ranges. The Compactor creates downsampled blocks based on the age of the data:

  • Raw metrics older than 40 hours are downsampled to 5-minute resolution
  • Metrics older than 10 days are downsampled to 1-hour resolution
ResolutionDescriptionCreated AfterUse Case
RawOriginal metric resolutionRecent data, detailed analysis
5-minuteAggregated every 5 minutes40 hoursMedium-term queries
1-hourAggregated every hour10 daysLong-term trends, dashboards

Downsampling preserves essential aggregations (min, max, sum, count) to enable fast queries across months or years of data.

Note: Downsampled blocks are stored alongside raw data, not in place of it. Reducing storage requires configuring retention rules. See the official Thanos documentation for details on how retention interacts with downsampling.

Last updated on