The engineering observability cardinality governance decision record: why the cardinality budget you chose determines your time-series database scaling ceiling and your metrics visibility surface

Cardinality governance is treated as a Prometheus tuning concern — a scrape limit, a head chunk setting, a recording rule — not as a founding instrumentation decision with scaling consequences that compound over time. The first label added to the first metric establishes the cardinality model that every subsequent engineer follows: the value domains that are acceptable as label values, the per-service series budget, the enforcement mechanism for new instrumentation. Three founding choices — the high-cardinality dimension policy, the cardinality budget model, and the enforcement and alerting model — determine how efficiently the TSDB scales as the product grows, how silently the TSDB approaches saturation, and how much remediation is required when the cardinality model fails under production load.

A 19-person developer tools startup was operating a Prometheus-based monitoring stack for their API platform. The founding engineer had instrumented the core HTTP handler with a standard request counter — http_requests_total — carrying three labels: method (GET, POST, PUT, DELETE), status_code (200, 400, 401, 403, 404, 500), and endpoint (twenty-two distinct route categories). The resulting series count for the request counter was 4 × 6 × 22 = 528 unique series — a reasonable footprint that left substantial headroom below the team's Prometheus instance sizing of approximately 500 MB allocated for head chunk storage.

In the platform's fourteenth month of operation, a senior engineer joined the team and was tasked with improving the team's debugging experience during customer-reported incidents. The engineer's observation: when a customer reported an error, the team could identify that requests to /documents were returning 500 errors from the metrics dashboard, but could not identify which specific users were affected without joining the metrics time range against the application log stream. The engineer proposed adding a user_id label to the request counter so that the metrics dashboard could filter by customer during an incident investigation. The proposal was reviewed briefly in a Slack thread and in an AI chat session where the engineer explored the Prometheus documentation for the relabeling approach. No one on the team was familiar with the concept of cardinality explosion; the AI session did not surface the cardinality implication, and the Prometheus documentation passage about label cardinality was in a separate section the engineer did not reach. The change was approved and deployed in a Thursday afternoon release.

The platform had 1,400 registered users at the time of deployment. Within four hours of deployment, the Prometheus target's scraped series count had grown from 528 to 1,400 × 528 / 22 × 22 — in practice, as users made requests across different endpoint, method, and status_code combinations, Prometheus began creating unique series for every unique (user_id, method, status_code, endpoint) combination. By midnight Thursday, the active series count on the request counter metric alone had exceeded 180,000. By Friday afternoon, as users across different time zones made their first requests of the day, the active series count on http_requests_total reached 1.4 million.

The Prometheus instance was running on a server with 8 GB of RAM. At 1.4 million active series — each consuming approximately 3–4 KB of head chunk memory — the head block alone required 4.2–5.6 GB. At 6:17 PM on Friday, Prometheus was killed by the out-of-memory killer. The monitoring stack went dark: no metrics were scraped, no alerts were evaluated, no dashboards were responsive. The team received no alert about the Prometheus failure because all alert evaluation had stopped.

At 9:43 PM on Friday, the application's connection pool to the production PostgreSQL database began exhausting. The API was returning 503 errors to users under moderate load. The first signal in a normally-instrumented system would have been a Prometheus alert on http_requests_total status_code=503 exceeding threshold — but that alert had stopped evaluating six hours earlier when Prometheus died. The first human-visible signal was an email from an enterprise customer reporting that their document sync integration was returning errors. By the time the on-call engineer identified the connection pool root cause (a slow query introduced in the Thursday release was holding connections longer than expected, combined with Friday evening traffic), the outage had been live for forty-one minutes. The connection pool remediation took twelve minutes; the Prometheus remediation — identifying the user_id label as the cause, deploying a metric_relabel_config drop rule, waiting for the OOM-killed series to be cleared from the TSDB — took an additional four hours over the weekend. Every dashboard and alert had to be re-verified after the TSDB series deletion to confirm the monitoring coverage was restored to its pre-incident state.

A 34-person data pipeline company was building an event processing platform for retail analytics customers. Their pipeline infrastructure was instrumented with Prometheus metrics tracking job execution — pipeline_job_duration_seconds, pipeline_job_records_processed_total, and pipeline_job_errors_total. The pipeline executed customer-defined data transformation jobs on a scheduled basis; each job run was identified by a system-generated job ID.

The founding engineer who built the pipeline observability had added a job_id label to all three pipeline metrics with a specific debugging rationale: when a customer reported that their pipeline run had produced incorrect output, the engineer wanted to be able to filter the duration and error metrics by that specific job ID on the Grafana dashboard rather than joining across the metrics time range and the application log. The rationale was sound for the team's current scale — at launch, the platform was running approximately fifty jobs per day, producing roughly fifty unique job IDs per day in the TSDB. At that volume, the total series count across the three metrics was approximately 50 × 3 = 150 new series per day, with series from completed jobs becoming inactive after their scrape window closed. The active series count remained stable at around 1,500 — the number of active jobs at any given moment.

