Thanos is a CNCF Sandbox project that extends Prometheus to create a global-scale, highly available monitoring system. It is built using Prometheus components and is already used in production by many companies for high multi-cloud scale metrics while keeping low maintenance costs. The Thanos components can be categorized into three groups: metric sources, stores, and queriers.
Metric Sources
Sidecar
The Sidecar component connects to Prometheus, reads its data for query and/or uploads it to cloud storage. It can be used to extend Prometheus with long-term storage capabilities and high availability.
Example:
thanos sidecar --prometheus.url=http://localhost:9090 --store.gcs.bucket=my-bucket
Receiver
The Receiver component receives data from Prometheus’s remote write write-ahead log, exposes it, and/or uploads it to cloud storage. It can be used to create a multi-tenant horizontally scalable metrics ingestion system.
Example:
thanos receive --http-address=0.0.0.0:1098 --grpc-address=0.0.0.0:1099 --rules-address=0.0.0.0:1100 --log-level=info
Stores
Store Gateway
The Store Gateway serves metrics inside of a cloud storage bucket. It can be used to query data directly from the storage.
Example:
thanos store --http-address=0.0.0.0:1090 --store.gcs.bucket=my-bucket
Compactor
The Compactor compacts, downsamples and applies retention on the data stored in the cloud storage bucket. It can be used to optimize the compaction of very large blocks and streamline the receiver.
Example:
thanos compact --store.gcs.bucket=my-bucket
Queriers
Querier/Query
The Querier/Query component implements Prometheus’s v1 API to aggregate data from the underlying components. It can be used to query data across the entire fleet.
Example:
thanos query --http-address=0.0.0.0:1091 --store=my-store
Rule (aka Ruler)
The Rule (aka Ruler) component evaluates recording and alerting rules against data in Thanos for exposition and/or upload. It can be used to make the ruler scalable and stateless.
Example:
thanos rule --http-address=0.0.0.0:1092 --rules-file=my-rules.yaml
For more information, you can refer to the official documentation:
You can also refer to the following videos for a deeper understanding of Thanos components:
- Thanos: Easier Than Ever to Scale Prometheus and Make It Highly Available
- Thanos: Cheap, Simple and Scalable Prometheus
- Turn It Up to a Million: Ingesting Millions of Metrics with Thanos Receive
- Shipping Metrics From the Edge
- Autoscaling Multi-Cluster Observability with Thanos and Linkerd
- Intro to Thanos: Scale Your Prometheus Monitoring With Ease