Skip to content

Commit 5eccb6f

Browse files
dyladanmoredipaskpt
authored
Move the evaluated value from the event body to attributes (#1990)
Co-authored-by: Pete Hodgson <[email protected]> Co-authored-by: André Silva <[email protected]>
1 parent a3ae880 commit 5eccb6f

File tree

5 files changed

+62
-35
lines changed

5 files changed

+62
-35
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: breaking
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: feature_flag
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Move the evaluated value from the event body to attributes
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [1990]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/attributes-registry/feature-flag.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ This document defines attributes for Feature Flags.
1616
| <a id="feature-flag-key" href="#feature-flag-key">`feature_flag.key`</a> | string | The lookup key of the feature flag. | `logo-color` | ![Development](https://img.shields.io/badge/-development-blue) |
1717
| <a id="feature-flag-provider-name" href="#feature-flag-provider-name">`feature_flag.provider.name`</a> | string | Identifies the feature flag provider. | `Flag Manager` | ![Development](https://img.shields.io/badge/-development-blue) |
1818
| <a id="feature-flag-result-reason" href="#feature-flag-result-reason">`feature_flag.result.reason`</a> | 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) |
19-
| <a id="feature-flag-result-variant" href="#feature-flag-result-variant">`feature_flag.result.variant`</a> | string | A semantic identifier for an evaluated flag value. [1] | `red`; `true`; `on` | ![Development](https://img.shields.io/badge/-development-blue) |
19+
| <a id="feature-flag-result-value" href="#feature-flag-result-value">`feature_flag.result.value`</a> | any | The evaluated value of the feature flag. [1] | `#ff0000`; `true`; `3` | ![Development](https://img.shields.io/badge/-development-blue) |
20+
| <a id="feature-flag-result-variant" href="#feature-flag-result-variant">`feature_flag.result.variant`</a> | string | A semantic identifier for an evaluated flag value. [2] | `red`; `true`; `on` | ![Development](https://img.shields.io/badge/-development-blue) |
2021
| <a id="feature-flag-set-id" href="#feature-flag-set-id">`feature_flag.set.id`</a> | 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) |
2122
| <a id="feature-flag-version" href="#feature-flag-version">`feature_flag.version`</a> | 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) |
2223

23-
**[1] `feature_flag.result.variant`:** A semantic identifier, commonly referred to as a variant, provides a means
24+
**[1] `feature_flag.result.value`:** With some feature flag providers, feature flag results can be quite large or contain private or sensitive details.
25+
Because of this, `feature_flag.result.variant` is often the preferred attribute if it is available.
26+
27+
It may be desirable to redact or otherwise limit the size and scope of `feature_flag.result.value` if possible.
28+
Because the evaluated flag value is unstructured and may be any type, it is left to the instrumentation author to determine how best to achieve this.
29+
30+
**[2] `feature_flag.result.variant`:** A semantic identifier, commonly referred to as a variant, provides a means
2431
for referring to a value without including the value itself. This can
2532
provide additional context for understanding the meaning behind a value.
2633
For example, the variant `red` maybe be used for the value `#c05543`.

docs/feature-flags/feature-flags-logs.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ A `feature_flag.evaluation` event SHOULD be emitted whenever a feature flag valu
6060
|---|---|---|---|---|---|
6161
| [`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) |
6262
| [`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) |
63-
| [`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) |
64-
| [`error.message`](/docs/attributes-registry/error.md) | string | A message providing more detail about an error in human-readable form. [5] | `Unexpected input type: string`; `The user has exceeded their storage quota` | `Recommended` [6] | ![Development](https://img.shields.io/badge/-development-blue) |
63+
| [`feature_flag.result.value`](/docs/attributes-registry/feature-flag.md) | any | The evaluated value of the feature flag. [3] | `#ff0000`; `true`; `3` | `Conditionally Required` [4] | ![Development](https://img.shields.io/badge/-development-blue) |
64+
| [`feature_flag.result.variant`](/docs/attributes-registry/feature-flag.md) | string | A semantic identifier for an evaluated flag value. [5] | `red`; `true`; `on` | `Conditionally Required` [6] | ![Development](https://img.shields.io/badge/-development-blue) |
65+
| [`error.message`](/docs/attributes-registry/error.md) | string | A message providing more detail about an error in human-readable form. [7] | `Unexpected input type: string`; `The user has exceeded their storage quota` | `Recommended` [8] | ![Development](https://img.shields.io/badge/-development-blue) |
6566
| [`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) |
6667
| [`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) |
6768
| [`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) |
@@ -83,16 +84,24 @@ A `feature_flag.evaluation` event SHOULD be emitted whenever a feature flag valu
8384

8485
**[2] `error.type`:** If and only if an error occurred during flag evaluation.
8586

86-
**[3] `feature_flag.result.variant`:** A semantic identifier, commonly referred to as a variant, provides a means
87+
**[3] `feature_flag.result.value`:** With some feature flag providers, feature flag results can be quite large or contain private or sensitive details.
88+
Because of this, `feature_flag.result.variant` is often the preferred attribute if it is available.
89+
90+
It may be desirable to redact or otherwise limit the size and scope of `feature_flag.result.value` if possible.
91+
Because the evaluated flag value is unstructured and may be any type, it is left to the instrumentation author to determine how best to achieve this.
92+
93+
**[4] `feature_flag.result.value`:** If and only if feature flag provider does not supply variant or equivalent concept. Otherwise, `feature_flag.result.value` should be treated as opt-in.
94+
95+
**[5] `feature_flag.result.variant`:** A semantic identifier, commonly referred to as a variant, provides a means
8796
for referring to a value without including the value itself. This can
8897
provide additional context for understanding the meaning behind a value.
8998
For example, the variant `red` maybe be used for the value `#c05543`.
9099

91-
**[4] `feature_flag.result.variant`:** If feature flag provider supplies a variant or equivalent concept.
100+
**[6] `feature_flag.result.variant`:** If feature flag provider supplies a variant or equivalent concept.
92101

93-
**[5] `error.message`:** Should not simply duplicate the value of `error.type`, but should provide more context. For example, if `error.type` is `invalid_context` the `error.message` may enumerate which context keys are missing or invalid.
102+
**[7] `error.message`:** Should not simply duplicate the value of `error.type`, but should provide more context. For example, if `error.type` is `invalid_context` the `error.message` may enumerate which context keys are missing or invalid.
94103

95-
**[6] `error.message`:** If and only if an error occurred during flag evaluation and `error.type` does not sufficiently describe the error.
104+
**[8] `error.message`:** If and only if an error occurred during flag evaluation and `error.type` does not sufficiently describe the error.
96105

97106
---
98107

@@ -118,18 +127,6 @@ For example, the variant `red` maybe be used for the value `#c05543`.
118127
| `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) |
119128
| `unknown` | The reason for the resolved value could not be determined. | ![Development](https://img.shields.io/badge/-development-blue) |
120129

121-
**Body fields:**
122-
123-
:warning: Body fields will be moved to complex attributes once the
124-
semantic convention tooling supports complex attributes
125-
(see [#1870](https://github.com/open-telemetry/semantic-conventions/issues/1870)).
126-
127-
| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
128-
|---|---|---|---|---|---|
129-
| `value` | undefined | The evaluated value of the feature flag. | `#ff0000`; `1`; `true` | `Conditionally Required` [1] | ![Development](https://img.shields.io/badge/-development-blue) |
130-
131-
**[1] `value`:** If and only if feature flag provider does not supply variant or equivalent concept. Otherwise, `value` should be treated as opt-in.
132-
133130
<!-- markdownlint-restore -->
134131
<!-- prettier-ignore-end -->
135132
<!-- END AUTOGENERATED TEXT -->

model/feature-flags/events.yaml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ groups:
1818
- ref: feature_flag.result.variant
1919
requirement_level:
2020
conditionally_required: If feature flag provider supplies a variant or equivalent concept.
21+
- ref: feature_flag.result.value
22+
requirement_level:
23+
conditionally_required: >
24+
If and only if feature flag provider does not supply variant or equivalent concept.
25+
Otherwise, `feature_flag.result.value` should be treated as opt-in.
2126
- ref: feature_flag.provider.name
2227
requirement_level: recommended
2328
- ref: feature_flag.context.id
@@ -52,18 +57,3 @@ groups:
5257
note: >
5358
Should not simply duplicate the value of `error.type`, but should provide more context.
5459
For example, if `error.type` is `invalid_context` the `error.message` may enumerate which context keys are missing or invalid.
55-
body:
56-
id: feature_flag.evaluation
57-
type: map
58-
requirement_level: recommended
59-
stability: development
60-
fields:
61-
- id: value
62-
type: undefined
63-
stability: development
64-
brief: The evaluated value of the feature flag.
65-
requirement_level:
66-
conditionally_required: >
67-
If and only if feature flag provider does not supply variant or equivalent concept.
68-
Otherwise, `value` should be treated as opt-in.
69-
examples: ["#ff0000", "1", "true"]

model/feature-flags/registry.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,14 @@ groups:
8888
examples: ["static", "targeting_match", "error", "default"]
8989
brief: >
9090
The reason code which shows how a feature flag value was determined.
91+
- id: feature_flag.result.value
92+
type: any
93+
stability: development
94+
examples: ["#ff0000", true, 3]
95+
brief: The evaluated value of the feature flag.
96+
note: |
97+
With some feature flag providers, feature flag results can be quite large or contain private or sensitive details.
98+
Because of this, `feature_flag.result.variant` is often the preferred attribute if it is available.
99+
100+
It may be desirable to redact or otherwise limit the size and scope of `feature_flag.result.value` if possible.
101+
Because the evaluated flag value is unstructured and may be any type, it is left to the instrumentation author to determine how best to achieve this.

0 commit comments

Comments
 (0)