Scrivio Interview library
DebuggingIntermediate7 min read · updated 13 November 2026

A metrics cluster that held 8 million active series grew to 45 million in two days. Ingesters ran out of memory and restarted in a loop, dashboards showed gaps, and the growth came from one service's new metric label.

How do you find the cause of the series explosion, stop it, and keep label cardinality from taking down the metrics system again?

Every unique combination of label values is a separate series with its own memory in the head block and entries in the index, so a label holding user ids, raw paths with ids or error messages can create millions of series. We find it by counting series per metric and per label and comparing with last week, stop it by dropping or rewriting the label at ingestion with relabeling rules, then fix the code to use bounded values such as route templates. Per-tenant and per-metric series limits, alerts on series growth and labelling guidelines keep it from happening again.

Why this question is asked

A metrics cluster going from 8 to 45 million series in two days is one of the most common ways observability systems fall over, and it nearly always has the same cause: a label that seemed harmless in code review. The painful part is that the outage hits everyone, not just the team that shipped the label. Interviewers ask this to see whether we understand why cardinality, not sample volume, is what costs memory, and whether we can respond in the right order: find, stop, fix, prevent. In this answer, we will see how one label multiplies series, find the offending metric, stop the growth at ingestion, fix the code, add limits and alerts, and set guidelines.

1Why One Label Multiplies Series

A series is identified by its metric name plus every label value. Cardinality, the number of distinct series, is therefore the product of the number of values of each label. A request counter labelled with 5 methods, 10 status codes and 50 route templates has at most 5 x 10 x 50 = 2,500 series per instance. That is fine.

Now someone adds the raw request path, which contains order ids such as /orders/88213. Instead of 50 route values there are millions, and each new order creates new series. Every active series costs memory in the ingesters' head block, typically a few kilobytes, plus postings in the label index. Thirty-seven million new series at about 3 KB each is over 100 GB of memory that did not exist two days ago, which is exactly why the ingesters ran out of memory and restarted in a loop.

2Finding the Metric and the Label

First, which metric grew? Prometheus-compatible systems show series counts per metric and per label on a TSDB status page (in Prometheus, the TSDB Status page of the web UI, backed by the /api/v1/status/tsdb endpoint), and the same answer can be computed with queries.

YAML
# the 10 metric names with the most series
topk(10, count by (__name__) ({__name__=~".+"}))
# {__name__="http_server_requests_seconds_bucket"} 31480220 <- was about 300,000 last week
# which label has exploded inside it?
count(count by (uri) (http_server_requests_seconds_bucket))
# 1849310 distinct uri values
count(count by (status) (http_server_requests_seconds_bucket))
# 9

Notice that the first query is itself expensive on a cluster in trouble, because it touches every series; on a struggling cluster we prefer the status page or per-tenant series statistics the system already keeps. Comparing with last week, from a saved snapshot of the same numbers, points straight at the metric and label that jumped, and the deployment history tells us which release of which service introduced it.

3Stopping the Growth Now

The cluster must recover before anyone fixes code, so we stop the series at ingestion. Relabeling rules run on every scraped sample before it is stored, and can drop a label, rewrite its value or drop the whole metric.

YAML
scrape_configs:
- job_name: orders-service
metric_relabel_configs:
# option 1: rewrite raw paths into a template
- source_labels: [uri]
regex: '/orders/[0-9]+'
target_label: uri
replacement: '/orders/{id}'
# option 2: drop the label entirely
# - action: labeldrop
# regex: uri
# option 3: drop the metric until the code is fixed
# - source_labels: [__name__]
# regex: 'http_server_requests_seconds_bucket'
# action: drop

Once the rule is deployed, no new series arrive, and the existing ones stop receiving samples. They leave the head block when it is next cut, within a couple of hours, and ingester memory returns to normal. Until then, ingesters that crashed may need extra memory for a while, because on restart they replay their write-ahead log, which still contains the exploded series.

4Fixing the Code

The rule is a bandage; the real fix is in the service. The broken pattern usually looks like this, where a raw value goes straight into a tag.

