What is cardinality cost, and how does it differ between metrics and logs? [Advanced]
Answer
Cardinality cost is the resource and financial impact of unique dimensional combinations. In metrics, cardinality creates new time series and directly affects memory, storage, and query cost. In logs, high-cardinality fields are expected, but ingest volume and indexing/search patterns drive cost.
Technical explanation
Metrics should use bounded labels because every unique label set is a new series.
Logs can contain request_id or user_id for investigation, but logging every event at high volume still creates ingest and storage cost.
Traces also have cardinality concerns through attributes, but sampling and backend indexing policies determine cost impact.
Hands-on example
Example: put user_id in logs and traces for controlled debugging, but never in Prometheus labels. For metrics, expose tenant_tier='enterprise' instead of tenant_id. For logs, control retention and indexing of user_id based on privacy and investigation requirements.
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
- What is observability, and how is it different from traditional monitoring? [Basic]
- What are the three pillars of observability (metrics, logs, traces)? [Basic]
- What is the difference between monitoring and observability in practice? [Basic]
- What are the four golden signals of monitoring? [Basic]
- What is the difference between the USE method and the RED method? [Basic]
- When would you use the USE method versus the RED method? [Basic]
- What is an SLI, an SLO, and an SLA, and how do they relate? [Basic]
- How do you choose good SLIs for a service? [Basic]