diff --git a/.chloggen/feature-flag-eval-value-type.yaml b/.chloggen/feature-flag-eval-value-type.yaml new file mode 100755 index 0000000000..0df1591a8f --- /dev/null +++ b/.chloggen/feature-flag-eval-value-type.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: enhancement + +# 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: Add `feature_flag.evaluation.value.type` event attribute. + +# 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: [4349] + +# (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 974d365e37..122218c106 100644 --- a/docs/attributes-registry/feature-flag.md +++ b/docs/attributes-registry/feature-flag.md @@ -15,6 +15,7 @@ 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` | ![Experimental](https://img.shields.io/badge/-experimental-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`` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `feature_flag.evaluation.reason` | string | The reason code which shows how a feature flag value was determined. | `static`; `targeting_match`; `error`; `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `feature_flag.evaluation.value.type` | string | Indicates the type of the `feature_flag.evaluation` event body field `value`. | `string`; `boolean` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `feature_flag.key` | string | The lookup key of the feature flag. | `logo-color` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `feature_flag.provider_name` | string | Identifies the feature flag provider. | `Flag Manager` | ![Experimental](https://img.shields.io/badge/-experimental-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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | @@ -41,3 +42,19 @@ For example, the variant `red` maybe be used for the value `#c05543`. | `static` | The resolved value is static (no dynamic evaluation). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `targeting_match` | The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `unknown` | The reason for the resolved value could not be determined. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +--- + +`feature_flag.evaluation.value.type` 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 | +|---|---|---| +| `array` | This indicates the type of `feature_flag.evaluation` event body field `value` is array. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `boolean` | This indicates the type of `feature_flag.evaluation` event body field `value` is boolean. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `byte_array` | This indicates the type of `feature_flag.evaluation` event body field `value` is byte array. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `float` | This indicates the type of `feature_flag.evaluation` event body field `value` is double precision floating point (IEEE 754-1985). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `int` | This indicates the type of `feature_flag.evaluation` event body field `value` is 64-bit integer. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `map` | This indicates the type of `feature_flag.evaluation` event body field `value` is map. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `null` | This indicates the type of `feature_flag.evaluation` event body field `value` is null. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `string` | This indicates the type of `feature_flag.evaluation` event body field `value` is string. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `unknown` | This indicates the type of `feature_flag.evaluation` event body field `value` is unknown. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | diff --git a/docs/feature-flags/feature-flags-logs.md b/docs/feature-flags/feature-flags-logs.md index 1f601e9e71..8ab2d41fae 100644 --- a/docs/feature-flags/feature-flags-logs.md +++ b/docs/feature-flags/feature-flags-logs.md @@ -60,9 +60,10 @@ 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` | ![Experimental](https://img.shields.io/badge/-experimental-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] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`feature_flag.evaluation.value.type`](/docs/attributes-registry/feature-flag.md) | string | Indicates the type of the `feature_flag.evaluation` event body field `value`. | `string`; `boolean` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`feature_flag.variant`](/docs/attributes-registry/feature-flag.md) | string | A semantic identifier for an evaluated flag value. [4] | `red`; `true`; `on` | `Conditionally Required` [5] | ![Experimental](https://img.shields.io/badge/-experimental-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` | ![Experimental](https://img.shields.io/badge/-experimental-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] | ![Experimental](https://img.shields.io/badge/-experimental-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` [6] | ![Experimental](https://img.shields.io/badge/-experimental-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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`feature_flag.provider_name`](/docs/attributes-registry/feature-flag.md) | string | Identifies the feature flag provider. | `Flag Manager` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | @@ -83,14 +84,16 @@ 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.evaluation.value.type`:** If and only if `value` field is supplied in the event body + +**[4] `feature_flag.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. +**[5] `feature_flag.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`. +**[6] `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`. --- @@ -116,6 +119,22 @@ For example, the variant `red` maybe be used for the value `#c05543`. | `targeting_match` | The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `unknown` | The reason for the resolved value could not be determined. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +--- + +`feature_flag.evaluation.value.type` 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 | +|---|---|---| +| `array` | This indicates the type of `feature_flag.evaluation` event body field `value` is array. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `boolean` | This indicates the type of `feature_flag.evaluation` event body field `value` is boolean. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `byte_array` | This indicates the type of `feature_flag.evaluation` event body field `value` is byte array. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `float` | This indicates the type of `feature_flag.evaluation` event body field `value` is double precision floating point (IEEE 754-1985). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `int` | This indicates the type of `feature_flag.evaluation` event body field `value` is 64-bit integer. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `map` | This indicates the type of `feature_flag.evaluation` event body field `value` is map. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `null` | This indicates the type of `feature_flag.evaluation` event body field `value` is null. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `string` | This indicates the type of `feature_flag.evaluation` event body field `value` is string. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `unknown` | This indicates the type of `feature_flag.evaluation` event body field `value` is unknown. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + **Body fields:** | Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | diff --git a/model/feature-flags/logs.yaml b/model/feature-flags/logs.yaml index 471b947470..753e3d314a 100644 --- a/model/feature-flags/logs.yaml +++ b/model/feature-flags/logs.yaml @@ -49,6 +49,9 @@ groups: - ref: feature_flag.evaluation.error.message requirement_level: recommended: If and only if an error occurred. It's NOT RECOMMENDED to duplicate the value of `error.type` in `feature_flag.evaluation.error.message`. + - ref: feature_flag.evaluation.value.type + requirement_level: + conditionally_required: If and only if `value` field is supplied in the event body body: id: feature_flag.evaluation type: map diff --git a/model/feature-flags/registry.yaml b/model/feature-flags/registry.yaml index 4b2c70cfe3..479a920451 100644 --- a/model/feature-flags/registry.yaml +++ b/model/feature-flags/registry.yaml @@ -93,3 +93,45 @@ groups: stability: experimental examples: ["Flag `header-color` expected type `string` but found type `number`"] brief: A message explaining the nature of an error occurring during flag evaluation. + - id: feature_flag.evaluation.value.type + type: + members: + - id: string + value: "string" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is string. + stability: experimental + - id: boolean + value: "boolean" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is boolean. + stability: experimental + - id: int + value: "int" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is 64-bit integer. + stability: experimental + - id: float + value: "float" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is double precision floating point (IEEE 754-1985). + stability: experimental + - id: byte_array + value: "byte_array" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is byte array. + stability: experimental + - id: array + value: "array" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is array. + stability: experimental + - id: map + value: "map" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is map. + stability: experimental + - id: "null" + value: "null" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is null. + stability: experimental + - id: unknown + value: "unknown" + brief: This indicates the type of `feature_flag.evaluation` event body field `value` is unknown. + stability: experimental + stability: experimental + examples: ["string", "boolean"] + brief: Indicates the type of the `feature_flag.evaluation` event body field `value`.