What is metric cardinality, and why are high-cardinality labels dangerous?
What they are really testing: Whether you understand that each label-value combination is a separate time series and that unbounded labels (user ID, request ID) can explode storage and crash a metrics system. A real operational footgun.
A real interview question
What is metric cardinality, and why are high-cardinality labels dangerous?
What most people say
drag me
“Cardinality is how many metrics you have; more is fine as long as you have storage.”
"More is fine" is the dangerous misconception. Each label-value combo is a separate time series, so an unbounded label like user ID can create millions of series and take down Prometheus. High cardinality is a top operational hazard, not a storage detail.
The follow-ups they ask next
Why is putting a user ID in a metric label a bad idea?
Each unique user ID creates a new time series, so with many users you get an explosion of series that blows up memory/storage and can crash Prometheus. Put user ID in logs or traces, not a metric label.
Where should high-cardinality data live instead?
In logs and traces, which are built to carry per-request, high-cardinality detail. Metrics should stay aggregatable with bounded labels (status, method, route template).
What the interviewer is listening for
- Knows each label combo = a series
- Knows unbounded labels explode series/memory
- Puts high-cardinality data in logs/traces not labels
What sinks the answer
- "More metrics is fine"
- Would label by user ID/request ID
- Unaware it can crash the metrics backend
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Cardinality is [the number of unique time series, every metric+label-value combo is one]. [High-cardinality labels (user ID, request ID, full URL) multiply series enormously]. That [blows up memory/storage and can crash Prometheus, a common monitoring outage]. Fix: [keep labels bounded (status, method, route template), put high-cardinality detail in logs/traces].”
Keep going with observability
Foundation
What is the difference between monitoring and observability?
Foundation
What are the three pillars of observability, and what is each good for?
Foundation
What should you measure first for a service? Explain the golden signals (or RED/USE).
Junior
What are good logging practices for a distributed system?
Junior
What are the main metric types (counter, gauge, histogram), and when do you use each?
Junior
What is distributed tracing, and how does it work?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free