@@ -209,6 +209,7 @@ def _get_feature_variable_for_type(self, feature_key, variable_key, variable_typ
209209 return None
210210
211211 feature_enabled = False
212+ source_info = {}
212213 variable_value = variable .defaultValue
213214 decision = self .decision_service .get_variation_for_feature (feature_flag , user_id , attributes )
214215 if decision .variation :
@@ -232,12 +233,11 @@ def _get_feature_variable_for_type(self, feature_key, variable_key, variable_typ
232233 'Returning default value for variable "%s" of feature flag "%s".' % (user_id , variable_key , feature_key )
233234 )
234235
235- experiment_key = None
236- variation_key = None
237-
238- if decision .source == decision_service .DECISION_SOURCE_EXPERIMENT :
239- experiment_key = decision .experiment .key
240- variation_key = decision .variation .key
236+ if decision .source == enums .DecisionSources .FEATURE_TEST :
237+ source_info = {
238+ 'experiment_key' : decision .experiment .key ,
239+ 'variation_key' : decision .variation .key
240+ }
241241
242242 try :
243243 actual_value = self .config .get_typecast_value (variable_value , variable_type )
@@ -247,18 +247,17 @@ def _get_feature_variable_for_type(self, feature_key, variable_key, variable_typ
247247
248248 self .notification_center .send_notifications (
249249 enums .NotificationTypes .DECISION ,
250- enums .DecisionInfoTypes .FEATURE_VARIABLE ,
250+ enums .DecisionNotificationTypes .FEATURE_VARIABLE ,
251251 user_id ,
252252 attributes or {},
253253 {
254254 'feature_key' : feature_key ,
255255 'feature_enabled' : feature_enabled ,
256+ 'source' : decision .source ,
256257 'variable_key' : variable_key ,
257258 'variable_value' : actual_value ,
258259 'variable_type' : variable_type ,
259- 'source' : decision .source ,
260- 'source_experiment_key' : experiment_key ,
261- 'source_variation_key' : variation_key
260+ 'source_info' : source_info
262261 }
263262 )
264263 return actual_value
@@ -388,9 +387,14 @@ def get_variation(self, experiment_key, user_id, attributes=None):
388387 if variation :
389388 variation_key = variation .key
390389
390+ if self .config .is_feature_experiment (experiment .id ):
391+ decision_notification_type = enums .DecisionNotificationTypes .FEATURE_TEST
392+ else :
393+ decision_notification_type = enums .DecisionNotificationTypes .AB_TEST
394+
391395 self .notification_center .send_notifications (
392396 enums .NotificationTypes .DECISION ,
393- enums . DecisionInfoTypes . EXPERIMENT ,
397+ decision_notification_type ,
394398 user_id ,
395399 attributes or {},
396400 {
@@ -432,19 +436,20 @@ def is_feature_enabled(self, feature_key, user_id, attributes=None):
432436 if not feature :
433437 return False
434438
435- experiment_key = None
436439 feature_enabled = False
437- variation_key = None
440+ source_info = {}
438441 decision = self .decision_service .get_variation_for_feature (feature , user_id , attributes )
439- is_source_experiment = decision .source == decision_service . DECISION_SOURCE_EXPERIMENT
442+ is_source_experiment = decision .source == enums . DecisionSources . FEATURE_TEST
440443
441444 if decision .variation :
442445 if decision .variation .featureEnabled is True :
443446 feature_enabled = True
444447 # Send event if Decision came from an experiment.
445448 if is_source_experiment :
446- experiment_key = decision .experiment .key
447- variation_key = decision .variation .key
449+ source_info = {
450+ 'experiment_key' : decision .experiment .key ,
451+ 'variation_key' : decision .variation .key
452+ }
448453 self ._send_impression_event (decision .experiment ,
449454 decision .variation ,
450455 user_id ,
@@ -457,15 +462,14 @@ def is_feature_enabled(self, feature_key, user_id, attributes=None):
457462
458463 self .notification_center .send_notifications (
459464 enums .NotificationTypes .DECISION ,
460- enums .DecisionInfoTypes .FEATURE ,
465+ enums .DecisionNotificationTypes .FEATURE ,
461466 user_id ,
462467 attributes or {},
463468 {
464469 'feature_key' : feature_key ,
465470 'feature_enabled' : feature_enabled ,
466471 'source' : decision .source ,
467- 'source_experiment_key' : experiment_key ,
468- 'source_variation_key' : variation_key
472+ 'source_info' : source_info
469473 }
470474 )
471475
0 commit comments