What the founding engineer had not anticipated was that InfluxDB's series cardinality index — unlike Prometheus, which manages series in-memory and allows inactive series to be collected — retains the index entry for every unique series that has ever been written to a bucket, even after the series becomes inactive. InfluxDB's TSM storage engine maintains a Time Series Index that grows monotonically with every new unique tag combination. After eleven months of operation, the platform was processing approximately 600 jobs per day. The total unique job IDs written to the InfluxDB TSDB since the platform's first day of production had accumulated to approximately 180,000 — 180,000 × 3 metrics × average 4 label combinations per metric = approximately 2.16 million unique series in the Time Series Index.

The symptoms were visible in the dashboard before the team understood the root cause. Dashboard panels that queried pipeline_job_duration_seconds had been returning in under two seconds for the platform's first six months. By month eight, those panels were taking eight to fifteen seconds. By month ten, some panels were timing out at thirty seconds with Grafana returning "query timeout" rather than data. By month eleven, the pipeline debugging dashboards were effectively unusable — queries against any of the three pipeline metrics returned in ninety seconds or longer, well past the point where an engineer investigating a customer complaint would wait for the result.

The team's response had been incremental: increasing InfluxDB's query timeout setting, upgrading the InfluxDB instance size, disabling the unused panels from the dashboard, and routing some debugging queries to the application log store instead of the metrics store. No one had identified the job_id label as the root cause because the symptoms — slow dashboard queries — did not obviously indicate a cardinality issue. The debugging dashboards had been slow for so long that the engineers who had joined the company in the previous eight months simply assumed that pipeline metrics queries were expensive by nature. The cardinality issue was identified only when the team was planning an InfluxDB upgrade to the next major version and ran influx query 'show series cardinality' as part of the migration assessment — revealing that the pipeline bucket had accumulated 2.16 million unique series against an InfluxDB instance that was sized for 500,000. The remediation required a bucket deletion and re-ingest of the historical pipeline data with the job_id label removed — a process that deleted four months of detailed per-job metrics history and required re-building the pipeline debugging workflow around log queries rather than metrics.

A 58-person B2B SaaS providing supply chain analytics to mid-market manufacturers had operated a self-hosted Prometheus stack for three years. The founding engineering team had established a label taxonomy during the platform's first year: service (the name of the service emitting the metric), environment (prod, staging, dev), region (us-east-1, eu-west-1, ap-southeast-1), and pod (the name of the Kubernetes pod). The pod label used Kubernetes pod names as configured by the team's naming convention: {service}-{environment}-{deployment_hash} — a deterministic format where the deployment hash was derived from the git commit SHA of the most recent deployment, producing values like supply-forecast-prod-a3f8c2. Because the deployment hash component was a 6-character truncation of the commit SHA, the total unique values of the pod label for any given service was bounded by the number of distinct deployments — typically five to ten active deployments per service with the team's rolling update strategy.

In the platform's fourth year of operation, the company acquired a 15-person startup building a demand sensing product that was complementary to the supply chain analytics offering. The acquired team had been running a Prometheus stack of their own. Their instrumentation convention had evolved differently: the pod label they attached to all metrics used the full Kubernetes pod name as generated by the Kubernetes ReplicaSet controller — a format that appended a 5-character alphanumeric suffix that was randomly generated for each pod instance: {deployment_name}-{replicaset_hash}-{pod_suffix}, producing values like demand-signal-processor-7d8f9b-xk4p2. This was not a careless choice by the acquired team's engineering lead — the random suffix was the standard Kubernetes pod naming format, and it provided pod-level granularity for debugging in a team that ran frequent pod restarts during their early growth phase. At the acquired team's scale — running twelve microservices with an average of three pods per service — the total unique pod label values accumulated at approximately 36 new series per pod rollout event, with pod rollouts happening two to three times per week per service. Over two years of operation, the acquired team had accumulated approximately 36 × 2.5 × 52 × 12 = 56,160 unique pod label values in their Prometheus TSDB. Manageable.

When the acquiring team merged the acquired team's service infrastructure into the shared Prometheus setup after the acquisition closed, the combined series count was not 56,160 + the acquiring team's existing series count — it was the product of the acquired team's metric label combinations applied at the acquired team's deployment velocity going forward. The acquired team's twelve services, running with an average of eight pods per service in the combined production environment (up from three at the smaller startup), producing new pod names on every Kubernetes pod replacement event (which happened ten to fifteen times per hour across the fleet during normal operation), were creating approximately 15 × 8 × 2 = 240 new unique series per pod replacement event, at a rate of twelve per hour per service × 12 services = 144 new unique pod-label series per hour, plus the series count from the new label combinations across all the acquired team's metrics. Within sixty days of the merger, the combined Prometheus setup had accumulated 120 million total series in the Time Series Index.

