Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Flag evaluation event #1440

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
64cc6e1
Feature Flag: feature_flag.evaluation event
dyladan Sep 30, 2024
9d70d52
Remove ff events.yaml for now
dyladan Sep 30, 2024
17661ad
Deprecate
dyladan Sep 30, 2024
5a1315f
Fix lint errors
dyladan Sep 30, 2024
778a506
Add changelog entry
dyladan Sep 30, 2024
955784e
Merge branch 'main' into ff-evaluation-event
dyladan Sep 30, 2024
5353b33
Merge remote-tracking branch 'origin/main' into ff-evaluation-event
dyladan Oct 14, 2024
1b2d939
Update ff version to be clear a hash is not a specific recommendation
dyladan Oct 14, 2024
49bbdff
Merge remote-tracking branch 'origin/main' into ff-evaluation-event
dyladan Oct 28, 2024
ab16aba
Rename environment to flag set
dyladan Oct 28, 2024
4ffa81c
Describe feature_flag.key as lookup key
dyladan Oct 28, 2024
97b68d8
Update requirement level for variant and value
dyladan Oct 28, 2024
4e70d70
Avoid word repetition
dyladan Oct 28, 2024
78938e0
Clarify permissiveness of provider id
dyladan Oct 28, 2024
5e4bf75
Merge branch 'main' into ff-evaluation-event
dyladan Nov 4, 2024
e9e209e
Rename flag_set to just set
dyladan Nov 4, 2024
9e68f15
Use system terminology to match db and gen_ai
dyladan Nov 4, 2024
25f4783
Expand brief for flag evaluation event
dyladan Nov 4, 2024
51b7e45
Move feature_flag.value to body field
dyladan Nov 5, 2024
f12c1cf
Add evaluation reason
dyladan Nov 5, 2024
7555d86
Generate tables
dyladan Nov 5, 2024
9ef0ba1
Add feature flag error code
dyladan Nov 5, 2024
ebab494
Add feature flag evaluation log motivation
dyladan Nov 5, 2024
fcca5a6
Fix: provider.id renamed to system
dyladan Nov 5, 2024
5513c81
Add flag evaluation error message
dyladan Nov 5, 2024
27aa56a
Misspell
dyladan Nov 6, 2024
5ae514a
Apply suggestions from code review and remove broken links
dyladan Nov 6, 2024
2e7ca66
Merge branch 'main' into ff-evaluation-event
dyladan Nov 6, 2024
118ce57
Fix issue number
dyladan Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .chloggen/1140.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
change_type: enhancement
component: feature_flag
note: Define `feature_flag.evaluation` event.
issues: [1140]
23 changes: 17 additions & 6 deletions docs/attributes-registry/feature-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,32 @@

# 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.

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <a id="feature-flag-key" href="#feature-flag-key">`feature_flag.key`</a> | string | The unique identifier of the feature flag. | `logo-color` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-provider-name" href="#feature-flag-provider-name">`feature_flag.provider_name`</a> | string | The name of the service provider that performs the flag evaluation. | `Flag Manager` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-variant" href="#feature-flag-variant">`feature_flag.variant`</a> | string | SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the value can be used. [1] | `red`; `true`; `on` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-context-id" href="#feature-flag-context-id">`feature_flag.context.id`</a> | 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) |
| <a id="feature-flag-flag-set-id" href="#feature-flag-flag-set-id">`feature_flag.flag_set.id`</a> | string | The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) which the feature flag belongs to in a flag management system. | `proj-1`; `ab98sgs`; `service1/dev` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-key" href="#feature-flag-key">`feature_flag.key`</a> | string | The lookup key of the feature flag. | `logo-color` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-provider-id" href="#feature-flag-provider-id">`feature_flag.provider.id`</a> | string | The name of the service provider that performs the flag evaluation. | `Flag Manager` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-value" href="#feature-flag-value">`feature_flag.value`</a> | string | The evaluated value of the feature flag. | `#ff0000`; `1`; `true` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="feature-flag-variant" href="#feature-flag-variant">`feature_flag.variant`</a> | string | A semantic identifier for an evaluated flag value. [1] | `red`; `true`; `on` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** 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`.

A stringified version of the value can be used in situations where a
semantic identifier is unavailable. String representation of the value
should be determined by the implementer.
## Deprecated Feature Flag Attributes

