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
*Don't forget to enable the SDK by setting the FAILURE_FLAGS_ENABLED environment variable!* If this environment variable is not set then the SDK will short-circuit and no attempt to fetch experiments will be made.
70
72
73
+
## Extensibility
74
+
71
75
You can always bring your own behaviors and effects by providing a behavior function. Here's another Lambda example that writes the experiment data to the console instead of changing the application behavior:
The default effect chain included with the Failure Flags SDK is aware of well-known effect properties including, "latency" and "exception." The user can extend or replace that functionality and use the same properties, or provide their own. For example, suppose a user wants to use a "random jitter" effect that the Standard Chain does not provide. Suppose they wanted to inject a random amount of jitter up to some maximum. They could implement that small extension and make up their own Effect property called, "my-jitter" that specifies that maximum. The resulting Effect Statement would look like:
118
+
119
+
```json
120
+
{ "my-jitter": 500 }
121
+
```
122
+
123
+
They might also combine this with parts of the default chain:
124
+
125
+
```json
126
+
{
127
+
"latency": 1000,
128
+
"my-jitter": 500
129
+
}
130
+
```
131
+
132
+
## Alternatively, use it like a Feature Flag
112
133
113
134
Sometimes you need even more manual control. For example, in the event of an experiment you might not want to make some API call or need to rollback some transaction. In most cases the Exception effect can help, but the `invoke` function also returns a boolean to indicate if there was an experiment. You can use that to create branches in your code like you would for any feature flag.
114
135
@@ -126,7 +147,7 @@ else:
126
147
127
148
If you want to work with lower-level Experiment data you can use `fetch` directly.
128
149
129
-
## Targeting with Selectors
150
+
## Building Experiments: Targeting with Selectors
130
151
131
152
Experiments match specific invocations of a Failure Flag based on its name, and the labels you provide. Experiments define Selectors that the Failure Flags engine uses to determine if an invocation matches. Selectors are simple key to list of values maps. The basic matching logic is every key in a selector must be present in the Failure Flag labels, and at least one of the values in the list for a selector key must match the value in the label.
132
153
@@ -193,19 +214,3 @@ This Effect Statement will cause a Failure Flag to pause for a full 2 seconds be
193
214
}
194
215
```
195
216
196
-
### Advanced: Providing Metadata to Custom Behaviors
197
-
198
-
The default effect chain included with the Failure Flags SDK is aware of well-known effect properties including, "latency" and "exception." The user can extend or replace that functionality and use the same properties, or provide their own. For example, suppose a user wants to use a "random jitter" effect that the Standard Chain does not provide. Suppose they wanted to inject a random amount of jitter up to some maximum. They could implement that small extension and make up their own Effect property called, "my-jitter" that specifies that maximum. The resulting Effect Statement would look like:
199
-
200
-
```json
201
-
{ "my-jitter": 500 }
202
-
```
203
-
204
-
They might also combine this with parts of the default chain:
0 commit comments