Learn the thanos-io/thanos Codebase

Thanos is an open source project under the Cloud Native Computing Foundation (CNCF) Incubating status, which aims to create a highly available metric system with unlimited storage capacity. It can be seamlessly added on top of existing Prometheus deployments and provides features such as global query view, unlimited retention, and high availability of components, including Prometheus. Thanos leverages the Prometheus 2.0 storage format to cost-efficiently store historical metric data in any object storage while retaining fast query latencies. It also offers global querying view across all connected Prometheus servers, deduplication and merging of metrics collected from Prometheus HA pairs, and easy integration with existing Prometheus setups. The project's philosophy is inspired by UNIX philosophy and the golang programming language, with each subcommand doing one thing and doing it well, and components working together. Thanos offers various deployment options, including a sidecar for Kubernetes and a receive component for scaling out or implementing with other remote write compatible sources. Releases are performed every 6 weeks, with main branch being stable and usable, and contributions are welcome through the project's Slack channel, issue tracker, and file. Adopters of Thanos include various organizations and individuals.

make: Build all Thanos components

make examples: Build examples for Thanos

make lint: Run lint checks on Thanos codebase

make go-lint: Run Go lint checks on Thanos codebase

make docker: Build Docker images for Thanos

make shell-lint: Run shell script lint checks

make jsonnet-format: Format JSONnet files

make jsonnet-lint: Run JSONnet lint checks

make go-format: Format Go source code

make web-serve: Serve Thanos web documentation

make check-docs: Check documentation for errors

make jsonnet-vendor: Install JSONnet dependencies

make install-tool-deps: Install required tools for Thanos

make quickstart: Build and run a quickstart example


Understanding the entrypoints of an application or library is crucial for developers as it aids in comprehending the flow of the program. This includes knowledge of where the initialization code resides, the setting of global configurations, and the definition of middleware, routes, or main components. For debugging and testing purposes, identifying these entrypoints is key, enabling the setting up of breakpoints in debugging sessions and facilitating an understanding of the initialization and connection of different application parts. Additionally, when it comes to integrating with other systems or expanding an existing codebase, knowing the entrypoints provides valuable insight into where to inject new functionality or commence modifications.


This file contains the main entrypoint for the Thanos project, which includes the `main` function that initializes the application, as well as helper functions such as `interrupt` and `reload` for handling signals and configuration changes.


This script file is responsible for applying the Thanos project license to generated proto and Go files. It includes functions such as `applyLicenseToProtoAndGo`, `writeLicence`, and `main` for executing the licensing process.


This file contains the main entrypoint for the Thanos configuration generator script. Functions include `init` for initializing the generator, `name` for setting the output file name, `main` for executing the generation process, and helper functions `checkForOmitEmptyTagOption` and `checkForOmitEmptyTagOptionRec` for handling configuration options.

Root Directories & Files

A well-organized directory structure is key for easy code navigation, allowing quick file access and efficient codebase exploration. It enhances scalability and maintenance by simplifying feature updates and minimizing conflicts, thus streamlining code reviews. For new developers, it acts as a roadmap, aiding in understanding the application's structure and finding specific code segments.


This directory contains documentation for Thanos, including blog posts, components documentation, contributing guidelines, and operating instructions.


This directory contains example configurations and usage scenarios for Thanos.


This directory contains the Go source code for the internal components of Thanos, such as Cortex.


This directory contains reusable components and configurations for Thanos, written in Libsonnet and JSONnet.


This directory contains the Go packages for Thanos, including alerting, API, block management, cache, client configuration, compacting, component, deduplication, discovery, errors handling, exemplars, external annotations, gRPC, HTTP, kingpin, logging, metadata, model, pool, prober, Prometheus integration, querying, query frontend, query sharding, receive, reloader, replication, rules, run utilities, server, shipper, store, and utilities.


This directory contains test data used by the Thanos project.

Coming Soon: Learn Directly From VS Code

Dive into a world where learning and coding merge seamlessly, right within your favorite development environment!

Introducing the VS Code Extension, your gateway to mastering new skills without ever leaving Visual Studio Code. Imagine having the power to learn directly from your IDE, where every line of code you write not only builds your project but also your proficiency.

Clone Repository

After downloading, proceed to clone the repository to your local machine by executing the following command in your terminal:

git clone

Now, you can open the repository in your preferred code editor to explore or modify the project.


Here is an example of the VS Code Extension