1717
1818import com .optimizely .ab .annotations .VisibleForTesting ;
1919import com .optimizely .ab .config .*;
20- import org .slf4j .Logger ;
21- import org .slf4j .LoggerFactory ;
2220import java .util .*;
2321import java .util .function .Function ;
2422import java .util .stream .Collectors ;
2523
2624public class OptimizelyConfigService {
2725
28- private static final Logger logger = LoggerFactory .getLogger (OptimizelyConfigService .class );
2926 private ProjectConfig projectConfig ;
3027 private OptimizelyConfig optimizelyConfig ;
3128
@@ -36,9 +33,7 @@ public OptimizelyConfigService(ProjectConfig projectConfig) {
3633 this .projectConfig = projectConfig ;
3734 this .featureKeyToVariablesMap = generateFeatureKeyToVariablesMap ();
3835
39- logger .info ("Getting experiment map for project config" );
4036 Map <String , OptimizelyExperiment > experimentsMap = getExperimentsMap ();
41- logger .info ("Creating the complete optimizely config" );
4237 optimizelyConfig = new OptimizelyConfig (
4338 experimentsMap ,
4439 getFeaturesMap (experimentsMap ),
@@ -63,7 +58,6 @@ public OptimizelyConfig getConfig() {
6358 Map <String , List <FeatureVariable >> generateFeatureKeyToVariablesMap () {
6459 List <FeatureFlag > featureFlags = projectConfig .getFeatureFlags ();
6560 if (featureFlags == null ) {
66- logger .warn ("Returning empty map because there are no feature flags in project config" );
6761 return Collections .emptyMap ();
6862 }
6963 return featureFlags .stream ().collect (Collectors .toMap (FeatureFlag ::getKey , featureFlag -> featureFlag .getVariables ()));
@@ -72,15 +66,13 @@ Map<String, List<FeatureVariable>> generateFeatureKeyToVariablesMap() {
7266 @ VisibleForTesting
7367 String getExperimentFeatureKey (String experimentId ) {
7468 List <String > featureKeys = projectConfig .getExperimentFeatureKeyMapping ().get (experimentId );
75- logger .info ("Keys for feature experiment is null {}" , featureKeys == null );
7669 return featureKeys != null ? featureKeys .get (0 ) : null ;
7770 }
7871
7972 @ VisibleForTesting
8073 Map <String , OptimizelyExperiment > getExperimentsMap () {
8174 List <Experiment > experiments = projectConfig .getExperiments ();
8275 if (experiments == null ) {
83- logger .warn ("Returning empty map because there are no experiments in project config" );
8476 return Collections .emptyMap ();
8577 }
8678 return experiments .stream ().collect (Collectors .toMap (Experiment ::getKey , experiment -> new OptimizelyExperiment (
@@ -93,11 +85,9 @@ Map<String, OptimizelyExperiment> getExperimentsMap() {
9385 @ VisibleForTesting
9486 Map <String , OptimizelyVariation > getVariationsMap (List <Variation > variations , String experimentId ) {
9587 if (variations == null ) {
96- logger .warn ("Returning empty map because there variations provided are null" );
9788 return Collections .emptyMap ();
9889 }
9990 Boolean isFeatureExperiment = this .getExperimentFeatureKey (experimentId ) != null ;
100- logger .debug ("Experiment id {} is a feature experiment: {}" , experimentId , isFeatureExperiment );
10191 return variations .stream ().collect (Collectors .toMap (Variation ::getKey , variation -> new OptimizelyVariation (
10292 variation .getId (),
10393 variation .getKey (),
@@ -116,15 +106,13 @@ Map<String, OptimizelyVariation> getVariationsMap(List<Variation> variations, St
116106 Map <String , OptimizelyVariable > getMergedVariablesMap (Variation variation , String experimentId ) {
117107 String featureKey = this .getExperimentFeatureKey (experimentId );
118108 if (featureKey != null ) {
119- logger .info ("Merging the variables as feature key is available" );
120109 // Generate temp map of all the available variable values from variation.
121110 Map <String , OptimizelyVariable > tempVariableIdMap = getFeatureVariableUsageInstanceMap (variation .getFeatureVariableUsageInstances ());
122111
123112 // Iterate over all the variables available in associated feature.
124113 // Use value from variation variable if variable is available in variation and feature is enabled, otherwise use defaultValue from feature variable.
125114 List <FeatureVariable > featureVariables = featureKeyToVariablesMap .get (featureKey );
126115 if (featureVariables == null ) {
127- logger .warn ("Returning empty map as featureKeyToVariablesMap is null" );
128116 return Collections .emptyMap ();
129117 }
130118
@@ -143,7 +131,6 @@ Map<String, OptimizelyVariable> getMergedVariablesMap(Variation variation, Strin
143131 @ VisibleForTesting
144132 Map <String , OptimizelyVariable > getFeatureVariableUsageInstanceMap (List <FeatureVariableUsageInstance > featureVariableUsageInstances ) {
145133 if (featureVariableUsageInstances == null ) {
146- logger .warn ("Returning empty map because there FeatureVariableUsageInstance provided are null" );
147134 return Collections .emptyMap ();
148135 }
149136 return featureVariableUsageInstances .stream ().collect (Collectors .toMap (FeatureVariableUsageInstance ::getId , variable -> new OptimizelyVariable (
@@ -158,7 +145,6 @@ Map<String, OptimizelyVariable> getFeatureVariableUsageInstanceMap(List<FeatureV
158145 Map <String , OptimizelyFeature > getFeaturesMap (Map <String , OptimizelyExperiment > allExperimentsMap ) {
159146 List <FeatureFlag > featureFlags = projectConfig .getFeatureFlags ();
160147 if (featureFlags == null ) {
161- logger .warn ("Returning empty map because there are no feature flags in project config" );
162148 return Collections .emptyMap ();
163149 }
164150 return featureFlags .stream ().collect (Collectors .toMap (FeatureFlag ::getKey , featureFlag -> new OptimizelyFeature (
@@ -172,7 +158,6 @@ Map<String, OptimizelyFeature> getFeaturesMap(Map<String, OptimizelyExperiment>
172158 @ VisibleForTesting
173159 Map <String , OptimizelyExperiment > getExperimentsMapForFeature (List <String > experimentIds , Map <String , OptimizelyExperiment > allExperimentsMap ) {
174160 if (experimentIds == null ) {
175- logger .warn ("Returning empty map because the experiment id list is null" );
176161 return Collections .emptyMap ();
177162 }
178163
@@ -186,7 +171,6 @@ Map<String, OptimizelyExperiment> getExperimentsMapForFeature(List<String> exper
186171 @ VisibleForTesting
187172 Map <String , OptimizelyVariable > getFeatureVariablesMap (List <FeatureVariable > featureVariables ) {
188173 if (featureVariables == null ) {
189- logger .warn ("Returning empty map because the feature variables list is null" );
190174 return Collections .emptyMap ();
191175 }
192176 return featureVariables .stream ().collect (Collectors .toMap (FeatureVariable ::getKey , featureVariable -> new OptimizelyVariable (
0 commit comments