Metric Cardinality - CI/CD用語集の定義
メトリックカーディナリティとは、あるメトリックが生成する個別の時系列の数であり、そのlabel値の一意な組み合わせの数に等しくなります。高いカーディナリティはPrometheusのようなメトリックシステムを圧迫することがあります。
なぜ爆発するのか
labelの一意な組み合わせごとに別々の時系列になります。数千もの値を持つuser_idやrequest_idのようなlabelを追加すると、時系列の数とメモリ使用量が倍増し、これがPrometheusのout-of-memoryの典型的な原因です。
上限を保つ
小さく上限のある値の集合(status code、リージョン、ルートテンプレート)を持つlabelを使い、上限のない識別子はメトリックのlabelではなくログやtraceの属性に押し出します。
関連ガイド
Structured Logging - CI/CD Glossary DefinitionStructured Logging: Structured logging emits log entries as machine-parseable records (usually JSON) with nam…
Span - CI/CD Glossary DefinitionSpan: A span is the basic unit of a distributed trace: a single named operation with a start time, a duration…
SLI (Service Level Indicator) - CI/CD Glossary DefinitionSLI (Service Level Indicator): An SLI (service level indicator) is a quantitative measure of a service's beha…