The Prometheus instance — a single node with 64 GB of RAM — had operated the acquiring team's workload for two years without incident. The combined series count crossed the instance's practical capacity ceiling during the nightly compaction cycle, when Prometheus needed to load the full Time Series Index into memory to merge historical blocks. The compaction process ran nightly at 2:00 AM and was killed by the OOM killer at approximately 2:40 AM when memory pressure from the index load combined with the ongoing head chunk memory requirements exceeded 60 GB. Prometheus was automatically restarted by systemd, served the in-memory head block data throughout the day, and OOM-crashed again at the next compaction cycle. The alert for Prometheus availability was owned by the acquiring team's platform engineers — the alert fired at 2:40 AM, the on-call engineer restarted the service, and filed a ticket for morning investigation. This pattern repeated for twelve consecutive nights before the platform team escalated to a full infrastructure incident review.

The root cause investigation took two days: the platform team initially investigated memory leaks in the Prometheus binary, then compaction configuration parameters, then whether the combined series count from both teams' workloads exceeded the instance's sizing. Running curl localhost:9090/api/v1/status/tsdb on a healthy daytime instance revealed the 120 million series count. The remediation required a three-phase approach: deploy metric_relabel_config rules on the acquired team's services to drop the random pod suffix from the pod label (replacing demand-signal-processor-7d8f9b-xk4p2 with demand-signal-processor for the label value), trigger a Prometheus series tombstone for all series carrying the old pod label format, and wait for compaction to clear the tombstoned series from historical blocks. The tombstone and compaction cycle required six weeks to complete because the historical blocks containing 120 million series could not be compacted in a single pass without the OOM. The team implemented a staggered compaction schedule that limited the number of blocks compacted per night, extending the full remediation to two months from identification to stability.

Structural properties set by the cardinality governance decision

Two structural properties are determined by the founding decisions about cardinality budgets, label taxonomy, enforcement models, and monitoring. Both are invisible during early development when the TSDB is operating well below its series count ceiling and dashboard queries return in under a second regardless of cardinality. Both become visible under scale conditions: when the product grows its user base, when the pipeline accumulates job history, when an acquisition brings a team with different instrumentation conventions, and when the TSDB's series count approaches the boundary where compaction and query planning become memory-intensive operations.

Property 1: Time-series database scaling ceiling. The time-series database scaling ceiling is the highest active series count, highest write throughput, and lowest query latency that the TSDB can sustain — the most responsive alert evaluation, the most granular dashboards, the most reliable uptime during compaction — bounded by the cardinality model the team has established. Three components. The series count model component: Prometheus and InfluxDB both use a time series index that grows with the total number of unique label combinations ever written, not just those currently active; the memory footprint for Prometheus head chunk storage is approximately 3–5 KB per active series, but the Time Series Index overhead in InfluxDB and the WAL compaction overhead in Prometheus scale with the total unique series count across the full retention window, not just the active count; a TSDB that has accumulated 120 million unique series across its retention history requires 120 million index entries to be loaded into memory during compaction regardless of how many of those series are currently active, and the memory required for that index load is the ceiling-determining constraint — not the memory required for active series alone. Connect to the observability platform decision record: the choice between self-hosted Prometheus and a managed observability platform (Datadog, Grafana Cloud, Honeycomb) shifts the cardinality ceiling management from the team's operational responsibility to the vendor's infrastructure and billing model; managed platforms enforce cardinality limits through per-series pricing rather than through TSDB OOMs — the ceiling manifests as a billing anomaly rather than an infrastructure failure, which is earlier and more legible but requires the team to monitor their cost dashboards with the same rigor they would apply to a self-hosted TSDB's series count metrics. The label cardinality governance model component: each additional label attached to a metric multiplies the potential series count by the cardinality of that label's value domain; a governance model that permits enumerable label value sets — where every possible label value is known at schema design time and the total count is bounded — produces a TSDB series count that is predictable and can be sized for in advance; a governance model that permits unbounded label value sets (user IDs, request IDs, job IDs) produces a TSDB series count that is unbounded and grows proportionally with the system's usage scale; the governance decision about which label value types are permissible is the most consequential single decision in the cardinality governance ADR, because the distinction between "bounded enumerable domain" and "unbounded identifier domain" is the difference between a TSDB that scales with infrastructure upgrades and a TSDB that requires cardinality remediation at every growth milestone. Connect to the observability cost governance decision record: the cost governance decisions that set per-service observability budgets in dollar terms translate directly to cardinality budgets in series count terms when the team uses a per-series-priced managed platform; the cost governance ADR and the cardinality governance ADR are the same decision viewed from different angles — the cardinality governance ADR expresses the same constraints in TSDB series count units rather than cost units, and teams that have written one of these ADRs have almost always implicitly made the decisions in the other without documenting them. The retention vs cardinality trade-off component: longer retention windows at high cardinality compound the TSDB scaling challenge because compaction operations — which merge historical blocks to reduce storage overhead — must load the full series index for all series present in the blocks being compacted, including inactive series from past cardinality spikes; a team that resolved a cardinality explosion by dropping offending labels going forward still carries the historical series from before the fix in their retention window; until the retention window clears the pre-fix data, compaction continues to require memory proportional to the historical peak series count rather than the current steady-state series count; the cardinality governance ADR must specify the retention period alongside the series budget, because the operational memory requirement for a TSDB is a function of both simultaneously.

