Thanos: Long-Term Prometheus Storage Without the Operations Burden

Philip Rehberger Nov 13, 2026 6 min read

Keep a year of metrics affordably. Covers Thanos vs Cortex vs VictoriaMetrics.

Prometheus's default retention is 15 days. The reasoning is sound — Prometheus is built for fast local queries, not durable archival — but the consequence is that any question of the form "how does this week compare to the same week last year" requires a different system.

Thanos is the most-deployed answer to that problem. It bolts onto an existing Prometheus deployment, uploads its data blocks to object storage, and provides a query interface across both recent (Prometheus) and historical (object storage) data. The retention extends from weeks to years at a fraction of the cost of running Prometheus longer.

This guide covers what Thanos actually does, how the components fit together, and how to choose between Thanos, Cortex / Mimir, and VictoriaMetrics for long-term storage.

The Components

Thanos is intentionally modular. A full deployment uses several components, each solving one problem.

Sidecar. Runs alongside each Prometheus instance. Two jobs: ship Prometheus's TSDB blocks to object storage as they roll over, and expose Prometheus's data to the Thanos Query layer over gRPC.

Store Gateway. Reads data from object storage and serves it through the same gRPC API as the sidecar. This is what lets queries hit historical data.

Query (Querier). The query layer. Talks to all sidecars and store gateways, deduplicates results, and exposes a PromQL-compatible HTTP endpoint. Grafana points at the Querier instead of at Prometheus.

Compactor. Periodically compacts older blocks in object storage into larger ones with progressively lower resolution. A year of data takes meaningfully less storage as the compactor reduces 15s-resolution blocks to 5m and 1h aggregations.

Receiver (optional). A push-based alternative to the sidecar. Prometheus uses remote write to send data directly to Thanos receivers. Useful when Prometheus and Thanos are in different networks.

Ruler (optional). Evaluates recording and alerting rules across all data, including historical. Useful for rules that need long-term context.

A typical setup runs sidecar, store gateway, query, and compactor. The receiver and ruler are added when their specific use cases appear.

How Storage Costs Drop

Thanos's biggest selling point is cost. Storing a year of metrics on a Prometheus VM costs whatever EBS or local SSD costs at that volume — often hundreds to thousands of dollars per month for a moderate workload. The same data in S3 with Thanos costs an order of magnitude less.

Three mechanisms drive the savings:

  • Object storage pricing. S3 standard is ~$0.023/GB/month. Glacier and intelligent tiering reduce that further for cold data. EBS gp3 is roughly 5x.
  • Downsampling. The Thanos compactor produces 5-minute and 1-hour resolution versions of older data. Queries against long time ranges automatically use the lower resolution. Storage drops proportionally.
  • Compression. Prometheus's blocks are already well-compressed; Thanos preserves the format. Some setups add additional compression at the object-store layer.

For a workload with 1M active series at a 15-second scrape interval, the difference between EBS-resident Prometheus retention and Thanos with S3 storage is typically 5-10x in monthly cost.

Thanos vs Cortex / Mimir

Thanos and Mimir (Cortex's successor) solve overlapping problems but differ structurally.

Thanos keeps Prometheus as the primary write path. Data lives in Prometheus for short-term, gets shipped to object storage for long-term. Queries combine both sources. Architecturally, the Prometheus instances are the source of truth; Thanos is a wrapper.

Mimir receives writes directly via remote write and stores all data in its own backend. Prometheus is a stateless scraper that forwards everything. Mimir handles all storage, querying, and rules.

The practical differences:

  • Thanos is simpler when you already have Prometheus instances. Add the sidecar and you have long-term storage.
  • Mimir is better at multi-tenant isolation. Per-tenant limits, query isolation, and authentication are first-class.
  • Mimir's write path is push-based and elastic. Easier to scale ingest. Thanos's sidecar model scales with Prometheus instance count.
  • Mimir has more operational complexity. Ingester, distributor, store-gateway, querier, compactor — more components to operate.

A rough decision rule: if you have a small number of large Prometheus instances, Thanos is simpler. If you have many tenants or many small Prometheuses pushing remotely, Mimir is shaped for it.

VictoriaMetrics as an Alternative

VictoriaMetrics deserves its own paragraph. It is a separate metrics database — not Prometheus-derived — that ingests via remote write and serves PromQL queries. The selling point is operational simplicity: one or two binaries, fast ingest, low storage footprint, and a more permissive query engine than Prometheus.

For teams without an existing Prometheus deployment, VictoriaMetrics often delivers what Thanos provides with less moving parts. The tradeoff is that it does not directly leverage Prometheus's local storage; everything goes through remote write.

If you are starting fresh today, evaluate VictoriaMetrics alongside Thanos and Mimir before defaulting to the Prometheus + Thanos combination.

Operational Details That Matter

A few specifics that bite Thanos deployments in production.

Block synchronization. The sidecar uploads completed blocks to object storage. There is a window where the most recent block is local to Prometheus but not yet uploaded. The Querier deduplicates results, but you need both the sidecar gRPC and the store gateway to see the full picture for recent time ranges.

Compaction lag. The compactor must keep up with new uploads. If it falls behind, store gateway queries against historical data get slower. Monitor thanos_compact_halted and the lag of newest object-store blocks.

Object store consistency. S3 is eventually consistent on overwrites in some configurations. Thanos relies on object versioning or atomic writes; check the deployment guide for your specific object store. GCS and modern S3 (with strong consistency in 2020+) are both fine.

Query fan-out. Querier sends each query to every store gateway and every sidecar in scope. With many components, this fan-out cost matters. Use store-time-range labels so queries skip irrelevant components.

Cardinality. Same as plain Prometheus — high-cardinality labels destroy long-term storage. Audit before enabling long retention.

A Minimum Viable Thanos

For a single-cluster Prometheus setup ready to add long-term storage:

  1. Add the Thanos sidecar container to the Prometheus pod. Configure it with object storage credentials.
  2. Set Prometheus retention to 2-7 days (down from default 15). Storage savings from this alone are real.
  3. Deploy Thanos Store Gateway pointing at the same object storage.
  4. Deploy Thanos Querier pointing at the sidecar gRPC and the store gateway gRPC.
  5. Point Grafana at the Querier instead of Prometheus.
  6. Deploy the Compactor on a long-running job.

This is a single afternoon for a one-cluster setup and immediately extends retention from days to years.

When Not to Use Thanos

Thanos is the wrong tool when:

  • You only have one Prometheus and short retention is fine. The added complexity does not pay off.
  • You want a managed solution. Run Grafana Cloud, Datadog, or Mimir-hosted instead.
  • Your metrics are low-cardinality and slow-changing. Prometheus alone with extended retention is simpler.

When it does pay off — multiple clusters, long retention needs, organic Prometheus growth — Thanos is the most-deployed answer for a reason. The component model is intentional, the documentation is solid, and the operational pattern is well-trodden.


Deciding how to extend Prometheus retention without rebuilding your metrics pipeline? We help teams design long-term metrics setups that scale with the data. scopeforged.com

Share this article

Related Articles

Need help with your project?

Let's discuss how we can help you build reliable software.