Skip to content

Commit 1b96492

Browse files
author
Jeff Nickoloff
committed
updated README
Signed-off-by: Jeff Nickoloff <jeff.nickoloff@gremlin.com>
1 parent 709fc98 commit 1b96492

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ def lambda_handler(event, context):
6666
}
6767
```
6868

69+
## Enabling the SDK in your Environment
70+
6971
*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.
7072

73+
## Extensibility
74+
7175
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:
7276

7377
```python
@@ -108,7 +112,24 @@ def lambda_handler(event, context):
108112
}
109113
```
110114

111-
### Doing Something Different
115+
### Providing Metadata to Custom Behaviors
116+
117+
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
112133

113134
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.
114135

@@ -126,7 +147,7 @@ else:
126147

127148
If you want to work with lower-level Experiment data you can use `fetch` directly.
128149

129-
## Targeting with Selectors
150+
## Building Experiments: Targeting with Selectors
130151

131152
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.
132153

@@ -193,19 +214,3 @@ This Effect Statement will cause a Failure Flag to pause for a full 2 seconds be
193214
}
194215
```
195216

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:
205-
206-
```json
207-
{
208-
"latency": 1000,
209-
"my-jitter": 500
210-
}
211-
```

0 commit comments

Comments
 (0)