Cloud concept · Updated

Metric Cardinality - Metric cardinality is the number of distinct time series created by metric names and their unique combinations of dimension or label values.

In short

A metric such as request latency becomes many separate time series when it is partitioned by service, environment, endpoint, or instance. Controlling cardinality preserves useful diagnostic detail while limiting ingestion volume, storage costs, query work, and operational complexity.

Cloud Concepts Hub →

6 key aspects of Metric Cardinality

Effective cardinality management combines explicit series identity, bounded dimensions, deliberate aggregation, and separate control of sampling frequency and series churn.

01
Series identity

A metric name and its full dimension or label set distinguish one series from another. Namespace and platform-specific boundaries also matter, so identically named metrics are not necessarily the same metric.

02
Combinatorial growth

Each additional dimension can multiply the number of series when its values occur across existing combinations. Estimate the combinations actually emitted rather than treating the number of dimension names as the cardinality.

03
Bounded dimension values

Prefer controlled values such as deployment environment or normalized route. Put unbounded identifiers in logs or traces unless a specific monitoring requirement justifies their metric cost.

04
Aggregation placement

Aggregation before ingestion can reduce stored series, while aggregation during queries generally only reduces the returned results. Explicitly design rollups and retain the counts or distributions needed for statistically correct calculations.

05
Independence from resolution

Measurement frequency controls samples per series, not the number of distinct series. Evaluate collection interval and cardinality separately because they affect different resource and billing dimensions.

06
Series churn

Short-lived resources can generate many distinct series even when only a small number are active simultaneously. Track cardinality over a defined interval and avoid unnecessary ephemeral resource identifiers.

Cloud services for Metric Cardinality

CloudWatch provides operational metrics and alarms, while CloudWatch Logs retains detailed events for investigations that require request or user context. When deriving metrics from logs, extract bounded dimensions rather than copying every event attribute into metric identity. Amazon Managed Service for Prometheus applies the same cardinality principles to label-based telemetry. Across these services, normalize or filter dimensions before ingestion, retain detailed context in logs, and distinguish stored rollups from query-time aggregation. This separation supports useful alerts and troubleshooting without making every unique event a separate metric series.

Amazon CloudWatchAmazon CloudWatch

CloudWatch distinguishes metrics by namespace, metric name, and dimensions within an account and Region. Custom metric dimension combinations affect metric counts and costs; high-resolution publishing changes measurement granularity rather than metric identity.

Amazon Managed Service for PrometheusAmazon Managed Service for Prometheus

Amazon Managed Service for Prometheus stores series identified by metric names and label sets. Label selection and filtering before remote write can reduce ingested cardinality; recording rules create derived series but do not remove the original ingested series.

Metric Cardinality exam questions

Real practice exam questions on Metric Cardinality, with the correct answer and its explanation. Answer them with every option in the exam simulator.

DVA-C02

A developer investigates an increase in Amazon CloudWatch custom metric charges after changing how a background application processes jobs. The application emits an embedded metric format (EMF) event containing the JobDuration metric for every completed job. Each event declares two dimension sets: [["Queue"], ["Queue", "WorkerId"]].

During a one-hour window before the change, the application processed 12,000 jobs across six queues. Each queue used exactly 10 persistent workers, and every worker processed at least one job. During a one-hour window after the change, the application again processed 12,000 jobs across the same six queues, but each job used a new, unique WorkerId. The namespace and metric name did not change.

Which analysis correctly identifies the change in the number of distinct metric identities emitted during these windows?

Show answerCORRECT ANSWER

The count increased from 66 to 12,006 because each new Queue-and-WorkerId combination identifies a separate metric, in addition to the six Queue-only metrics.

Before the change, there were six Queue-only identities and 6 × 10 = 60 Queue-and-WorkerId identities. Afterward, there were still six Queue-only identities, but the unique WorkerId for every job produced 12,000 Queue-and-WorkerId identities. Worker identity churn increased metric cardinality despite unchanged job volume.

SAP-C03

A company operates a distributed job-processing platform in one AWS account and Region. Thousands of short-lived workers process jobs across 12 fixed processing pools. Each completed job belongs to exactly one pool. Workers publish the number of jobs completed during each minute as a standard-resolution CloudWatch custom metric named JobsCompleted in the Company/Processing namespace, with PoolName and WorkerId dimensions.

Worker turnover has caused custom-metric charges to increase significantly. Operations requires one-minute completion-count dashboards and low-throughput alarms for each pool and for the entire platform. Worker-level metrics are no longer required. The monitoring system supports CloudWatch metric math in dashboards and alarms. All 12 pools publish a value every minute, including zero when no jobs complete.

Which design meets these requirements with the FEWEST billable custom metric time series?

