How do histograms affect cardinality, and how do you control it?
IntermediateProductionCardinality Control & Cost
Answer
A classic histogram creates one series per bucket plus _sum and _count, multiplied by every label combination. 20 buckets × 50 routes × 5 codes × 100 pods = 500,000 series for one metric. Controls:
- Fewer, well-chosen buckets around the SLO thresholds.
- Drop
podfrom the histogram (aggregate with a recording rule, then drop raw). - Native histograms (sparse, one series per label set).
- Do not put
codeon the histogram if a separate counter already has it.
More on Cardinality Control & Cost
What is cardinality and why is it the main cost driver for metrics?BeginnerHow do you find which metrics and labels are driving cardinality?IntermediateWhich labels should never appear on metrics?BeginnerHow do you enforce cardinality limits so one team cannot blow up the shared system?AdvancedHow do you drop or aggregate metrics you do not need?IntermediateHow do you estimate the monthly cost of a new metric before it ships?Intermediate