Property 2: Metrics visibility surface. The metrics visibility surface is the aggregate monitoring capability the engineering team can build on their metrics infrastructure — the number of meaningful dimensions they can filter, aggregate, and alert on, the granularity at which they can investigate incidents, the breadth of service-level indicators they can track without degrading TSDB performance — bounded by the cardinality budget the team has established and the governance model that enforces it. Three components. The cardinality budget enforcement model component: when cardinality governance is enforced only at saturation — when the TSDB OOMs and the team investigates the cause — the enforcement model is reactive and the fix requires deleting or renaming existing series, which breaks every dashboard panel and alert expression that references the deleted series; the remediation of a cardinality explosion is not just a TSDB operation, it is a monitoring coverage operation where the team must audit every dashboard and alert to verify that the series deletion did not remove a monitored signal; a reactive enforcement model therefore compounds the monitoring visibility impact of a cardinality explosion with the monitoring coverage audit overhead that follows; when cardinality governance is enforced at PR review — through instrumentation checklist review or automated cardinality estimation in CI — engineers receive immediate feedback before the series are created, before dashboards are built on top of them, and before the operational dependency on those series is established; the enforcement timing determines whether cardinality governance is a property of the system from the first deployment or a remediation exercise triggered by infrastructure failure. Connect to the observability sampling decision record: the sampling decisions that govern trace sampling rates and log sampling policies are related to cardinality governance by the principle of data layer selection — per-request or per-entity observability data belongs in traces and logs, not in metrics; a team that has implemented an effective observability sampling strategy for traces (capturing full detail for a representative sample of requests) has a credible alternative to per-request metric labels; the engineer who wants user_id granularity in metrics can be redirected to the trace store with a low-friction path to per-user request analysis without requiring a new metric label that explodes the TSDB series count; the cardinality governance ADR should reference the trace and log data stores that satisfy the per-request debugging use case that high-cardinality metric labels are often trying to solve. The label taxonomy governance component: a label taxonomy that evolves without central coordination produces semantic inconsistency across services — different services use different label value enumerations for the same conceptual dimension, different naming conventions for labels that represent the same attribute, and different granularity levels for labels like endpoint (some services use the full URL path, others use a route template, others use a semantic category); cross-service queries that aggregate on a shared dimension like region or environment return incorrect totals when label values do not align across services; engineers learn to scope their incident queries to individual services rather than querying across the fleet, reducing their situational awareness to the services they already suspect rather than the full call graph; the label taxonomy governance decision — which label names are standard and required on all metrics, what value enumerations are canonical, what naming conventions govern new label definitions — determines whether cross-service aggregation is a first-class capability or a debugging exercise requiring per-service knowledge. Connect to the observability strategy decision record: the observability strategy decisions that define the team's approach to the three pillars — metrics, traces, and logs — should allocate data types to the layer that handles them most cost-efficiently; metrics are most efficient for aggregate, dimensioned, time-ordered scalar data where the dimension set is bounded and known at schema design time; traces are most efficient for per-request, per-span causal chain data where the identifier space is unbounded; logs are most efficient for free-text contextual data where the structure is not known at collection time; a cardinality explosion is almost always a symptom of data being routed to the wrong layer — specifically, per-entity or per-request identifier data being added to the metrics layer where it creates unbounded series, rather than being captured in the tracing or logging layer where identifiers are native. The cost-of-cardinality awareness component: when engineers instrument metrics without awareness of the cardinality cost — specifically, without understanding that adding a label whose value domain has N unique values multiplies the series count by N across all metrics that carry that label — the cardinality governance problem is a knowledge problem as much as a policy problem; an engineer who understands that adding a user_id label to a metrics that has 500,000 registered users creates 500,000 new series per metric and that each series costs 3–5 KB of Prometheus head chunk memory will make a different instrumentation decision than an engineer who thinks of labels as metadata annotations with no infrastructure cost; the cost-of-cardinality awareness that the team builds into their engineering culture — through onboarding documentation, through instrumentation code review guidelines, through automated cardinality estimation in CI feedback — determines whether cardinality governance is a constraint engineers work within proactively or a rule they discover only at violation. Connect to the alerting threshold decision record: the alerting threshold decisions that set sensitivity levels for infrastructure alerts apply directly to per-service cardinality budget alerts — the threshold at which the cardinality alert fires should be calibrated against the TSDB's OOM risk curve, not against an arbitrary percentage; a TSDB operating at 70% of its series count ceiling is not the same risk as a TSDB operating at 70% of its memory limit, because the per-series memory cost varies by label combination complexity and the relationship between series count and memory usage is not linear near the ceiling; the alerting threshold for cardinality should be derived from the actual OOM risk model (at what series count does compaction OOM at the TSDB's current memory allocation?) rather than from a uniform percentage threshold applied across all infrastructure metrics.

The cardinality governance ADR: five sections

Section 1: Cardinality budget model. The cardinality budget model defines the TSDB's total active series ceiling, the per-service series allocation, the budget calculation methodology, and the budget review cadence. The ADR must specify a numeric series budget rather than a qualitative target — "keep cardinality low" is not a governance model; "each service may maintain at most 50,000 active series" is. The total TSDB ceiling calculation: begin with the available memory allocated to the TSDB (for a self-hosted Prometheus instance, this is the total server RAM minus the allocation to the operating system, Prometheus's own process overhead, and a 30–40% safety margin for compaction operations); divide by the per-series head chunk memory cost (3–5 KB for Prometheus head blocks, 1–2 KB for the series index metadata in InfluxDB) to get the maximum active series count the TSDB can sustain without approaching compaction OOM risk; apply a 60–70% utilization target to the calculated maximum to establish the operational ceiling — the number of active series above which the team takes action before the TSDB crosses the safety margin. The per-service allocation: divide the operational ceiling across services, weighted by service criticality (core business services receive larger allocations) and expected instrumentation density (services with complex SLIs require more label dimensions and therefore more series). The allocation should sum to 80% of the operational ceiling, leaving 20% as an unallocated reserve for new services, temporary cardinality spikes during incidents, and acquisitions. Document the allocation as a named table: each service, its series budget, and the rationale for its allocation relative to other services. The budget review cadence: quarterly, the team compares each service's actual series count (from prometheus_tsdb_head_series or influx query 'show series cardinality') against its allocation, and reviews whether any service has grown its instrumentation enough to warrant a budget reallocation. The review is also triggered by any new service launch, any acquisition integration, and any TSDB sizing change. Connect to the observability cost governance decision record: the cost governance ADR specifies per-service observability spending limits on managed platforms; the cardinality budget model is the equivalent governance layer for self-hosted TSDBs where the cost is measured in memory and infrastructure rather than dollars; teams operating both self-hosted and managed observability should maintain both governance documents, ensuring that the cardinality budget model informs the cost governance model's per-series pricing estimates and vice versa.

