From 14e6df943381820d9f313f5a7fdf39e3fc3ad072 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 28 Mar 2025 11:04:10 -0400 Subject: [PATCH] Rename `evaluation` to `result` for feature flag evaluation result attributes (#1989) --- .chloggen/ff-result-namespace.yaml | 22 ++++++++ docs/attributes-registry/feature-flag.md | 34 +++++++++++- docs/feature-flags/feature-flags-logs.md | 10 ++-- .../deprecated/registry-deprecated.yaml | 55 +++++++++++++++++++ model/feature-flags/events.yaml | 4 +- model/feature-flags/registry.yaml | 4 +- schema-next.yaml | 7 +++ 7 files changed, 124 insertions(+), 12 deletions(-) create mode 100755 .chloggen/ff-result-namespace.yaml create mode 100644 model/feature-flags/deprecated/registry-deprecated.yaml diff --git a/.chloggen/ff-result-namespace.yaml b/.chloggen/ff-result-namespace.yaml new file mode 100755 index 000000000..15f20b016 --- /dev/null +++ b/.chloggen/ff-result-namespace.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: feature_flag + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Rename `evaluation` to `result` for feature flag evaluation result attributes + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [1989] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/attributes-registry/feature-flag.md b/docs/attributes-registry/feature-flag.md index 803cb3079..76dd3056a 100644 --- a/docs/attributes-registry/feature-flag.md +++ b/docs/attributes-registry/feature-flag.md @@ -3,6 +3,9 @@ # Feature flag +- [Feature Flag Attributes](#feature-flag-attributes) +- [Deprecated Feature Flag Attributes](#deprecated-feature-flag-attributes) + ## Feature Flag Attributes This document defines attributes for Feature Flags. @@ -11,20 +14,45 @@ This document defines attributes for Feature Flags. |---|---|---|---|---| | `feature_flag.context.id` | string | The unique identifier for the flag evaluation context. For example, the targeting key. | `5157782b-2203-4c80-a857-dbbd5e7761db` | ![Development](https://img.shields.io/badge/-development-blue) | | `feature_flag.evaluation.error.message` | string | A message explaining the nature of an error occurring during flag evaluation. | `Flag `header-color` expected type `string` but found type `number`` | ![Development](https://img.shields.io/badge/-development-blue) | -| `feature_flag.evaluation.reason` | string | The reason code which shows how a feature flag value was determined. | `static`; `targeting_match`; `error`; `default` | ![Development](https://img.shields.io/badge/-development-blue) | | `feature_flag.key` | string | The lookup key of the feature flag. | `logo-color` | ![Development](https://img.shields.io/badge/-development-blue) | | `feature_flag.provider_name` | string | Identifies the feature flag provider. | `Flag Manager` | ![Development](https://img.shields.io/badge/-development-blue) | +| `feature_flag.result.reason` | string | The reason code which shows how a feature flag value was determined. | `static`; `targeting_match`; `error`; `default` | ![Development](https://img.shields.io/badge/-development-blue) | +| `feature_flag.result.variant` | string | A semantic identifier for an evaluated flag value. [1] | `red`; `true`; `on` | ![Development](https://img.shields.io/badge/-development-blue) | | `feature_flag.set.id` | string | The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) to which the feature flag belongs. | `proj-1`; `ab98sgs`; `service1/dev` | ![Development](https://img.shields.io/badge/-development-blue) | -| `feature_flag.variant` | string | A semantic identifier for an evaluated flag value. [1] | `red`; `true`; `on` | ![Development](https://img.shields.io/badge/-development-blue) | | `feature_flag.version` | string | The version of the ruleset used during the evaluation. This may be any stable value which uniquely identifies the ruleset. | `1`; `01ABCDEF` | ![Development](https://img.shields.io/badge/-development-blue) | -**[1] `feature_flag.variant`:** A semantic identifier, commonly referred to as a variant, provides a means +**[1] `feature_flag.result.variant`:** A semantic identifier, commonly referred to as a variant, provides a means for referring to a value without including the value itself. This can provide additional context for understanding the meaning behind a value. For example, the variant `red` maybe be used for the value `#c05543`. --- +`feature_flag.result.reason` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. + +| Value | Description | Stability | +|---|---|---| +| `cached` | The resolved value was retrieved from cache. | ![Development](https://img.shields.io/badge/-development-blue) | +| `default` | The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic evaluation yielded no result). | ![Development](https://img.shields.io/badge/-development-blue) | +| `disabled` | The resolved value was the result of the flag being disabled in the management system. | ![Development](https://img.shields.io/badge/-development-blue) | +| `error` | The resolved value was the result of an error. | ![Development](https://img.shields.io/badge/-development-blue) | +| `split` | The resolved value was the result of pseudorandom assignment. | ![Development](https://img.shields.io/badge/-development-blue) | +| `stale` | The resolved value is non-authoritative or possibly out of date | ![Development](https://img.shields.io/badge/-development-blue) | +| `static` | The resolved value is static (no dynamic evaluation). | ![Development](https://img.shields.io/badge/-development-blue) | +| `targeting_match` | The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting. | ![Development](https://img.shields.io/badge/-development-blue) | +| `unknown` | The reason for the resolved value could not be determined. | ![Development](https://img.shields.io/badge/-development-blue) | + +## Deprecated Feature Flag Attributes + +Describes deprecated feature flag attributes. + +| Attribute | Type | Description | Examples | Stability | +|---|---|---|---|---| +| `feature_flag.evaluation.reason` | string | Deprecated, use `feature_flag.result.reason` instead. | `static`; `targeting_match`; `error`; `default` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)
Replaced by `feature_flag.result.reason`. | +| `feature_flag.variant` | string | Deprecated, use `feature_flag.result.variant` instead. | `red`; `true`; `on` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)
Replaced by `feature_flag.result.variant`. | + +--- + `feature_flag.evaluation.reason` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. | Value | Description | Stability | diff --git a/docs/feature-flags/feature-flags-logs.md b/docs/feature-flags/feature-flags-logs.md index 2348b5d7a..8c0b70def 100644 --- a/docs/feature-flags/feature-flags-logs.md +++ b/docs/feature-flags/feature-flags-logs.md @@ -60,11 +60,11 @@ A `feature_flag.evaluation` event SHOULD be emitted whenever a feature flag valu |---|---|---|---|---|---| | [`feature_flag.key`](/docs/attributes-registry/feature-flag.md) | string | The lookup key of the feature flag. | `logo-color` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) | | [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [1] | `provider_not_ready`; `targeting_key_missing`; `provider_fatal`; `general` | `Conditionally Required` [2] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | -| [`feature_flag.variant`](/docs/attributes-registry/feature-flag.md) | string | A semantic identifier for an evaluated flag value. [3] | `red`; `true`; `on` | `Conditionally Required` [4] | ![Development](https://img.shields.io/badge/-development-blue) | +| [`feature_flag.result.variant`](/docs/attributes-registry/feature-flag.md) | string | A semantic identifier for an evaluated flag value. [3] | `red`; `true`; `on` | `Conditionally Required` [4] | ![Development](https://img.shields.io/badge/-development-blue) | | [`feature_flag.context.id`](/docs/attributes-registry/feature-flag.md) | string | The unique identifier for the flag evaluation context. For example, the targeting key. | `5157782b-2203-4c80-a857-dbbd5e7761db` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`feature_flag.evaluation.error.message`](/docs/attributes-registry/feature-flag.md) | string | A message explaining the nature of an error occurring during flag evaluation. | `Flag `header-color` expected type `string` but found type `number`` | `Recommended` [5] | ![Development](https://img.shields.io/badge/-development-blue) | -| [`feature_flag.evaluation.reason`](/docs/attributes-registry/feature-flag.md) | string | The reason code which shows how a feature flag value was determined. | `static`; `targeting_match`; `error`; `default` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`feature_flag.provider_name`](/docs/attributes-registry/feature-flag.md) | string | Identifies the feature flag provider. | `Flag Manager` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| [`feature_flag.result.reason`](/docs/attributes-registry/feature-flag.md) | string | The reason code which shows how a feature flag value was determined. | `static`; `targeting_match`; `error`; `default` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`feature_flag.set.id`](/docs/attributes-registry/feature-flag.md) | string | The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) to which the feature flag belongs. | `proj-1`; `ab98sgs`; `service1/dev` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`feature_flag.version`](/docs/attributes-registry/feature-flag.md) | string | The version of the ruleset used during the evaluation. This may be any stable value which uniquely identifies the ruleset. | `1`; `01ABCDEF` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | @@ -83,12 +83,12 @@ A `feature_flag.evaluation` event SHOULD be emitted whenever a feature flag valu **[2] `error.type`:** If and only if an error occurred during flag evaluation. -**[3] `feature_flag.variant`:** A semantic identifier, commonly referred to as a variant, provides a means +**[3] `feature_flag.result.variant`:** A semantic identifier, commonly referred to as a variant, provides a means for referring to a value without including the value itself. This can provide additional context for understanding the meaning behind a value. For example, the variant `red` maybe be used for the value `#c05543`. -**[4] `feature_flag.variant`:** If feature flag provider supplies a variant or equivalent concept. +**[4] `feature_flag.result.variant`:** If feature flag provider supplies a variant or equivalent concept. **[5] `feature_flag.evaluation.error.message`:** If and only if an error occurred. It's NOT RECOMMENDED to duplicate the value of `error.type` in `feature_flag.evaluation.error.message`. @@ -102,7 +102,7 @@ For example, the variant `red` maybe be used for the value `#c05543`. --- -`feature_flag.evaluation.reason` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. +`feature_flag.result.reason` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. | Value | Description | Stability | |---|---|---| diff --git a/model/feature-flags/deprecated/registry-deprecated.yaml b/model/feature-flags/deprecated/registry-deprecated.yaml new file mode 100644 index 000000000..233f3c5e8 --- /dev/null +++ b/model/feature-flags/deprecated/registry-deprecated.yaml @@ -0,0 +1,55 @@ +groups: + - id: registry.feature_flag.deprecated + type: attribute_group + display_name: Deprecated Feature Flag Attributes + brief: "Describes deprecated feature flag attributes." + attributes: + - id: feature_flag.evaluation.reason + type: + members: + - id: static + value: "static" + brief: The resolved value is static (no dynamic evaluation). + stability: development + - id: default + value: "default" + brief: The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic evaluation yielded no result). + stability: development + - id: targeting_match + value: "targeting_match" + brief: The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting. + stability: development + - id: split + value: "split" + brief: The resolved value was the result of pseudorandom assignment. + stability: development + - id: cached + value: "cached" + brief: The resolved value was retrieved from cache. + stability: development + - id: disabled + value: "disabled" + brief: The resolved value was the result of the flag being disabled in the management system. + stability: development + - id: unknown + value: "unknown" + brief: The reason for the resolved value could not be determined. + stability: development + - id: stale + value: "stale" + brief: The resolved value is non-authoritative or possibly out of date + stability: development + - id: error + value: "error" + brief: The resolved value was the result of an error. + stability: development + brief: 'Deprecated, use `feature_flag.result.reason` instead.' + stability: development + deprecated: "Replaced by `feature_flag.result.reason`." + examples: ["static", "targeting_match", "error", "default"] + - id: feature_flag.variant + type: string + brief: 'Deprecated, use `feature_flag.result.variant` instead.' + stability: development + deprecated: "Replaced by `feature_flag.result.variant`." + examples: ["red", "true", "on"] diff --git a/model/feature-flags/events.yaml b/model/feature-flags/events.yaml index fa5429af5..22837ea7a 100644 --- a/model/feature-flags/events.yaml +++ b/model/feature-flags/events.yaml @@ -15,7 +15,7 @@ groups: attributes: - ref: feature_flag.key requirement_level: required - - ref: feature_flag.variant + - ref: feature_flag.result.variant requirement_level: conditionally_required: If feature flag provider supplies a variant or equivalent concept. - ref: feature_flag.provider_name @@ -26,7 +26,7 @@ groups: requirement_level: recommended - ref: feature_flag.set.id requirement_level: recommended - - ref: feature_flag.evaluation.reason + - ref: feature_flag.result.reason requirement_level: recommended - ref: error.type examples: ["provider_not_ready", "targeting_key_missing", "provider_fatal", "general"] diff --git a/model/feature-flags/registry.yaml b/model/feature-flags/registry.yaml index 264d6945b..b86756486 100644 --- a/model/feature-flags/registry.yaml +++ b/model/feature-flags/registry.yaml @@ -16,7 +16,7 @@ groups: stability: development brief: Identifies the feature flag provider. examples: ["Flag Manager"] - - id: feature_flag.variant + - id: feature_flag.result.variant type: string stability: development examples: ["red", "true", "on"] @@ -45,7 +45,7 @@ groups: examples: ["proj-1", "ab98sgs", "service1/dev"] brief: > The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) to which the feature flag belongs. - - id: feature_flag.evaluation.reason + - id: feature_flag.result.reason type: members: - id: static diff --git a/schema-next.yaml b/schema-next.yaml index 107d5861a..76c094c90 100644 --- a/schema-next.yaml +++ b/schema-next.yaml @@ -2,6 +2,13 @@ file_format: 1.1.0 schema_url: https://opentelemetry.io/schemas/1.31.0 versions: next: + all: + changes: + # https://github.com/open-telemetry/semantic-conventions/pull/1989 + - rename_attributes: + attribute_map: + feature_flag.evaluation.reason: feature_flag.result.reason + feature_flag.variant: feature_flag.result.variant 1.31.0: all: changes: