OpenTelemetry Collector OOMKills & Prometheus Cardinality Explosions
Stop OTel Collector OOMKills and Prometheus TSDB memory blowups caused by unbounded user_id/request_id labels using memory_limiter, batch processors, and cardinality guards.
Minutes after a new microservice ships, OpenTelemetry Collector pods enter CrashLoopBackOff (exit code 137 / OOMKilled) and Prometheus TSDB head_series jumps from 180k to 4.2M.
prometheus_tsdb_head_series > 1000000 OR increase(kube_pod_container_status_restarts_total{container="otel-collector"}[10m]) > 3Every unique label-value combination in Prometheus creates an independent in-memory time series in the TSDB head block (~3-5KB RAM per active series). Attaching unbounded labels like user_id, request_id, or raw URL paths with UUIDs multiplies series count by millions.
Inside the OpenTelemetry Collector, omitting memory_limiter (or placing it AFTER batch instead of FIRST in the processor pipeline) allows sudden telemetry bursts to exhaust container memory and trigger Linux OOMKiller before backpressure can shed load.
An engineer adds user_id and full URL path (/orders/9f2a...) as Prometheus metric labels to debug a checkout issue. Prometheus OOMs 12 minutes later. What is the right observability boundary?
- Confirm memory_limiter is the FIRST processor in every OTel Collector pipeline (traces, metrics, logs).
- Enforce metric_relabel_configs (or OTel transform processor) to drop unbounded labels and normalize route templates.
- Set Prometheus --storage.tsdb.max-block-chunk-segment-size and per-scrape sample_limit so one rogue service cannot OOM the entire monitoring cluster.
Why must memory_limiter be the first processor in an OpenTelemetry Collector pipeline?
So the collector refuses incoming batches at the receiver boundary before downstream transform or batch processors allocate large buffers and trigger a Linux OOMKill.
How do I correlate a Prometheus p99 spike to a specific user without adding user_id as a label?
Enable OpenTelemetry Exemplars on histogram metrics: each histogram bucket attaches a sampled trace_id that jumps straight to the full high-cardinality trace.
What is a safe Prometheus sample_limit per scrape target?
Set sample_limit (e.g., 10000 to 50000 depending on service size) in scrape_configs so a single accidental cardinality bug fails that target’s scrape instead of crashing Prometheus globally.