Course contentsShow
← Cloud and Infrastructure
Lesson 630 of 2,98912. Monitoring FoundationsFree lesson

Metric Cardinality and Dimensionality

Understanding how labels create unique time series and the impact of high-cardinality metrics.

Metric Cardinality and Dimensionality

What you'll learn: How labels multiply your time series and why high-cardinality metrics can overwhelm your monitoring system.

Understanding Dimensionality

In time series monitoring, dimensions are the labels or tags you attach to metrics. Remember that each unique combination of label values creates a separate time series. For example, a metric like http_requests_total with labels {method, endpoint, status_code} adds three dimensions.

The Cardinality Explosion

Cardinality is the count of unique combinations across all label values. This is where things get tricky. If you have:

  • 5 HTTP methods (GET, POST, PUT, DELETE, PATCH)
  • 20 endpoints
  • 10 status codes

Your cardinality is 5 × 20 × 10 = 1,000 unique time series for just one metric name!

Why High Cardinality Is Dangerous

Think of cardinality like a library catalog system. A few categories (author, genre, year) work great. But if you add labels like reader_name or checkout_timestamp_seconds, suddenly you have millions of "categories" to track. Your system drowns in data.

High-cardinality metrics:

  • Consume massive storage
  • Slow down queries dramatically
  • Increase costs exponentially
  • Can crash monitoring systems

Common Cardinality Traps

Avoid labels with unbounded or highly variable values:

  • User IDs or email addresses
  • Full URLs or SQL queries
  • Timestamps or request IDs
  • IP addresses (unless aggregated)

Key Takeaway: Labels create dimensions, and every unique combination spawns a new time series. Keep cardinality low by choosing labels wisely—prefer categorical values with limited, predictable ranges over high-variability identifiers.