Skip to content
New Atlanta
Topics

Prometheus high cardinality metrics: find the labels driving growth

Rank series by metric, trace the largest contributor to its changing labels, then test one instrumentation change against an unchanged group of targets.

Published 7 min read
Series identity
Metric name and full label set
Head statistics endpoint
/api/v1/status/tsdb
Final filtering before ingestion
Metric relabeling

What is creating all these series?

A Prometheus series is identified by its metric name and complete label set. Each distinct observed combination creates a separate series. Start with the metric contributing the most series, then inspect the values that change within it.

Consider a request counter with method, status and route labels. A route template such as /orders/{id} can group requests handled by the same code. If the application labels the counter with the literal path, each order number can create a new label value. Adding a request identifier can make practically every observation a different series. Neither new customers nor a surge in real workload are necessary for the series count to rise.

Distinguish cardinality from traffic and from churn. Ten times more calls to the same set of handlers can increment the same counters. A series can also disappear and be replaced by a new series as pods or identifiers change. A steady count at the start and end of a rollout can hide that turnover. Record which problem prompted the investigation: query latency, head memory, samples sent to a backend or a change in a bill. Each needs a different closing measurement.

How do you find the largest contributor?

Inspect the TSDB statistics on the affected Prometheus server. The response includes head series counts and rankings of metric names, label names and label-value pairs. Keep the server, timestamp and scrape scope with the result.

Use the authenticated route for the existing deployment and request GET /api/v1/status/tsdb. Start with headStats.numSeries and seriesCountByMetricName. The first gives context for the head as a whole. The second narrows the search to a family of series. Compare that family with labelValueCountByLabelName, which counts distinct values associated with a label name. A label used by many unrelated metrics may rank highly across the server. Its presence in that list alone cannot assign responsibility to one exporter.

Record which replica you queried. Comparing one shard at noon with a different shard after lunch mixes workload placement into the result. If identical high-availability replicas scrape the same targets, adding their local counts describes two sets of stored observations. It need not equal the series count a downstream service uses for billing. Capture a normal business hour and a recent deployment window where they are available. Add the release identifier and number of healthy targets to both observations.

How can a query isolate the label?

Choose one suspicious metric and one job before grouping by labels. Use the TSDB ranking to narrow the investigation before asking the query engine to aggregate millions of unrelated series.

For an application that exposes http_requests_total, count(http_requests_total{job="checkout"}) counts the matching instant-vector elements at the evaluation time. Then inspect the distribution across workloads, for example with count by (instance) (http_requests_total{job="checkout"}). A single instance far above its peers points to an instance-specific rollout or workload mix. If every instance jumps together, examine shared application middleware and scrape configuration. Substitute labels that actually exist on your targets.

Examine a bounded sample of the affected metric at the exporter or in an existing diagnostic view. Look for a route label holding complete URLs, a generated job name embedded in a metric name, or an identifier attached in a common instrumentation wrapper. A query that groups by every distinct user or request identifier can itself be expensive and can display sensitive values to additional people. Aggregate by stable ownership labels first. Record the label name and a redacted example of its shape in the incident note.

Which change preserves the measurements people use?

Replace a raw path with the router's route template where the application knows the handler. Decide how to represent unmatched routes, then check requests that hit a real endpoint as well as requests that miss it.

An unmatched-path fallback that stores the literal path can undo the entire fix. Give unmatched traffic a bounded label and keep individual request diagnostics in a log or trace with the appropriate retention and access policy. If an operator depends on a particular route breakdown, ask them to identify the incident or alert it supports. Preserve that grouping in the metric and document where they can investigate a single request.

When a source change needs a release, the operator may be able to drop an entire unused metric through scrape-time metric relabeling. Check dashboards, alert rules, recording rules and remote consumers before choosing it. Dropping only a distinguishing label can collapse previously distinct samples onto the same label set, which can produce conflicting samples instead of useful totals. A recording rule can create a convenient aggregate for querying, but the original input series still enter local storage unless the ingestion path also changes. Apply any temporary rule to the smallest appropriate job.

How do you measure the change fairly?

Roll the fix to one comparable group of targets. Keep scrape intervals and backend routing constant, and compare old and new cohorts during the same traffic window.

For an illustrative checkout service, send synthetic requests for two different order IDs that use the same handler. Inspect the exported counter after each request. The route value should be identical and the count should reflect both requests. Add an unknown path, a failed response and a second handler so the test can expose an unbounded fallback or lost status dimension. Relay these checks to the team that owns the instrumentation library as well as the service.

In production, compare the matching series per healthy target, request volume and error rate for each cohort. Look for missing dashboard panels, empty alert queries and an unexplained drop in the service total. Repeat after a deployment or pod replacement, which exercises churn that a quiet ten-minute window can miss. Old series can remain visible in head or historical storage after the exporter stops producing them. Use the new scrape samples to establish that the fix took effect, then watch the longer storage windows separately.

How do series counts translate into cost?

Read the backend's billing unit and aggregation window before estimating savings. Local head series, samples ingested per second, bytes retained and distinct billable series are separate measurements.

A scrape interval change can reduce sample volume for the same label sets. A label redesign can change the number of time series while leaving request throughput unchanged. Compression, retention, remote-write filtering and service-side aggregation further affect which resource changes. Record the ingestion point and whether a reported byte count describes compressed transport, stored data or an uncompressed payload. A percentage change in one counter is poor evidence for a matching percentage change in the bill.

For a hosted comparison, use Grafana Cloud vs Datadog pricing to identify the contract units to measure. Attach a dated dashboard export or invoice interval to the estimate and specify the portion attributable to the instrumented job. Close the incident with two outcomes: whether the service kept the signals its responders need, and whether the resource that triggered the investigation returned to its expected range.

Frequently asked questions

Will a longer scrape interval remove high cardinality?

It changes how often Prometheus samples the series. The exporter can still expose every distinct label set at the next scrape.

Should every metric have the same cardinality limit?

Set the budget for the metric's purpose, target count and deployment. A bounded per-target metric can still add up across many targets.

Methodology and sources

We checked Prometheus's data model, instrumentation guide, HTTP API and configuration reference on December 3, 2026. The checkout workload is an illustrative test. Actual series counts and costs require measurements from the deployment.

About Tessa Novak
Cloud FinOps & Observability Analyst

Editorial pen name. Covers cloud billing, telemetry costs and the assumptions behind pricing comparisons.