Section 2: High-cardinality dimension policy. The high-cardinality dimension policy defines which label value types are always prohibited, which are permitted with a cardinality ceiling, and which require a cardinality impact assessment before use. The ADR must enumerate the prohibition categories explicitly rather than relying on engineers to infer them from general principles. The always-prohibited category: label values whose domain is bounded only by system usage scale rather than by an enumerable, known-at-schema-design-time set. The canonical prohibited types: user identifiers (user_id, customer_id, account_id, tenant_id when tenant count is unbounded), request identifiers (request_id, trace_id, correlation_id, idempotency_key), job and batch identifiers (job_id, batch_id, run_id, pipeline_execution_id), randomly-generated container or pod identifiers (Kubernetes pod names with randomly-generated suffixes, container IDs), and timestamp-derived label values (labels containing date, time, or timestamp components). The ADR specifies for each prohibited type the alternative data layer: user-scoped debugging data belongs in the trace store (filtered by user_id tag in the trace indexing layer); request-scoped data belongs in traces; job-scoped pipeline data belongs in logs (each job execution produces a structured log line with the job_id as a field, not a label). The permitted-with-ceiling category: label values drawn from an enumerable domain that may grow over time but can be bounded — HTTP status codes (bounded at approximately 60 unique values in practice), endpoint categories (bounded by the number of meaningful API route categories, typically 10–50 for most services), deployment environments (bounded by the team's environment model, typically 3–5 values), geographic regions (bounded by the team's deployment regions, typically 2–8 values). For each permitted-with-ceiling label type, the ADR specifies the maximum permitted cardinality: the endpoint label for the HTTP handler may carry at most 100 distinct values; if the route count exceeds 100, the endpoint label must use route categories rather than individual route paths. The cardinality impact assessment category: for label value types not covered by the prohibition or the permitted-with-ceiling lists, the engineer must submit a cardinality impact assessment before instrumenting. The assessment specifies the label name, the value domain and its maximum cardinality, the impact on each metric that will carry the label (existing series count × new label cardinality = new series count), the total series count delta for the service, and whether the delta is within the service's remaining budget. The assessment is reviewed by the platform team or the designated observability lead and recorded in the ADR's amendment log. Connect to the observability platform decision record: the TSDB selection decisions that choose between Prometheus (memory-bound series count ceiling) and InfluxDB (monotonically growing Time Series Index) affect which cardinality governance rules are most critical — InfluxDB's series cardinality is particularly sensitive to labels that produce many unique historical values even if the active count is low, making job_id and pod_id labels dangerous even at low active scale; Prometheus's series cardinality is most sensitive to labels that produce many simultaneous active series, making user_id and customer_id more immediately dangerous; the high-cardinality dimension policy should be calibrated to the specific ceiling dynamics of the chosen TSDB.

