Cardinality & Observability Cost

Why cardinality blows up Prometheus, the math behind log/trace cost, and how to control them.

Overview

Observability is a major budget line

Observability is one of the largest line items in modern infrastructure budgets. Datadog's S-1 shows customers spending double-digit percentages of cloud spend on observability alone, so understanding the cost levers is now an SRE-grade skill.

For metrics, the biggest lever is cardinality. Every label you put on a metric multiplies the number of series it creates. Bounded labels keep a metric at thousands of series, which is cheap. A label such as user_id pushes it to billions of series, and the server runs out of memory (OOM).

Key concepts

  • Cardinality
  • Cardinality bomb
  • Sampling policy
  • Retention tiering
  • Pre-aggregation

Interview questions

  • I added a metric label and Prometheus is OOMing. Why?
  • How do you decide on a trace sampling rate?
  • How would you cut a $200K/month Datadog bill?

Sign up free to read the full topic

More SRE topics

Start free on Cariara · Coding problems · System design studio