Leadership wants a yearly availability report per service, but year-long queries time out. What do you do?
IntermediateScenarioLong-Term Storage, Scale and Cost
Answer
Situation read → Raw request counters over a year is too much data per query.
What I'd do →
- Create recording rules for SLI ratios at coarse resolution:
- record: service:sli_availability:ratio_rate1h expr: | sum by (service) (rate(http_requests_total{code!~"5.."}[1h])) / sum by (service) (rate(http_requests_total[1h])) - Keep these series in long-term storage at full retention.
- Compute the yearly figure with
avg_over_time(service:sli_availability:ratio_rate1h[365d]), or better, sum good and total counts separately and divide. - Export monthly results to a table or warehouse for reporting.
Why → Pre-aggregation turns millions of series into one per service.
Interview tip → Note that averaging ratios is wrong when traffic varies; aggregate good/total events.
More on Long-Term Storage, Scale and Cost
Prometheus keeps 15 days of data, but leadership wants 13 months of metrics for capacity planning. What do you build?IntermediateThe Thanos compactor has halted and the bucket keeps growing. What do you do?AdvancedGrafana shows every series twice after you added a second Prometheus replica with Thanos. How do you fix it?IntermediateRemote write to your central store is falling further behind every hour. How do you handle it?AdvancedMimir rejects writes from a team with `err-mimir-max-series-per-user`. What do you do?IntermediateYour observability SaaS bill tripled in a quarter, driven by custom metrics. How do you bring it down?Intermediate