Section 3: Cardinality enforcement model. The cardinality enforcement model defines when and how cardinality governance is enforced — at PR review, at CI/CD time, at TSDB ingestion, or at monitoring alert trigger — and what happens when a service exceeds its series budget. The ADR must specify the enforcement point that the team has the operational capacity to maintain consistently; an enforcement model that is too onerous will be bypassed in practice, leaving the governance model as documentation rather than a constraint. PR review enforcement: a cardinality checklist embedded in the team's PR template, applied to any PR that adds or modifies metric instrumentation. The checklist items: (1) does any new label carry a value from the always-prohibited category? (2) does any permitted-with-ceiling label approach or exceed its ceiling? (3) has the engineer calculated the new total series count for the service and confirmed it is within the service's budget? (4) is there a cardinality impact assessment on file for any label that is not explicitly in the permitted-with-ceiling list? The PR review checklist is the minimum viable enforcement mechanism — it requires no tooling beyond the team's existing code review process and catches cardinality issues before the series are created. Its weakness is that it relies on reviewer discipline and reviewer knowledge of cardinality governance; engineers who are unfamiliar with TSDB cardinality may not evaluate the checklist items critically. CI/CD enforcement: an automated cardinality estimation step in the CI pipeline that parses metric registration code, extracts label names and their estimated domain cardinalities from code comments or configuration, calculates the projected series count delta, and fails the pipeline if the delta would push the service above its budget. CI enforcement is more reliable than PR review alone and catches issues that reviewers miss, but requires upfront tooling investment to build or configure the estimation step. TSDB ingestion enforcement: a recording rule layer that drops series whose label combinations match a blocklist (for specific known-high-cardinality labels) or exceed a per-service series count threshold (via Prometheus's limit configuration or InfluxDB's series count per bucket setting). Ingestion enforcement is the most reliable enforcement point — it enforces the governance model regardless of what was missed in PR review or CI — but it requires the team to maintain the blocklist and limit configuration as the instrumentation evolves, and it produces a confusing signal for engineers whose metrics silently stop appearing in the TSDB without an obvious error. The ADR specifies which enforcement mechanisms the team uses, their priority order (a CI failure does not substitute for PR review; a TSDB ingestion limit does not substitute for CI), and the escalation path when a series budget overrun is detected at any enforcement point. The remediation path for budget overruns: when a service exceeds its series budget (detected by monitoring, not by failure), the enforcement model specifies the response sequence: (1) identify the high-cardinality labels contributing to the overrun via topk query on prometheus_tsdb_head_series_created_total or InfluxDB's show series cardinality grouped by tag key; (2) determine whether the overrun is from new labels added after the budget was established or from growth in an existing label's value domain; (3) for new labels, deploy a metric_relabel_config drop rule as an emergency constraint while the label is reviewed and either approved for a budget amendment or removed from the instrumentation; (4) for domain growth, determine whether the domain growth is controlled (the endpoint list grew because new routes were added) or uncontrolled (the user count grew and user_id was inadvertently added to a metric); (5) for uncontrolled growth, escalate to cardinality remediation immediately rather than waiting for the TSDB to approach the OOM boundary.

Section 4: Cardinality monitoring and alerting. The cardinality monitoring and alerting model defines the metrics, thresholds, and alert routing that give the team visibility into cardinality growth before it becomes a TSDB stability problem. The ADR must specify at least three alert types: a per-service budget utilization alert, a TSDB-wide ceiling approach alert, and a cardinality growth rate anomaly alert. The per-service budget utilization alert: fires when a service's active series count exceeds 80% of its allocated budget. Alert severity: warning. Routing: to the service team's engineering channel, not to on-call. The intent is to trigger a cardinality review by the service team before the budget is exhausted, while there is time to remove labels or expand the budget through the amendment process rather than through emergency remediation. The alert query for Prometheus: sum by (job) (prometheus_tsdb_head_series) / sum by (job) (service_series_budget) > 0.8 — where service_series_budget is a custom metric produced by a recording rule that maps each service to its budget from the ADR. The TSDB-wide ceiling approach alert: fires when the total active series count across all services exceeds 70% of the TSDB's operational ceiling. Alert severity: P2 (investigation required, not yet critical). Routing: to the platform team's incident channel. The intent is to give the platform team advance notice that the TSDB is approaching its ceiling before the ceiling is reached, so a capacity planning conversation can happen before the next incident triggers an emergency scaling event. The cardinality growth rate anomaly alert: fires when a single service's active series count increases by more than N% in a 24-hour window — where N is calibrated to the team's normal deployment cadence; a team that deploys multiple times per day with significant instrumentation changes may set N at 100%; a team with a stable instrumentation model may set N at 20%. The growth rate anomaly alert catches cardinality explosions in progress: a user_id label added to a high-traffic metric will produce a growth rate that far exceeds any normal deployment-driven growth. Alert severity: P2 when growth rate exceeds 2× the N threshold (indicating a potential cardinality explosion in progress, not just a large deployment). The alert query for Prometheus: deriv(sum by (job) (prometheus_tsdb_head_series)[1h]) > series_budget_per_hour_threshold. The cardinality monitoring dashboard: in addition to alerts, the ADR specifies a cardinality tracking dashboard that the platform team reviews weekly — showing per-service series count vs budget, total TSDB series count vs ceiling, the top 10 metrics by series count, and the top 10 label value cardinalities. The weekly review catches slow-growth cardinality creep (domain growth in a permitted-with-ceiling label that is approaching its ceiling) that alert thresholds may not capture before the threshold is crossed. Connect to the alerting threshold decision record: the alerting threshold decisions that govern sensitivity tuning across all infrastructure alerts apply to cardinality alerts in the same way they apply to memory and CPU alerts — the threshold should be calibrated to the specific OOM risk curve of the TSDB, not to a uniform percentage; for a Prometheus instance where compaction OOM begins at 85% of RAM utilization, the TSDB-wide ceiling alert should fire at 70% of the ceiling that corresponds to 85% RAM utilization, not at 70% of the theoretical maximum series count.

