@@ -113,11 +113,48 @@ export class ExperimentService implements IExperimentService {
113
113
}
114
114
115
115
private logExperiments ( ) {
116
+ if ( this . _optOutFrom . includes ( 'All' ) ) {
117
+ // We prioritize opt out first
118
+ this . output . appendLine ( Experiments . optedOutOf ( ) . format ( 'All' ) ) ;
119
+
120
+ // Since we are in the Opt Out all case, this means when checking for experiment we
121
+ // short circuit and return. So, printing out additional experiment info might cause
122
+ // confusion. So skip printing out any specific experiment details to the log.
123
+ return ;
124
+ } else if ( this . _optInto . includes ( 'All' ) ) {
125
+ // Only if 'All' is not in optOut then check if it is in Opt In.
126
+ this . output . appendLine ( Experiments . inGroup ( ) . format ( 'All' ) ) ;
127
+
128
+ // Similar to the opt out case. If user is opting into to all experiments we short
129
+ // circuit the experiment checks. So, skip printing any additional details to the logs.
130
+ return ;
131
+ }
132
+
116
133
const experiments = this . globalState . get < { features : string [ ] } > ( EXP_MEMENTO_KEY , { features : [ ] } ) ;
117
134
135
+ // Log experiments that users manually opt out, these are experiments which are added using the exp framework.
136
+ this . _optOutFrom
137
+ . filter ( ( exp ) => exp !== 'All' && exp . toLowerCase ( ) . startsWith ( 'python' ) )
138
+ . forEach ( ( exp ) => {
139
+ this . output . appendLine ( Experiments . optedOutOf ( ) . format ( exp ) ) ;
140
+ } ) ;
141
+
142
+ // Log experiments that users manually opt into, these are experiments which are added using the exp framework.
143
+ this . _optInto
144
+ . filter ( ( exp ) => exp !== 'All' && exp . toLowerCase ( ) . startsWith ( 'python' ) )
145
+ . forEach ( ( exp ) => {
146
+ this . output . appendLine ( Experiments . inGroup ( ) . format ( exp ) ) ;
147
+ } ) ;
148
+
149
+ // Log experiments that users are added to by the exp framework
118
150
experiments . features . forEach ( ( exp ) => {
119
- // Filter out experiments groups that are not from the Python extension.
120
- if ( exp . toLowerCase ( ) . startsWith ( 'python' ) ) {
151
+ // Filter out experiment groups that are not from the Python extension.
152
+ // Filter out experiment groups that are not already opted out or opted into.
153
+ if (
154
+ exp . toLowerCase ( ) . startsWith ( 'python' ) &&
155
+ ! this . _optOutFrom . includes ( exp ) &&
156
+ ! this . _optInto . includes ( exp )
157
+ ) {
121
158
this . output . appendLine ( Experiments . inGroup ( ) . format ( exp ) ) ;
122
159
}
123
160
} ) ;
0 commit comments