Interview Observability

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.

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