Interview Observability

How does Prometheus handle high cardinality, and why is it a problem? [Intermediate]

Answer

Prometheus handles high cardinality poorly when too many unique label combinations create too many time series. It increases memory, disk, CPU, query latency, and remote-write cost, and can make Prometheus unstable.

Technical explanation

Cardinality is the number of unique time series, not just the number of metric names.

Labels like user_id, request_id, session_id, full URL, IP address, or order ID can create unbounded series.

Prevention is better than cleanup: enforce metric naming and label-review standards before production.

Hands-on example

Hands-on: run topk(20, count by (__name__)({__name__=~'.+'})) to identify large metrics, and count by (label_name) is not directly available, so use tooling such as promtool, Mimirtool, or TSDB status. Drop bad labels at scrape or instrumentation before retention cost grows.

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More Observability interview questions

← All Observability questions