Back to Tech Corner
DevOps

(Oct 2023) DevOps – What is Thanos, A Brief Introduction

Thanos is based on Prometheus. With Thanos, Prometheus always remains as an integral foundation for collecting metrics and alerting using local data. Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company.

Thanos is based on vanilla Prometheus and works with Prometheus versions v2.2.1. and higher. Prometheus v2.13.0+ is highly recommended due to its remote read improvements.

Best Practices and Recommended Method to Run Prometheus

  1. Prometheus ought to run in the same failure domain; same network and geographic location as the monitored services.
  2. Use a persistent disk to persist data across Prometheus restarts.
  3. Use local compaction for longer retentions.
  4. Do not change the minimum TSDB block durations.
  5. A single Prometheus instance is efficient, do not scale out Prometheus unless necessary. Thanos is used when Prometheus instance is scaled out.

Thanos Components

Following are the essential components of Thanos with a brief listing of their purpose:

ComponentExplanation
CompactorCompacts, down samples and applies retention on the data stored in the cloud storage bucket.
ReceiverReceives data from Prometheus's remote write write-ahead log, exposes it, and/or uploads it to cloud storage.
Ruler/RuleEvaluates recording and alerting rules against data in Thanos for exposition and/or upload.
Store GatewayServes metrics inside of a cloud storage bucket
Querier/QueryImplements Prometheus's v1 API to aggregate data from the underlying components.
Query FrontendImplements Prometheus's v1 API to proxy it to Querier while caching the response and optionally splitting it by queries per day
SidecarConnects to Prometheus, reads its data for query and/or uploads it to cloud storage.

Read more about Thanos here.