Skip to content

Commit 1ecab0d

Browse files
Remove variant & telemetry support for .NET Feature Management schema (#421)
* reorg test suite * remove variant and telemetry & reorg test suite * update * update constructor * update appsettings.json of EvaluationDataToApplicationInsights example project * update appsetting.json for all examples
1 parent bdc99d7 commit 1ecab0d

File tree

16 files changed

+1604
-2218
lines changed

16 files changed

+1604
-2218
lines changed

examples/BlazorServerApp/appsettings.json

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,43 @@
66
}
77
},
88
"AllowedHosts": "*",
9-
"FeatureManagement": {
10-
"BrowserEnhancement": {
11-
"EnabledFor": [
12-
{
13-
"Name": "Browser",
14-
"Parameters": {
15-
"AllowedBrowsers": [ "Edge" ]
16-
}
9+
"feature_management": {
10+
"feature_flags": [
11+
{
12+
"id": "BrowserEnhancement",
13+
"enabled": true,
14+
"conditions": {
15+
"client_filters": [
16+
{
17+
"name": "Browser",
18+
"parameters": {
19+
"AllowedBrowsers": [ "Edge" ]
20+
}
21+
}
22+
]
1723
}
18-
]
19-
},
20-
"Beta": {
21-
"EnabledFor": [
22-
{
23-
"Name": "Targeting",
24-
"Parameters": {
25-
"Audience": {
26-
"DefaultRolloutPercentage": 50,
27-
"Exclusion": {
28-
"Groups": [
29-
"Guests"
30-
]
24+
},
25+
{
26+
"id": "Beta",
27+
"enabled": true,
28+
"conditions": {
29+
"client_filters": [
30+
{
31+
"name": "Targeting",
32+
"parameters": {
33+
"Audience": {
34+
"DefaultRolloutPercentage": 50,
35+
"Exclusion": {
36+
"Groups": [
37+
"Guests"
38+
]
39+
}
40+
}
3141
}
3242
}
33-
}
43+
]
3444
}
35-
]
36-
}
45+
}
46+
]
3747
}
3848
}

examples/ConsoleApp/appsettings.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
{
2-
"FeatureManagement": {
3-
"Beta": {
4-
"EnabledFor": [
5-
{
6-
"Name": "AccountId",
7-
"Parameters": {
8-
"AllowedAccounts": [ "abcdefghijklmnopqrstuvwxyz" ]
9-
}
2+
"feature_management": {
3+
"feature_flags": [
4+
{
5+
"id": "Beta",
6+
"enabled": true,
7+
"conditions": {
8+
"client_filters": [
9+
{
10+
"name": "AccountId",
11+
"parameters": {
12+
"AllowedAccounts": [ "abcdefghijklmnopqrstuvwxyz" ]
13+
}
14+
}
15+
]
1016
}
11-
]
12-
}
17+
}
18+
]
1319
}
1420
}
Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,61 @@
11
{
2-
"Logging": {
3-
"LogLevel": {
4-
"Default": "Information",
5-
"Microsoft.AspNetCore": "Warning"
6-
}
7-
},
8-
"AllowedHosts": "*",
9-
"ApplicationInsights": {
10-
"ConnectionString": "<connection-string>"
11-
},
12-
"FeatureManagement": {
13-
"ImageRating": {
14-
"Telemetry": {
15-
"Enabled": true,
16-
"Metadata": {
17-
"Label": "A Label",
18-
"Etag": "An etag",
19-
"Tags.A": "Tag A value"
20-
}
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*",
9+
"ApplicationInsights": {
10+
"ConnectionString": "<connection-string>"
11+
},
12+
"feature_management": {
13+
"feature_flags": [
14+
{
15+
"id": "ImageRating",
16+
"enabled": true,
17+
"telemetry": {
18+
"enabled": true,
19+
"metadata": {
20+
"Label": "A Label",
21+
"Etag": "An etag",
22+
"Tags.A": "Tag A value"
23+
}
24+
},
25+
"variants": [
26+
{
27+
"name": "BlackAndWhite",
28+
"configuration_value": "https://cdn.pixabay.com/photo/2017/09/28/09/26/dinosaur-2794840_1280.png"
29+
},
30+
{
31+
"name": "WithColor",
32+
"configuration_value": "https://cdn.pixabay.com/photo/2012/04/02/15/18/stegosaurus-24752_1280.png"
33+
},
34+
{
35+
"name": "HighQuality",
36+
"configuration_value": "https://cdn.pixabay.com/photo/2019/02/01/14/24/landscape-3969074_1280.jpg"
37+
}
38+
],
39+
"allocation": {
40+
"percentile": [
41+
{
42+
"variant": "BlackAndWhite",
43+
"from": 0,
44+
"to": 33
2145
},
22-
"Variants": [
23-
{
24-
"Name": "BlackAndWhite",
25-
"ConfigurationValue": "https://cdn.pixabay.com/photo/2017/09/28/09/26/dinosaur-2794840_1280.png"
26-
},
27-
{
28-
"Name": "WithColor",
29-
"ConfigurationValue": "https://cdn.pixabay.com/photo/2012/04/02/15/18/stegosaurus-24752_1280.png"
30-
},
31-
{
32-
"Name": "HighQuality",
33-
"ConfigurationValue": "https://cdn.pixabay.com/photo/2019/02/01/14/24/landscape-3969074_1280.jpg"
34-
}
35-
],
36-
"Allocation": {
37-
"Percentile": [
38-
{
39-
"Variant": "BlackAndWhite",
40-
"From": 0,
41-
"To": 33
42-
},
43-
{
44-
"Variant": "WithColor",
45-
"From": 33,
46-
"To": 66
47-
},
48-
{
49-
"Variant": "HighQuality",
50-
"From": 66,
51-
"To": 100
52-
}
53-
]
46+
{
47+
"variant": "WithColor",
48+
"from": 33,
49+
"to": 66
5450
},
55-
"EnabledFor": [
56-
{
57-
"Name": "AlwaysOn"
58-
}
59-
]
51+
{
52+
"variant": "HighQuality",
53+
"from": 66,
54+
"to": 100
55+
}
56+
]
6057
}
61-
}
58+
}
59+
]
60+
}
6261
}

examples/FeatureFlagDemo/appsettings.json

Lines changed: 74 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,65 +7,85 @@
77
"AllowedHosts": "*",
88

99
// Define feature flags in config file
10-
"FeatureManagement": {
11-
12-
"Home": true,
13-
"Beta": {
14-
"EnabledFor": [
15-
{
16-
"Name": "Targeting",
17-
"Parameters": { // This json object maps to a strongly typed configuration class
18-
"Audience": {
19-
"Users": [
20-
"Jeff",
21-
"Alicia"
22-
],
23-
"Groups": [
24-
{
25-
"Name": "Ring0",
26-
"RolloutPercentage": 80
27-
},
28-
{
29-
"Name": "Ring1",
30-
"RolloutPercentage": 50
10+
"feature_management": {
11+
"feature_flags": [
12+
{
13+
"id": "Home",
14+
"enabled": true
15+
},
16+
{
17+
"id": "Beta",
18+
"enabled": true,
19+
"conditions": {
20+
"client_filters": [
21+
{
22+
"name": "Microsoft.Targeting",
23+
"parameters": {
24+
"Audience": {
25+
"Users": [
26+
"Jeff",
27+
"Alicia"
28+
],
29+
"Groups": [
30+
{
31+
"Name": "Ring0",
32+
"RolloutPercentage": 80
33+
},
34+
{
35+
"Name": "Ring1",
36+
"RolloutPercentage": 50
37+
}
38+
],
39+
"DefaultRolloutPercentage": 20
3140
}
32-
],
33-
"DefaultRolloutPercentage": 20
41+
}
3442
}
35-
}
43+
]
3644
}
37-
]
38-
},
39-
"CustomViewData": {
40-
"EnabledFor": [
41-
{
42-
"Name": "Browser",
43-
"Parameters": {
44-
"AllowedBrowsers": [ "Chrome", "Edge" ]
45-
}
45+
},
46+
{
47+
"id": "CustomViewData",
48+
"enabled": true,
49+
"conditions": {
50+
"client_filters": [
51+
{
52+
"name": "Browser",
53+
"parameters": {
54+
"AllowedBrowsers": [ "Chrome", "Edge" ]
55+
}
56+
}
57+
]
4658
}
47-
]
48-
},
49-
"ContentEnhancement": {
50-
"EnabledFor": [
51-
{
52-
"Name": "TimeWindow",
53-
"Parameters": {
54-
"Start": "Wed, 01 May 2019 13:59:59 GMT",
55-
"End": "Mon, 01 July 2019 00:00:00 GMT"
56-
}
59+
},
60+
{
61+
"id": "ContentEnhancement",
62+
"enabled": true,
63+
"conditions": {
64+
"client_filters": [
65+
{
66+
"name": "Microsoft.TimeWindow",
67+
"parameters": {
68+
"Start": "Wed, 01 May 2019 13:59:59 GMT",
69+
"End": "Mon, 01 Jul 2019 00:00:00 GMT"
70+
}
71+
}
72+
]
5773
}
58-
]
59-
},
60-
"EnhancedPipeline": {
61-
"EnabledFor": [
62-
{
63-
"Name": "Microsoft.Percentage",
64-
"Parameters": {
65-
"Value": 50
66-
}
74+
},
75+
{
76+
"id": "EnhancedPipeline",
77+
"enabled": true,
78+
"conditions": {
79+
"client_filters": [
80+
{
81+
"name": "Microsoft.Percentage",
82+
"parameters": {
83+
"Value": 50
84+
}
85+
}
86+
]
6787
}
68-
]
69-
}
88+
}
89+
]
7090
}
7191
}

examples/RazorPages/appsettings.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
}
77
},
88
"AllowedHosts": "*",
9-
"FeatureManagement": {
10-
"Home": true
9+
"feature_management": {
10+
"feature_flags": [
11+
{
12+
"id": "Home",
13+
"enabled": true
14+
}
15+
]
1116
}
1217
}

0 commit comments

Comments
 (0)