Section 5: Cardinality governance for external data sources. The cardinality governance model for external data sources defines how the team handles cardinality from third-party instrumentation — Kubernetes metrics, cloud provider metrics (CloudWatch, Stackdriver), third-party exporters (node_exporter, kube-state-metrics, database exporters) — where the team does not control the label definitions. External data sources represent a different cardinality governance challenge than application-level instrumentation: the team cannot modify the label definitions at the source, can only apply metric_relabel_config rules at the scrape layer to drop or transform labels before TSDB ingestion. The ADR must address each major external data source category explicitly. Kubernetes metrics: Kubernetes metrics scraped via kube-state-metrics and the Kubernetes API server metrics endpoint include labels that can have high cardinality in large clusters — pod (one value per pod, with randomly-generated suffixes), namespace (one value per namespace, which grows with tenant count in multi-tenant clusters), node (one value per node, which grows with cluster size), and container (one value per container across all pods). The ADR specifies which of these labels to retain in the TSDB (typically: service, namespace, node, but not pod or container for metrics that are aggregated at service level) and which to drop via metric_relabel_config rules applied at the kube-state-metrics scrape job. Cloud provider metrics: cloud provider metrics scraped via API (CloudWatch via cloudwatch_exporter, Stackdriver via stackdriver_exporter) carry resource-dimension labels that may include individual resource IDs (AWS instance IDs, GCP project resource names). The ADR specifies the relabeling rules applied to cloud provider metrics to replace resource IDs with human-readable resource names or resource categories derived from the team's resource tagging convention. Third-party exporters: for each third-party exporter the team operates (postgres_exporter, redis_exporter, kafka_exporter), the ADR documents the labels that the exporter emits by default and the relabeling rules applied to drop or transform high-cardinality labels before TSDB ingestion. The budget allocation for external data sources: each external data source category receives a dedicated series budget allocation in the per-service budget table (Kubernetes system metrics: N series; cloud provider metrics: N series; database exporters: N series per database cluster), so the platform team can track external source cardinality growth independently of application service cardinality growth. External source series budgets are typically larger than application service budgets because external sources emit metrics at a fixed cardinality per infrastructure unit (per pod, per node, per database), and the cardinality scales with infrastructure rather than with product usage; the governance lever for external sources is infrastructure sizing discipline (how many pods, nodes, and databases are operated) rather than instrumentation design. Connect to the observability sampling decision record: the sampling decisions for distributed traces are complementary to the cardinality governance decisions for metrics — teams that implement aggressive trace sampling (capturing 1–5% of traces for high-volume, low-error-rate services) reduce their trace storage costs at the expense of per-request visibility; the cardinality governance decisions for metrics affect the same per-request visibility tradeoff on the metrics side; a team that has accepted high trace sampling rates because storage cost is bounded by sampling policy may also want to accept lower metric cardinality because TSDB series count is bounded by label governance — both decisions are about accepting aggregate-level visibility in exchange for infrastructure sustainability, and the two governance models should be coherent: a team that uses per-request trace data for high-cardinality request debugging does not need per-request metric labels for the same debugging use case.

FAQ

Which label value types are always too high-cardinality for Prometheus or InfluxDB metrics?

Five categories of label values are always too high-cardinality for time-series database labels because their value domains are unbounded — they grow without ceiling as the system processes more users, requests, transactions, or infrastructure units. User identifiers: user_id, customer_id, account_id, tenant_id. Any label whose value domain grows with the user base produces a series count that grows without bound, hitting Prometheus memory limits as the product scales. Request identifiers: request_id, trace_id, correlation_id, idempotency_key. These are unique per request by design; using them as metric labels is equivalent to storing every request as a separate time series — a use case that belongs in a trace store (Tempo, Jaeger, AWS X-Ray), not a TSDB. Job and batch identifiers: job_id, batch_id, run_id, pipeline_execution_id. Pipeline systems that use run-level identifiers as metric labels produce one series per run; at a data platform processing 1,000 jobs per day, this creates 365,000 unique series per year per metric. Dynamic hostname labels: pod_id, container_id, instance_id when these values include randomly-generated components rather than deterministic values drawn from a fixed set. A Kubernetes deployment that generates new pod names on each rollout continuously creates new series that are never reused; the total historical series count grows monotonically in InfluxDB even if the active pod count is constant. Timestamp or date components: labels containing date or time values — metric_date, processing_hour, event_day — produce a new series for each time unit. The correct alternative for all five categories is a tracing system or log store for per-identifier data, with metrics restricted to aggregate dimensions: status code, method, region, service tier, error category, feature flag cohort — dimensions with bounded, enumerable value sets where the total unique series count is predictable at schema design time.

