You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specification.json
+51Lines changed: 51 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -508,6 +508,13 @@
508
508
"RFC 2119 keyword": "MAY",
509
509
"children": []
510
510
},
511
+
{
512
+
"id": "Condition 2.7.1",
513
+
"machine_id": "condition_2_7_1",
514
+
"content": "The `provider` MAY define a function for tracking the occurrence of a particular user action or application state, with parameters `occurrence key` (string, required), `evaluation context` (optional) and `occurrence details` (optional) which returns nothing.",
515
+
"RFC 2119 keyword": "MAY",
516
+
"children": []
517
+
},
511
518
{
512
519
"id": "Requirement 3.1.1",
513
520
"machine_id": "requirement_3_1_1",
@@ -1044,6 +1051,50 @@
1044
1051
"content": "If the provider emits an event, the value of the client's `provider status` MUST be updated accordingly.",
1045
1052
"RFC 2119 keyword": "MUST",
1046
1053
"children": []
1054
+
},
1055
+
{
1056
+
"id": "Condition 6.1.1",
1057
+
"machine_id": "condition_6_1_1",
1058
+
"content": "The implementation uses the dynamic-context paradigm.",
1059
+
"RFC 2119 keyword": null,
1060
+
"children": [
1061
+
{
1062
+
"id": "Conditional Requirement 6.1.1.1",
1063
+
"machine_id": "conditional_requirement_6_1_1_1",
1064
+
"content": "The `client` MUST define a function for tracking the occurrence of a particular action or application state, with parameters `occurrence key` (string, required), `evaluation context` (optional) and `occurrence details` (optional) which returns nothing.",
1065
+
"RFC 2119 keyword": "MUST",
1066
+
"children": []
1067
+
}
1068
+
]
1069
+
},
1070
+
{
1071
+
"id": "Condition 6.1.2",
1072
+
"machine_id": "condition_6_1_2",
1073
+
"content": "The implementation uses the static-context paradigm.",
1074
+
"RFC 2119 keyword": null,
1075
+
"children": [
1076
+
{
1077
+
"id": "Conditional Requirement 6.1.2.1",
1078
+
"machine_id": "conditional_requirement_6_1_2_1",
1079
+
"content": "The `client` MUST define a function for tracking the occurrence of a particular action or application state, with parameters `occurrence key` (string, required) and `occurrence details` (optional) which returns nothing.",
1080
+
"RFC 2119 keyword": "MUST",
1081
+
"children": []
1082
+
}
1083
+
]
1084
+
},
1085
+
{
1086
+
"id": "Requirement 6.1.3",
1087
+
"machine_id": "requirement_6_1_3",
1088
+
"content": "The evaluation context passed to the provider's track function MUST be merged in the order: API (global; lowest precedence) - transaction - client - invocation (highest precedence), with duplicate values being overwritten.",
1089
+
"RFC 2119 keyword": "MUST",
1090
+
"children": []
1091
+
},
1092
+
{
1093
+
"id": "Requirement 6.1.4",
1094
+
"machine_id": "requirement_6_1_4",
1095
+
"content": "If the client's `track` function is called and the associated provider does not implement tracking, the client's `track` function MUST no-op.",
@@ -195,6 +196,10 @@ Pseudorandomly resolve flag values using a context property, such as a targeting
195
196
196
197
A rule is some criteria that's used to determine which variant a particular context should be mapped to.
197
198
199
+
### Tracking Occurrence
200
+
201
+
A particular user action or application state representing a business objective or outcome, identified by a unique string, and recorded using the [tracking API](./sections/06-tracking.md).
202
+
198
203
## SDK Paradigms
199
204
200
205
Feature flag frameworks have SDKs which operate in two distinct paradigms: those designed for use with a single user client application (e.g. mobile phones, single-page web apps), and those designed for multi-user applications, such as web server applications. Some parts of the OpenFeature specification diverge depending on the paradigm.
Copy file name to clipboardExpand all lines: specification/sections/02-providers.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -256,3 +256,34 @@ class MyProvider implements Provider {
256
256
Providers may maintain remote connections, timers, threads or other constructs that need to be appropriately disposed of.
257
257
Provider authors may implement a `shutdown` function to perform relevant clean-up actions.
258
258
Alternatively, implementations might leverage language idioms such as auto-disposable interfaces or some means of cancellation signal propagation to allow for graceful shutdown.
Some flag management systems support tracking functionality, which associates feature flag evaluations with subsequent user actions or application state.
265
+
266
+
See [tracking](./06-tracking.md).
267
+
268
+
#### Condition 2.7.1
269
+
270
+
> The `provider` **MAY** define a function for tracking the occurrence of a particular user action or application state, with parameters `occurrence key` (string, required), `evaluation context` (optional) and `occurrence details` (optional) which returns nothing.
The track function is a void function (function returning nothing).
286
+
The track function performs side effects required to record the `occurrence` in question, which may include network activity or other I/O; this I/O should not block the function call.
287
+
Providers should be careful to complete any communication or flush any relevant uncommitted tracking data before they shut down.
Copy file name to clipboardExpand all lines: specification/sections/06-tracking.md
+85-32Lines changed: 85 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,35 +10,88 @@ toc_max_heading_level: 4
10
10
11
11
## Overview
12
12
13
-
Experimentation is a primary use case for feature flags.
14
-
In practice, this often means flag variants are assigned to users at random or in accordance with a business rule, while the impact of the assigned variant on some business objective is measured.
15
-
Vendors and custom solutions often support a _tracking_ or _goal measuring_ API to facilitate the measurement of these business objectives.
16
-
17
-
### Goals
18
-
19
-
- Develop official terminology to support consistent implementation
20
-
- Specify a flexible API widely compatible with basic vendor functionality
21
-
- Define tracking event payload
22
-
- Define tracking event identifier
23
-
- Support A/B testing and experimentation use-cases
24
-
- Support client and server paradigms
25
-
- Provide recommendations around:
26
-
- Async vs sync
27
-
- Flushing mechanisms
28
-
- Event batching
29
-
30
-
### Non-goals
31
-
32
-
- Creating an experimentation platform
33
-
- Covering every user-tracking use case
34
-
- We will not define any data aggregation mechanisms
35
-
- We will not focus on "metrics", but instead, "facts"
36
-
37
-
### Design Principles
38
-
39
-
We value the following:
40
-
41
-
- Adherence to, and compatibility with OpenFeature semantics
42
-
- Maximum compatibility and ease-of-adoption for existing solutions
43
-
- Minimum traffic and payload size
44
-
- Ease-of-use for application authors, integrators, and provider authors (in that order)
13
+
The `tracking API` enables the association of feature flag evaluations with subsequent actions or application states, in order to facilitate experimentation, and analysis of the impact of feature flags on business objectives.
14
+
15
+
Combined with hooks which report feature flag evaluations to the analytics platform in question, tracking can allow for robust experimentation even for flag management systems that don't support tracking directly.
16
+
17
+
```mermaid
18
+
sequenceDiagram
19
+
Evaluation API->>+Tracking Hook: evaluate
20
+
Tracking Hook->>Analytics Platform: before
21
+
Tracking Hook->>Analytics Platform: after
22
+
Tracking Hook->>-Evaluation API: evaluate
23
+
Evaluation API->>Analytics Platform: track
24
+
```
25
+
26
+
### 6.1. Tracking API
27
+
28
+
#### Condition 6.1.1
29
+
30
+
> The implementation uses the dynamic-context paradigm.
> The `client`**MUST** define a function for tracking the occurrence of a particular action or application state, with parameters `occurrence key` (string, required), `evaluation context` (optional) and `occurrence details` (optional) which returns nothing.
37
+
38
+
```java
39
+
// example tracking occurrence recording that a subject reached a page associated with a business goal
// example tracking occurrence recording that a subject performed an action associated with a business goal, with the occurrence details having a particular numeric value
> The `client`**MUST** define a function for tracking the occurrence of a particular action or application state, with parameters `occurrence key` (string, required) and `occurrence details` (optional) which returns nothing.
59
+
60
+
The track function is a void function (function returning nothing).
61
+
Though it may be associated with network activity or other I/O, it need not be awaited by application authors.
62
+
63
+
```java
64
+
// example tracking occurrence recording that a subject reached a page associated with a business goal
65
+
client.track("visited-promo-page");
66
+
67
+
// example tracking occurrence recording that a subject performed an action associated with a business goal, with the occurrence details having a particular numeric value
> The evaluation context passed to the provider's track function **MUST** be merged in the order: API (global; lowest precedence) -> transaction -> client -> invocation (highest precedence), with duplicate values being overwritten.
74
+
75
+
The SDK passes a merged evaluation context to the provider's track function similarly to the manner it does in resolvers.
76
+
77
+
See: [context levels and merging](./03-evaluation-context.md#32-context-levels-and-merging).
78
+
79
+
#### Requirement 6.1.4
80
+
81
+
> If the client's `track` function is called and the associated provider does not implement tracking, the client's `track` function **MUST** no-op.
82
+
83
+
## 6.2. Occurrence Details
84
+
85
+
The `occurrence details` structure defines optional data pertinent to a particular `occurrence`.
86
+
87
+
### Requirement 6.2.1
88
+
89
+
> The `occurrence details` structure **MUST** define an optional numeric `value`, associating a scalar quality with an `occurrence`.
90
+
91
+
`Value` is a well-defined field which some providers may map to equivalent numeric values in their API.
92
+
93
+
See [provider tracking support](./02-providers.md#27-tracking-support).
94
+
95
+
### Requirement 6.2.2
96
+
97
+
> The `occurrence details`**MUST** support the inclusion of custom fields, having keys of type `string`, and values of type `boolean | string | number`.
0 commit comments