Skip to content
RED SAGSkills
mediumSite Reliability Engineer interview question

Your Prometheus servers are running out of memory because of too many time series. How do you find the cause and keep cardinality under control?

What the interviewer wants to hear

  • Use TSDB status and queries to find the metrics and labels with most series
  • Remove unbounded labels such as user IDs, request IDs and raw paths
  • Use relabeling or metric_relabel_configs to drop or aggregate
  • Set limits such as sample_limit and review new metrics
  • Move high-detail data to logs or traces

Model answer

First I find what is growing. The Prometheus TSDB status page lists the metrics and label names with the most series, and a query like topk(10, count by (__name__)({__name__=~".+"})) confirms it. Usually it is one metric with an unbounded label, such as user ID, request ID, full URL path or pod names that change on every deploy. I work with the owning team to remove or bucket that label, for example using a route template instead of the raw path. In the meantime I can drop the label or the metric with metric_relabel_configs. To stop it happening again I set sample_limit per scrape job, add cardinality alerts, and review new instrumentation in code review. Per-request detail belongs in logs or traces, and recording rules can keep useful aggregates.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Site Reliability Engineer questions