How do you calculate a reasonable cardinality budget for a service?

A service-level cardinality budget is calculated from the top down — from the TSDB's total capacity divided across services — and validated from the bottom up — from the product of the label cardinalities of each metric the service intends to produce. Top-down: start with the total active series capacity of the TSDB (available memory divided by per-series cost: approximately 3–5 KB per active series in Prometheus for head chunk storage). Apply a 60–70% utilization target to leave headroom for compaction and spikes. Divide the resulting series budget across services, weighted by service criticality and expected instrumentation density. The result is a per-service series budget: the number of unique series that service is permitted to maintain at any given time. Bottom-up validation: for each metric the service plans to instrument, calculate the worst-case series count as the product of the cardinality of each label's value domain. A metric with labels status_code (20 values), endpoint_category (30 values), and region (5 values) produces at most 3,000 unique series. Sum across all planned metrics. If the projected count exceeds the per-service budget, reduce label cardinality by consolidating labels (grouping endpoints into categories rather than individual paths), by removing labels that do not appear in any alert or dashboard query, or by moving high-cardinality dimensions to the tracing or logging layer. Review budgets quarterly: an enumerable label's cardinality may grow over time (adding endpoints grows the endpoint label cardinality; expanding to new regions grows the region label cardinality); quarterly review catches slow-growth cardinality creep before it reaches saturation.

How do you reduce Prometheus cardinality after a cardinality explosion has already occurred?

Cardinality reduction after an explosion requires three distinct steps: stopping the inflow of new high-cardinality series, removing existing high-cardinality series from the active set, and recovering from any TSDB storage damage caused by the explosion. Stopping the inflow: the most urgent step is to prevent new high-cardinality series from being created. For Prometheus, deploy a metric_relabel_config rule at the scrape layer that drops the offending label from scraped metrics before they are stored — this reduces the series count going forward but leaves existing series in the TSDB until tombstoning and compaction clear them. For InfluxDB, deploy a Flux transformation that drops the high-cardinality tag before writing to the target bucket. Removing existing series: Prometheus 2.x provides the POST /api/v1/admin/tsdb/delete_series endpoint which marks series for deletion by label matcher; series are removed from the active set after the next compaction cycle. After marking series for deletion, trigger an immediate compaction with POST /api/v1/admin/tsdb/clean_tombstones to recover memory and disk space. Recovering from TSDB storage damage: if the explosion caused compaction OOMs, the TSDB may have partially-written or corrupted blocks that prevent clean restart. The recovery sequence: stop Prometheus, run promtool tsdb analyze to identify which blocks have anomalously high series counts, delete the affected blocks manually (they are stored as directories under the data/ path), and restart Prometheus — this loses the data in the deleted blocks but allows the TSDB to restart cleanly. For explosions that have been accumulating across multiple retention blocks, the full remediation may require a staggered compaction schedule that limits the blocks compacted per night to avoid OOM during compaction, extending the full remediation over days to weeks depending on how many blocks contain the high-cardinality series.

How do observability cardinality governance decisions connect to AI chat sessions and decision preservation?

Observability cardinality governance decisions are made when the first metric is instrumented — the founding engineer chooses which dimensions to attach as labels, decides whether to use user_id or not, selects the first label naming convention — and those decisions are almost always made in AI chat sessions where the team works through the instrumentation model in real time: whether to use a per-request label for debugging individual requests in metrics dashboards or to restrict metrics to aggregate dimensions and use a tracing system for per-request visibility; whether to instrument at the endpoint level or the endpoint category level; whether to include the deployment environment as a label on all metrics or to operate separate Prometheus instances per environment; whether to adopt a centralized observability platform that manages cardinality at the vendor level or to self-host Prometheus where cardinality management is the team's responsibility. The reasoning in those sessions — the specific tradeoff between per-request debuggability and TSDB scaling headroom, the specific analysis of which label dimensions add the most diagnostic value at the lowest cardinality cost, the specific decision about whether the team has the operational maturity to self-host a Prometheus instance with cardinality governance — is the substance of the cardinality governance design. It is almost universally made and immediately discarded, leaving every engineer who joins the team afterward to infer intent from the instrumentation code rather than from the documented decision. The engineer who asks 'why don't we have per-user metrics even though that would be useful for debugging?' will get 'we just haven't added that yet' rather than the founding reasoning — unless the AI chat sessions that made the decision were run through the open-source extractor and the decision record was produced at the time the first metric was instrumented. The decision record allows the engineer inheriting the instrumentation model to understand why user_id is absent (not because the founding engineer did not understand the debugging value, but because they calculated that at 500,000 registered users each metric with a user_id label would create 500,000 unique series and the Prometheus instance was sized for 2 million total active series); why the endpoint label uses categories rather than paths (not because the founding engineer did not want path-level visibility, but because the API had parameterized paths from the beginning and they had seen cardinality explosions from path labels at a previous company); and why staging metrics live on a separate Prometheus instance rather than sharing production with an environment label (not because the founding engineer did not understand the operational overhead, but because the staging environment ran load tests that would have multiplied the cardinality of every staging series by the load test thread count).