Slide 1 of 7

Use bounded labels

Use bounded labels

A metric label should be a dimension you aggregate or filter by, with a bounded set of values.

The single most important rule is that label values must be bounded. A label like env has a handful of values forever. A label like user_id is an unbounded label: it grows without limit, and every new value creates another active series that’s billed and indexed.

Never use these as metric label values:

  • User, customer, or session IDs
  • Request or trace IDs
  • IP addresses
  • Email addresses
  • Timestamps

Each of these creates a new series per unique value, and the combinations multiply against every other label on the metric.

A chart comparing active series over time: a bounded label like env stays flat while an unbounded label like user_id grows without limit

Script

The most important rule for metric labels is that label values must be bounded; they should have a limited number of unique values.

A good metric label is a dimension you actually aggregate or filter by, with a value set that stays small. An environment label has a handful of values, and it’ll still have a handful of values a year from now.

Compare that with a user ID label. That’s an unbounded label. It grows without limit, and every new value creates another active series that’s billed and indexed.

That’s why our never-use list includes user, customer, and session IDs, request and trace IDs, IP addresses, email addresses, and timestamps. Each of these creates a new series per unique value, and those combinations multiply against every other label on the metric.