Interview Prep/Monitoring & Observability/Prometheus and PromQL at Scale

A developer added `user_id` as a metric label. What is the problem and what do you advise?

BeginnerScenarioPrometheus and PromQL at Scale
Answer

Situation read → Unbounded label values create one time series per user. That is a cardinality explosion that raises memory, CPU and storage cost.

What I'd do →

  1. Remove the label from the metric.
  2. Use bounded labels only: method, route template (/users/:id, not /users/42), status_class.
  3. For per-user analysis use logs or traces, which handle high cardinality, or use exemplars to link a metric to a trace ID.
  4. Add label_limit and sample_limit on the scrape job and a CI review check on new metrics.

Why → Each unique label combination is a separate series. A million users times 10 routes is 10 million series.

Interview tip → Rule of thumb: metrics for aggregates, logs and traces for individuals.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus and PromQL at Scale