Show answerCORRECT ANSWER

Publish JobsCompleted with only PoolName. Use each pool metric's one-minute Sum for pool monitoring, and explicitly sum the 12 pool metrics with a metric math expression for platform-wide monitoring and alarms.

This creates 12 custom metric time series, one for each pool. Multiple workers can contribute counts to the same pool metric, and its one-minute Sum provides the pool total. An explicit SUM expression across the 12 pool metrics provides the platform total without publishing another custom metric. CloudWatch does not automatically aggregate custom metrics across dimensions.

DOP-C02

A processing platform has 80 queues and four possible processing outcomes. Workers publish a custom CloudWatch metric named ProcessedItems with QueueName and Outcome dimensions. All 320 queue–outcome combinations receive data every hour. Each published value is the number of items processed for that combination during the preceding minute.

Operations requires one-minute total item counts for each queue across all outcomes and for each outcome across all queues. Queue–outcome breakdowns are no longer required. A DevOps engineer must change metric publication so that no more than 90 distinct custom metrics receive data each hour. The workers can calculate and publish the required totals, and the namespace is used only by this platform.

Which publication design meets these requirements?

Show answerCORRECT ANSWER

Publish ProcessedItems in the existing namespace using two separate dimension sets: QueueName alone for each queue's total and Outcome alone for each outcome's total. Stop publishing metrics with both dimensions.

The queue-only dimension set produces 80 metric identities, and the outcome-only dimension set produces four more, for a total of 84. Publishing the separately calculated totals preserves both required breakdowns without retaining the 320 queue–outcome combinations. Each breakdown can use the Sum statistic with a 60-second period.

Practice Metric Cardinality in a full exam

Questions on Metric Cardinality in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Metric Cardinality

3 min read

Metric cardinality describes how many distinct metric time series a monitoring system must handle within a defined scope and time window. A series is typically identified by a metric name and a complete set of dimension or label name-value pairs. Additional boundaries, such as a namespace, account, or Region, can also distinguish metrics. Cardinality is not the number of samples: one series containing a million measurements still has a cardinality of one.

Dimensions multiply the potential number of series. Suppose a request-count metric has three environment values, four service values, and twenty endpoint values. If every combination occurs, that metric produces 240 series. Adding an instance identifier with fifty possible values could increase the theoretical total to 12,000. Actual cardinality depends on which combinations are emitted, not simply on multiplying every value observed independently. Continually changing instance or container identifiers also create series churn, increasing the number of distinct series seen over time.

In cloud architectures, choose dimensions that support specific operational decisions. Environment, service, availability zone, and normalized endpoint often provide useful breakdowns. Request IDs, session IDs, arbitrary URLs, and user IDs can produce unbounded growth. For example, use the route template /orders/{orderId} rather than a separate dimension value for every order URL. Keep request-specific identifiers in logs or traces so engineers can investigate individual failures without creating a metric series for every request.

Amazon CloudWatch illustrates the identity rules tested in certification questions. Within an account and Region, a metric is identified by its namespace, metric name, and dimensions. Namespaces separate metric identities; they do not automatically aggregate measurements. CloudWatch supports up to 30 dimensions per metric, but that limit does not make high-cardinality values safe. Changing a dimension value or adding a dimension creates a different metric identity.

CloudWatch does not automatically aggregate custom metrics across dimensions. If an application publishes RequestCount with Service and InstanceId, requesting RequestCount with only Service does not retrieve an automatically stored service-level total. Publish an explicit rollup or use an appropriate query or metric-math expression over the underlying series. Some AWS service metrics offer predefined aggregations, so do not assume their behavior applies to custom metrics. Query-time aggregation can simplify results without reducing the cardinality already ingested.

Resolution and cardinality are separate design choices. CloudWatch standard-resolution custom metrics use 60-second resolution, while high-resolution custom metrics support one-second resolution. Publishing more frequently to an unchanged metric identity increases sample volume, not cardinality. Conversely, adding unique request identifiers increases cardinality even if each series receives only one sample. Costs depend on the monitoring service's pricing model, including custom metric counts, ingestion, storage, queries, and alarm configuration.

Control cardinality before ingestion by allowlisting dimensions, normalizing values, dropping unnecessary labels, and aggregating measurements at the required operational level. Preserve meaningful statistics during aggregation: summing request counts is appropriate, but averaging instance-level averages without sample counts can misrepresent latency. Maintain distributions or suitable histogram data when percentile analysis matters. Review both active series and series churn, and test instrumentation changes against realistic fleet size and traffic diversity before deploying them.

Learn Metric Cardinality in lessons

3 short lessons on Metric Cardinality in 2 certification courses.

Open the lessons