Interview Observability

What causes a cardinality explosion, and how do you prevent it? [Intermediate]

Answer

A cardinality explosion happens when a metric label has many or unbounded values, or when multiple labels multiply together unexpectedly. It is prevented by limiting labels to stable, bounded dimensions and reviewing instrumentation before release.

Technical explanation

Common causes are raw URL paths with IDs, customer IDs, pod UIDs, exception messages, dynamic queue names, and per-request labels.

Use templated routes like /orders/{id} instead of /orders/12345.

Apply metric relabeling carefully, but fixing instrumentation at source is the best solution.

Hands-on example

Example: replace http_requests_total{path='/users/123/orders/456'} with http_requests_total{route='/users/{user_id}/orders/{order_id}', method='GET', status='200'}. For user-level debugging, use logs or traces, not metric labels.

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