Describes deprecated Feature Flag attributes.

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <a id="feature-flag-provider-name" href="#feature-flag-provider-name">`feature_flag.provider_name`</a> | string | Deprecated, use `feature_flag.provider.id` instead. | `Flag Manager` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `feature_flag.provider.id`. |
dyladan marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 14 additions & 10 deletions docs/feature-flags/feature-flags-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ context.
The table below indicates which attributes should be added to the
[LogRecord](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.37.0/specification/logs/data-model.md#log-and-event-record-definition) and their types.

<!-- semconv log-feature_flag -->
<!-- semconv feature_flag.evaluation -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -46,24 +46,28 @@ The table below indicates which attributes should be added to the

**Status:** ![Experimental](https://img.shields.io/badge/-experimental-blue)

The event name MUST be `feature_flag`.
The event name MUST be `feature_flag.evaluation`.

This event describes feature flag evaluation representation on a Log Record.
This semantic convention defines the attributes used to represent a feature flag evaluation as an event.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`feature_flag.key`](/docs/attributes-registry/feature-flag.md) | string | The unique identifier of the feature flag. | `logo-color` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`feature_flag.provider_name`](/docs/attributes-registry/feature-flag.md) | string | The name of the service provider that performs the flag evaluation. | `Flag Manager` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`feature_flag.variant`](/docs/attributes-registry/feature-flag.md) | string | SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the value can be used. [1] | `red`; `true`; `on` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`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) |
| [`feature_flag.value`](/docs/attributes-registry/feature-flag.md) | string | The evaluated value of the feature flag. | `#ff0000`; `1`; `true` | `Conditionally Required` [1] | ![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. [2] | `red`; `true`; `on` | `Conditionally Required` [3] | ![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.flag_set.id`](/docs/attributes-registry/feature-flag.md) | string | The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) which the feature flag belongs to in a flag management system. | `proj-1`; `ab98sgs`; `service1/dev` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`feature_flag.provider.id`](/docs/attributes-registry/feature-flag.md) | string | The name of the service provider that performs the flag evaluation. | `Flag Manager` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** A semantic identifier, commonly referred to as a variant, provides a means
**[1]:** If and only if feature flag provider does not supply variant or equivalent concept. Otherwise, `feature_flag.value` should be treated as opt-in.

**[2]:** 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`.

A stringified version of the value can be used in situations where a
semantic identifier is unavailable. String representation of the value
should be determined by the implementer.
**[3]:** If feature flag provider supplies a variant or equivalent concept.

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand Down
80 changes: 0 additions & 80 deletions docs/feature-flags/feature-flags-spans.md

This file was deleted.

12 changes: 12 additions & 0 deletions model/feature-flag/deprecated/registry-deprecated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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.provider_name
type: string
brief: 'Deprecated, use `feature_flag.provider.id` instead.'
stability: experimental
deprecated: "Replaced by `feature_flag.provider.id`."
dyladan marked this conversation as resolved.
Show resolved Hide resolved
examples: ["Flag Manager"]
14 changes: 0 additions & 14 deletions model/feature-flag/events.yaml

This file was deleted.

25 changes: 20 additions & 5 deletions model/feature-flag/logs.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
groups:
- id: log-feature_flag
- id: feature_flag.evaluation
type: event
stability: experimental
name: feature_flag
name: feature_flag.evaluation
brief: >
This event describes feature flag evaluation representation on a Log Record.
This semantic convention defines the attributes used to represent a
dyladan marked this conversation as resolved.
Show resolved Hide resolved
feature flag evaluation as an event.
attributes:
- ref: feature_flag.key
- ref: feature_flag.provider_name
requirement_level: required
- ref: feature_flag.variant
requirement_level:
conditionally_required: If feature flag provider supplies a variant or equivalent concept.
- ref: feature_flag.provider.id
requirement_level: recommended
- ref: feature_flag.context.id
requirement_level: recommended
- ref: feature_flag.version
requirement_level: recommended
- ref: feature_flag.flag_set.id
requirement_level: recommended
- ref: feature_flag.value
requirement_level:
conditionally_required: >
If and only if feature flag provider does not supply variant or equivalent concept.
Otherwise, `feature_flag.value` should be treated as opt-in.
37 changes: 28 additions & 9 deletions model/feature-flag/registry.yaml
dyladan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,45 @@ groups:
- id: feature_flag.key
type: string
stability: experimental
brief: The unique identifier of the feature flag.
brief: The lookup key of the feature flag.
examples: ["logo-color"]
- id: feature_flag.provider_name
dyladan marked this conversation as resolved.
Show resolved Hide resolved
- id: feature_flag.provider.id
type: string
stability: experimental
brief: The name of the service provider that performs the flag evaluation.
brief: Any string which identifies the feature flag provider being used such as its name.
dyladan marked this conversation as resolved.
Show resolved Hide resolved
examples: ["Flag Manager"]
- id: feature_flag.variant
type: string
stability: experimental
examples: ["red", "true", "on"]
brief: >
SHOULD be a semantic identifier for a value. If one is unavailable, a
stringified version of the value can be used.
A semantic identifier for an evaluated flag value.
note: |-
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`.

A stringified version of the value can be used in situations where a
semantic identifier is unavailable. String representation of the value
should be determined by the implementer.
- id: feature_flag.value
type: string
dyladan marked this conversation as resolved.
Show resolved Hide resolved
stability: experimental
examples: ["#ff0000", "1", "true"]
brief: >
The evaluated value of the feature flag.
- id: feature_flag.context.id
type: string
stability: experimental
examples: ["5157782b-2203-4c80-a857-dbbd5e7761db"]
brief: >
The unique identifier for the flag evaluation context. For example, the targeting key.
- id: feature_flag.version
type: string
stability: experimental
examples: ["1", "01ABCDEF"]
brief: >
The version of the ruleset used during the evaluation. This may be any stable value which uniquely identifies the ruleset.
- id: feature_flag.flag_set.id
dyladan marked this conversation as resolved.
Show resolved Hide resolved
type: string
stability: experimental
examples: ["proj-1", "ab98sgs", "service1/dev"]
brief: >
The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) which the feature flag belongs to in a flag management system.
Loading