Course contentsShow
← Cloud and Infrastructure
Lesson 1984 of 2,98942. Observability - MetricsFree lesson

Thanos Query and Query Frontend

Using Thanos Query to federate multiple Prometheus instances and Query Frontend for query caching and splitting.

Thanos Query and Query Frontend

You'll learn how Thanos Query federates multiple Prometheus instances into a single view and how Query Frontend optimizes performance through caching and query splitting.

What Is Thanos Query?

Thanos Query acts as a unified query layer sitting atop multiple Prometheus instances. Instead of hitting each Prometheus separately, you send PromQL queries to Thanos Query, which intelligently fans them out to all available Prometheus servers (via Thanos Sidecars or Store Gateways) and merges the results.

Think of it like a master librarian who, when you ask for a book, simultaneously checks multiple library branches and combines what they find into one answer.

Thanos Query deduplicates overlapping data (from replica Prometheus instances) using replica labels, ensuring you see clean, unified metrics even when multiple sources report the same data.

What Is Query Frontend?

Query Frontend sits in front of Thanos Query as a performance accelerator. It provides:

  • Query caching: Repeated queries return cached results instantly
  • Query splitting: Large time-range queries are broken into smaller chunks, processed in parallel, and reassembled
  • Request queuing: Prevents overloading downstream Query components

Think of Query Frontend as a smart assistant who remembers recent questions and breaks big research tasks into manageable pieces, making the librarian's (Query's) job easier and faster.

Why It Matters

Together, Query and Query Frontend let you:

  • Access metrics across all your Prometheus instances with one endpoint
  • Handle long-term historical queries efficiently (days or weeks of data)
  • Reduce load on individual Prometheus servers
  • Improve dashboard and alerting performance through caching

Key Takeaway: Thanos Query federates multiple Prometheus sources into a single query interface, while Query Frontend accelerates performance through intelligent caching and query splitting—essential for scalable, multi-cluster observability.