Cost

Find and Cap High Cardinality in OpenTelemetry

The attribute that quietly multiplies your bill — and how to catch it before launch.

Cardinality is the number of distinct values an attribute can take — and, for metrics, the number of distinct series that results. It is the most common reason observability bills grow unexpectedly and queries get slow. One attribute holding a user ID, a request ID or a full URL can multiply the series count a thousand times. The trouble is that it usually appears only when real users arrive. This guide shows how to cause it deliberately, find it, and cap it.

Where high cardinality comes from

For metrics, each unique combination of attribute values is a separate time series. Ten services × 20 operations × 5 status codes is 1,000 series; add an attribute with 10,000 distinct values and you have ten million.

Cause it on purpose

  1. On the Scenarios page enable Cardinality Burst (in the Chaos / Stress group). Every request carries a random user ID, so the number of distinct values grows without bound.
  2. Run a normal scenario beside it for comparison, so you can see which signals grow and which do not.
  3. For estate metrics, grow the fleets: 20 hosts to 2,000 multiplies per-host series. The estimate on the Stats page shows the expected series and volume before you start.

Find it

Cap it

Fix the cause in order of preference: stop emitting the attribute at the source; remove it in the Collector; and enforce limits at the backend as a safety net.

# Drop a high-cardinality attribute from metric data points in the Collector
processors:
  transform/drop-high-cardinality:
    error_mode: ignore
    metric_statements:
      - context: datapoint
        statements:
          - delete_key(attributes, "user.id")

Run the burst again with the processor in place: the series count should flatten, while traces — which can legitimately carry a user ID — are untouched. Then test the backstop: set your backend's series limit low, run the burst, and confirm what actually happens — are new series dropped, are writes rejected, is anyone alerted? That behaviour is worth knowing before production teaches it to you.

Different signals, different tolerance. A trace attribute with a unique value per request is normal and cheap to index sparingly; the same value on a metric is expensive. Test each signal separately — the Traces, Logs and Metrics switches in OTel Studio's top bar let you isolate them.

A checklist

Keep going