Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 16, 2026·3 min de lectura

Cortex — Horizontally Scalable Long-Term Storage for Prometheus

Cortex is a CNCF project that provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus metrics, letting you run Prometheus-as-a-Service at scale.

Listo para agents

Instalación con revisión previa

Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.

Needs Confirmation · 64/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Cortex Overview
Comando con revisión previa
npx -y tokrepo@latest install a05a40a6-3943-11f1-9bc6-00163e2b0d79 --target codex

Primero dry-run, confirma las escrituras y luego ejecuta este comando.

TL;DR
Cortex provides horizontally scalable, highly available, multi-tenant long-term storage for Prometheus metrics at any scale.
§01

What it is

Cortex is a CNCF incubating project that extends Prometheus with horizontally scalable, highly available, multi-tenant long-term storage. It accepts Prometheus metrics via remote write, stores them durably, and serves PromQL queries across months or years of data. Cortex lets organizations run Prometheus-as-a-Service without losing data when individual Prometheus instances restart.

It targets platform teams and SRE organizations that run Prometheus at scale and need durable metric storage, multi-tenancy for different teams, and query federation across multiple Prometheus instances.

§02

How it saves time or tokens

Standalone Prometheus stores metrics locally and loses data on restart or disk failure. Cortex adds durable storage with object store backends (S3, GCS, Azure Blob), so metric history persists indefinitely. Multi-tenancy means one Cortex cluster serves multiple teams without running separate Prometheus stacks for each. Horizontal scaling handles growing ingestion rates without re-architecting.

§03

How to use

  1. Deploy Cortex components (distributor, ingester, querier, compactor) using Helm charts or Docker Compose.
  2. Configure your existing Prometheus instances to remote-write to Cortex's distributor endpoint.
  3. Point Grafana or other visualization tools at Cortex's query endpoint for long-term metric queries.
§04

Example

# prometheus.yml - configure remote write to Cortex
remote_write:
  - url: http://cortex-distributor:9009/api/v1/push
    headers:
      X-Scope-OrgID: team-backend

# Query long-term metrics via Cortex
# Grafana datasource: http://cortex-querier:9009/prometheus
§05

Related on TokRepo

§06

Common pitfalls

  • Cortex has many microservice components. Start with single-binary mode for testing, then decompose into microservices for production scaling.
  • Object storage costs accumulate with long retention periods. Configure compaction and downsampling to manage storage costs for multi-year retention.
  • Multi-tenancy requires setting the X-Scope-OrgID header on all requests. Missing headers cause authentication errors or data routing to a default tenant.

Preguntas frecuentes

How does Cortex differ from Thanos?+

Both add long-term storage and high availability to Prometheus. Cortex ingests metrics via remote write and stores them centrally. Thanos uses a sidecar model that reads from existing Prometheus instances and uploads to object storage. Cortex is better for centralized Prometheus-as-a-Service; Thanos is better for federated existing Prometheus deployments.

What storage backends does Cortex support?+

Cortex supports Amazon S3, Google Cloud Storage, Azure Blob Storage, and any S3-compatible object store (like MinIO) for long-term block storage. It uses a key-value store (DynamoDB, Consul, etcd, or memberlist) for hash ring coordination.

Is Cortex production-ready?+

Yes. Cortex is a CNCF incubating project used in production by multiple organizations. It also forms the basis of commercial offerings like Grafana Cloud's metrics backend.

How does multi-tenancy work?+

Each request includes an X-Scope-OrgID header identifying the tenant. Cortex isolates data and queries per tenant. Rate limits, retention policies, and access controls can be configured per tenant. This enables a single cluster to serve multiple independent teams.

Can I migrate from standalone Prometheus to Cortex?+

Yes. Add a remote_write configuration to your existing Prometheus instances pointing at Cortex. Prometheus continues scraping targets as before; Cortex stores the data for long-term retention and cross-instance queries. The migration is additive, not disruptive.

Referencias (3)

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados