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: Workshop.md
+14-21Lines changed: 14 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,22 +39,21 @@ time with each exercise and don't hesitate to experiment!
39
39
2. Toggle the Statistics Header
40
40
41
41
- Locate the environment variables in `src/Garage.AppHost/Properties/launchSettings.json`
42
-
- Change the `ENABLE_STATS_HEADER` environment variable from `"true"` to `"false"`
42
+
- Change the `EnableStatsHeader` environment variable from `"true"` to `"false"`
43
43
- Restart the application to see the behavior change in the web frontend
44
44
- Toggle it back to `"true"`
45
45
46
46
3. Verify the Changes
47
47
48
48
- Navigate to the web frontend
49
49
- Confirm the statistics header appears/disappears based on your flag value
50
-
- Check the Aspire dashboard for any relevant metrics
51
50
52
51
4. Create a New Feature Flag
53
52
54
53
- Add a new boolean flag in `IFeatureFlags.cs` (`EnableTabs`) making sure it is `true`
55
-
- Implement it in `FeatureFlags.cs` to read from environment variable `ENABLE_TABS`
54
+
- Implement it in `FeatureFlags.cs` to read from environment variable `EnableTabs`
56
55
- Add the environment variable to `launchSettings.json` with value `"true"`
57
-
- Use this flag in the `.collection-tabs` div in the `Home.razor` file
56
+
- Use this flag in the `.collection-tabs` div in the `Home.razor` file. Tip: You can use the `ShowHeader` flag as a reference
58
57
59
58
### Expected Outcome
60
59
@@ -87,12 +86,12 @@ You should see the statistics header toggle on and off based on your feature fla
87
86
2. Configure OpenFeature in Extensions file
88
87
89
88
- Open `src/Garage.ServiceDefaults/Extensions.cs`
90
-
- Add OpenFeature services in the `AddFeatureFlags` method, you can ignore the error for now
89
+
- Add OpenFeature services in the `AddFeatureFlags` method
91
90
92
91
3. Implement a Custom Provider
93
92
94
93
- Create a new class `CustomFeatureProvider` in `src/Garage.ServiceDefaults/Providers`
95
-
- Look at the `FeatureProvider` base class. Tip: You can try access the environment variables directly in the `CustomFeatureProvider` class
94
+
- Look at the `FeatureProvider` base class. Tip: You can try access the environment variables directly in the `CustomFeatureProvider` class. Tip: You can skip implementing the `ResolveStructureValueAsync` method for now
96
95
- Add the provider to the OpenFeature configuration in `Extensions.cs`
97
96
98
97
4. Replace the IFeatureFlags dependency injection
@@ -102,7 +101,7 @@ You should see the statistics header toggle on and off based on your feature fla
102
101
5. Make sure to use the UserId in the OpenFeature context
103
102
104
103
- Use the `_userId` property in the `Home.razor` file to set the user context for OpenFeature
105
-
- Ensure the OpenFeature client is aware of the user context
104
+
- Ensure the OpenFeature client is aware of the user context. Tip: Have a look at the `EvaluationContext` class.
106
105
107
106
### Expected Outcome
108
107
@@ -151,7 +150,7 @@ see the custom provider in action, and the feature flags should be evaluated bas
151
150
4. Configure the flagd dependents
152
151
153
152
- Open `src/Garage.AppHost/Program.cs`
154
-
- Modify the `apiservice` and `webfrontend` services to depend on the `flagd` service
153
+
- Modify the `apiservice` and `webfrontend` services to wait for the `flagd` service
155
154
156
155
### Expected Outcome
157
156
@@ -179,30 +178,29 @@ reflected in real-time without restarting the application.
179
178
180
179
1. Understand the SlowOperationDelay Flag
181
180
182
-
- Examine the `SlowOperationDelay` property in `IFeatureFlags.cs`
183
181
- Find where this delay is implemented in the API service
184
-
- Note the default value (1000ms)
185
182
186
183
2. Experiment with Different Delays
187
184
185
+
- Locate the `SlowOperationDelay` flag in `flagd.json`
188
186
- Change the delay to different values:
189
187
-`0` (no delay)
190
188
-`500` (fast)
191
189
-`1000` (default)
192
190
-`2000` (slow)
193
191
-`5000` (very slow)
192
+
- Add a new integer flag for `SlowOperationDelay` in `flagd.json`. For example: `10000` (time to grab a coffee). Tip: This might break the application, so you can have a look into the aspire dashboard to see the error logs
194
193
- Test each configuration and observe the impact
195
194
196
195
3. Monitor Performance Impact
197
196
198
-
- Use the Aspire dashboard to monitor request times
199
197
- Compare response times with different delay values
200
198
- Note how this affects user experience
201
199
202
200
4. Implement a Dynamic Configuration
203
201
204
202
- Consider how you might change this value without redeploying
205
-
- Think about gradual rollout scenarios (e.g., 10% of users get faster performance)
203
+
- Think about gradual rollout scenarios (e.g., 90% of users get faster performance)
206
204
- Look into <https://flagd.dev/playground/> for the fractional rollout feature example
207
205
208
206
### Expected Outcome
@@ -238,7 +236,7 @@ You'll understand how integer flags can control performance characteristics and
238
236
2. Test Data Source Switching
239
237
240
238
- Start with `EnableDatabaseWinners = false` (JSON source)
241
-
-View the winners data in the web application
239
+
-Remove the 2024 winner from the JSON file
242
240
- Change to `EnableDatabaseWinners = true` (database source)
243
241
- Compare the data between sources
244
242
@@ -248,11 +246,6 @@ You'll understand how integer flags can control performance characteristics and
248
246
- Consider error handling scenarios
249
247
- Think about data consistency during transitions
250
248
251
-
4. Add Your Own Data
252
-
253
-
- Add a new winner record to the JSON file
254
-
- Toggle between sources to see different datasets
255
-
256
249
### Expected Outcome
257
250
258
251
You'll see how feature flags can safely control major architectural decisions and enable smooth data migrations.
@@ -278,15 +271,15 @@ You'll see how feature flags can safely control major architectural decisions an
278
271
1. Use the flag `EnableStatsHeader`
279
272
280
273
- Using the `EnableStatsHeader` flag, implement a simple A/B test
281
-
- Use the `EvaluationContext` to differentiate between users, making sure to use the `_userId` property as the targetingKey
274
+
- Use the `EvaluationContext` to differentiate between users, making sure to use the `_userId` property
282
275
- Use the "Change User ID" button on the homepage to simulate different users by changing your user ID
283
276
- Observe how the tabs are displayed in the web application
284
277
285
278
2. Create a new configuration in flagd for `EnableTabs`
286
279
287
280
- Add a new flag in `flagd.json` for `EnableTabs`
288
281
- Set it to `true` for some users and `false` for others
289
-
-Use the `EvaluationContext` to differentiate between users
282
+
-Don't forget to refresh the browser to see the changes
290
283
291
284
### Expected Outcome
292
285
@@ -319,7 +312,7 @@ You will have implemented a basic A/B test using feature flags, allowing you to
319
312
320
313
2. Visualize Flag Usage
321
314
322
-
- Open the Aspire dashboard at <https://localhost:15888>
315
+
- Open the Aspire dashboard
323
316
- Visit the `Traces` section
324
317
- Look for traces related to feature flag evaluations
325
318
- Check the `Metrics` section for flag usage statistics
0 commit comments