BM: Baca dalam Bahasa Melayu
World O2: Counters
Labels and cardinality
You will learn: how labels split one metric into many series, how to filter them, and which labels to avoid.
Checked with Prometheus 3 on 1 Nov 2026
The problem
You add the order number as a label: order_id. 10,000 orders today. How many series does Prometheus keep?
Pick one answer.
Watch
Tap every nasi lemak series.
0 of 2 found
A label: A sticky note on a series, like stall="cendol". Every new combination makes a new series. is a sticky note on a series. One name, five sets of notes: five time series: One metric name plus one set of labels: a line of values over time..
Try it
Show only the SS15 outlet. Put a label filter in curly brackets.
Add {outlet="ss15"} right after the name, then Run.
Hint
!= means “not equal”. =~ matches a pattern.Predict
3 stalls, 2 outlets, and a new label for 4 ways to pay. At most, how many series?
Pick one answer.
Try it
Is it a safe label? Swipe right for safe.
Swipe right for good, left for needs work. Or use the buttons.
stall="cendol"Check
How many series does kedai_orders_total make? Count them with count().
Wrap the name in count( ), then Run.
You did it!
You can now filter by label and keep the series count small.
Go deeper (optional)
The number of series is called cardinality: How many series a metric makes. Labels like user id or order id make far too many.. Too many series fill memory and slow every query. Keep ids, emails and full URLs in logs or traces. Four matchers: =, !=, =~ and !~.
Real mission
docker compose up -ddocker compose down
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Anda tambah nombor pesanan sebagai label: order_id. 10,000 pesanan hari ini. Berapa siri yang Prometheus simpan?
Label ialah nota lekat pada siri. Satu nama, lima set nota: lima siri.
Tunjuk cawangan SS15 sahaja. Letak penapis label dalam kurungan kerinting.
!= bermaksud “tidak sama”. =~ padankan corak.3 gerai, 2 cawangan, dan label baru untuk 4 cara bayar. Paling banyak, berapa siri?
Adakah ia label yang selamat? Leret ke kanan untuk yang selamat.
Berapa siri yang kedai_orders_total hasilkan? Kira dengan count().
Kini anda boleh tapis ikut label dan kekalkan bilangan siri yang kecil.
You finished this before. Practice is always welcome!
Official docs: Prometheus: data model · Prometheus: metric and label naming · Prometheus: querying basics (matchers)
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?