Skip to content

.tip

· one of the small things

High-cardinality fields go on spans, not on metric labels

Every distinct combination of attribute values on a metric is its own time series, held in memory by the SDK and billed by the backend. Add a user id to a counter and one series becomes a million.

requests.add(1, { route: "/posts/[slug]", status: 500 });
span.setAttribute("user.id", userId);

Keep metric attributes to small closed sets: route templates, status codes, regions, never raw paths or ids. The unbounded fields belong on the span, where they cost one attribute on one row and multiply nothing.

opentelemetryobservability