From e9245249dfd7f07c64f1e97ee504c0561dfb0b04 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Wed, 25 Sep 2024 16:06:19 -0700 Subject: [PATCH 1/2] Clarify cardinality capping should be after filtering --- CHANGELOG.md | 2 ++ specification/metrics/sdk.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce635a47357..5229633bdba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ release. ([#4211](https://github.com/open-telemetry/opentelemetry-specification/pull/4211)) - Make all fields as identifying for Meter. Previously attributes were omitted from being identifying. ([#4161](https://github.com/open-telemetry/opentelemetry-specification/pull/4161)) +- Clarify that applying cardinality limits should be done after attribute filtering. + ([#4228](https://github.com/open-telemetry/opentelemetry-specification/pull/4228)) ### Logs diff --git a/specification/metrics/sdk.md b/specification/metrics/sdk.md index f1c33c38fbb..c90530ae995 100644 --- a/specification/metrics/sdk.md +++ b/specification/metrics/sdk.md @@ -807,7 +807,9 @@ reaching the cardinality limit and use it to aggregate [Measurements](./api.md#measurement) for which the correct Aggregator could not be created. The SDK MUST provide the guarantee that overflow would not happen if the maximum number of distinct, non-overflow attribute sets is less than or -equal to the limit. +equal to the limit. Cardinality limit enforcement SHOULD occur after attribute +filtering, if any. This ensures users can filter undesired attributes using +[views](#view) and prevent reaching the cardinality limit. #### Synchronous instrument cardinality limits From aec5def8e4e9a61ab5e7201a34faca29996f6af9 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Wed, 25 Sep 2024 17:38:30 -0700 Subject: [PATCH 2/2] move to cardinality limit section --- specification/metrics/sdk.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/specification/metrics/sdk.md b/specification/metrics/sdk.md index c90530ae995..b1edf498ff3 100644 --- a/specification/metrics/sdk.md +++ b/specification/metrics/sdk.md @@ -780,7 +780,9 @@ SDKs SHOULD support being configured with a cardinality limit. The number of unique combinations of attributes is called cardinality. For a given metric, the cardinality limit is a hard limit on the number of [Metric Points](./data-model.md#metric-points) that can be collected during a collection -cycle. +cycle. Cardinality limit enforcement SHOULD occur _after_ attribute filtering, +if any. This ensures users can filter undesired attributes using [views](#view) +and prevent reaching the cardinality limit. #### Configuration @@ -807,9 +809,7 @@ reaching the cardinality limit and use it to aggregate [Measurements](./api.md#measurement) for which the correct Aggregator could not be created. The SDK MUST provide the guarantee that overflow would not happen if the maximum number of distinct, non-overflow attribute sets is less than or -equal to the limit. Cardinality limit enforcement SHOULD occur after attribute -filtering, if any. This ensures users can filter undesired attributes using -[views](#view) and prevent reaching the cardinality limit. +equal to the limit. #### Synchronous instrument cardinality limits