Java
// broken: one series per order id
Timer.builder("orders.lookup")
.tag("path", request.getRequestURI()) // "/orders/88213", "/orders/88214", ...
.register(registry);
// fixed: a bounded value, the route template
Timer.builder("orders.lookup")
.tag("route", "/orders/{id}") // one value for every order
.tag("outcome", outcome) // SUCCESS, CLIENT_ERROR, SERVER_ERROR
.register(registry);

Spring Boot's built-in http.server.requests metric already uses the URI template when the request is matched by a mapped handler, which is why this usually appears in hand-written metrics or in filters that run before routing. Notice that error messages are a similar trap: a label with the exception message creates a series for each distinct message, while the exception class name is bounded.

5Preventing It With Limits and Alerts

Two guards turn the next mistake into a contained problem. Limits reject new series past a threshold: per tenant (a team or service), per metric and per scrape. Prometheus has sample_limit and label limits on a scrape, and Mimir and similar systems have per-tenant maximum series settings; check your version for exact names. When a limit is hit, only the offending tenant loses new series, and everyone else keeps working.

Alerts catch growth before it hits a limit. We alert when a tenant's active series grow by more than, say, 20 percent in an hour, and when total series approach the cluster's capacity.

Step throughWhen a new series arrives
  1. Relabel rules appliedtemplates, dropped labels
  2. Tenant under its series limit?per team or service
    YesCheck the metric limitNoReject and count the rejection
  3. Metric under its series limit?per metric name
    YesStore in the head blockNoReject and count the rejection
  4. Alert on growth rate and rejectionsowner sees it within minutes

4 steps in order. Play them, or step through them one at a time.

6Guidelines for Labels

Finally, we write down the rule teams should follow: labels take small, bounded sets of values, ideally under a hundred per label, such as route template, status class, region or outcome. Anything unbounded, such as user ids, order ids, raw paths or full error messages, belongs in logs or traces, where each event can carry as much detail as it needs.

Metrics and traces connect through exemplars: a histogram bucket sample can carry the trace id of one example request. So the dashboard stays cheap, and when someone sees a latency spike they click through to a real slow request instead of needing a label per request.

7Follow-up questions

Why not just give the ingesters more memory?

Because unbounded labels grow without limit. More memory buys a few days at best, the cost is paid by the whole platform, and the next deployment can do it again. Limits and bounded labels fix the cause; memory only delays the symptom.

Do limits risk hiding important metrics during an incident?

They can, which is why they are per tenant and per metric, alert when hit, and come with a process to raise them for a good reason. Losing new series from one misbehaving metric is far better than an ingester crash loop that blanks dashboards for every team.

How do we catch this before deployment?

Add a check in CI or staging that scrapes the service under a test load and compares series counts per metric with the previous version. A jump of ten times on one metric fails the check and shows the label responsible.

8Conclusion

In this answer, we saw that every combination of label values is a separate series costing memory and index space, so one unbounded label such as a raw path can multiply series into the tens of millions. We found the culprit by counting series per metric and label against last week, stopped the growth with relabeling rules at ingestion, fixed the code to use route templates and bounded values, added per-tenant and per-metric limits with growth alerts, and set guidelines that send high-cardinality detail to logs and traces, linked through exemplars.

What to say in the interviewAbout 90 seconds aloud

Open with

The growth comes from cardinality: every unique combination of label values is its own series, with memory in the head block and entries in the index. One label with user ids, raw paths containing ids or error messages can create millions of series, which is what pushed us from eight to forty-five million and ran the ingesters out of memory.

Then, if they want more

To find it, I look at series counts per metric name and per label, from the TSDB status page or a count by name query, and compare with last week; here it would show one metric jumping from hundreds of thousands to tens of millions and a uri label with almost two million values, which the deploy history ties to one release.

To stop it right away, I add relabeling rules at ingestion that rewrite the path into a template, drop the label, or drop the metric, so new series stop arriving and memory recovers as the head block is cut.

Then the team fixes the code to use bounded values, the route template instead of the raw path and the exception class instead of the message.

To prevent it, I set per-tenant and per-metric series limits that reject new series past the limit, alert on series growth rate and on rejections, and publish guidelines: labels hold small bounded sets, and high-cardinality detail goes in logs or traces, linked from metrics with exemplars.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "How do you find the cause of the series explosion, stop it, and keep label cardinality...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/1844660cdb/