← Lessons

quiz vs the machine

Gold1330

System Design

Labels and Dimensions

How key value labels turn flat metrics into sliceable dimensions.

4 min read · core · beat Gold to climb

Labels add dimensions

A bare metric name gives one number. Labels, which are key value pairs attached to a metric, turn it into a multidimensional cube you can slice and group. The label keys are the dimensions.

What labels let you do

  • Filter by selecting series where a label matches a value.
  • Group by a dimension to aggregate, such as requests per region.
  • Join across metrics that share labels.

Good labeling discipline

  • Use a small, stable set of dimensions per metric.
  • Prefer bounded values like status class over raw status text.
  • Keep label keys consistent across metrics so you can group uniformly.

The cost side

Each label value combination is a separate series, so labels trade query flexibility for storage and index cost. Choose dimensions that you will actually slice by.

Key idea

Labels are the dimensions that make metrics sliceable, but each combination is its own series, so pick a small bounded set you will truly query.

Check yourself

Answer to earn rating on the learn ladder.

1. What do label keys represent for querying?

2. Why prefer status class over raw status text as a label value?