What is label cardinality, and why can it take down Prometheus?
AdvancedConceptTesting, services & metrics
Answer
Every unique combination of label values is a separate time series. Labels like user_id, request_id, full URL paths with IDs, or raw error messages create unbounded series, exploding Prometheus memory and making queries slow or the server OOM. Keep labels to small, bounded sets (method, status class, route template like /users/{id}, region). Put high-cardinality detail in logs or traces instead.
More on Testing, services & metrics
Why should automation scripts have tests at all?BeginnerHow does pytest discover and run tests?BeginnerWhy does pytest use plain `assert` instead of `assertEqual`?BeginnerWhat are pytest fixtures, and what scopes exist?IntermediateWhat built-in fixtures do you use most?IntermediateHow does `@pytest.mark.parametrize` work?Beginner