Name a metric and choose its labels without exploding cardinality

13 min
Audience
beginner, lesson 01 read
Duration
35 to 45 min
Module
3/7
Target skill
apply the official name and unit conventions, measure a metric's real cardinality with count(), estimate the one a bad label would produce, and recognize the exact errors prometheus_client raises (or does not raise) on this subject

In one picture

Take the speed radar sign from lesson 01 again. Counting cars by model gives a few dozen cells, known in advance; counting cars by license plate gives one cell per car that passes, without limit, and the results board becomes unreadable and costs a fortune to store. A Prometheus label is the column by which you count. route="/cours/{id}" is the model; route="/cours/C0042" is the plate. A metric's cardinality is the number of cells its labels open, and each cell is a time series Prometheus must keep in memory and on disk.

Preview — the rest of the lesson is for enrolled readers.

Already enrolled with a code?

Your access is tied to your account, not to this link. Sign in with the same email you used in class: your course is waiting, no need to enter the code again.

Sign inNo account yet? Create one
This lesson is part of the “Instrument the deployed solution” module

The first modules of the course are open to everyone. For the rest you have three options: buy this course once and for all, subscribe, or enter the code handed out in class.

Are you a student on this course?

The code is tied to your account: sign in or create an account and it will be applied automatically when you come back.

No account yet? Create one