@@ -308,7 +308,8 @@ public Variation GetVariation(string experimentKey, string userId, UserAttribute
308
308
} ;
309
309
310
310
userAttributes = userAttributes ?? new UserAttributes ( ) ;
311
- NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision , DecisionInfoTypes . EXPERIMENT , userId ,
311
+ var decisionNotificationType = Config . IsFeatureExperiment ( experiment . Id ) ? DecisionNotificationTypes . FEATURE_TEST : DecisionNotificationTypes . AB_TEST ;
312
+ NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision , decisionNotificationType , userId ,
312
313
userAttributes , decisionInfo ) ;
313
314
return variation ;
314
315
}
@@ -380,20 +381,19 @@ public virtual bool IsFeatureEnabled(string featureKey, string userId, UserAttri
380
381
if ( ! Validator . IsFeatureFlagValid ( Config , featureFlag ) )
381
382
return false ;
382
383
383
- string experimentKey = null ;
384
- string variationKey = null ;
385
384
bool featureEnabled = false ;
385
+ var sourceInfo = new Dictionary < string , string > ( ) ;
386
386
var decision = DecisionService . GetVariationForFeature ( featureFlag , userId , userAttributes ) ;
387
387
388
388
if ( decision . Variation != null )
389
389
{
390
390
var variation = decision . Variation ;
391
391
featureEnabled = variation . FeatureEnabled . GetValueOrDefault ( ) ;
392
392
393
- if ( decision . Source == FeatureDecision . DECISION_SOURCE_EXPERIMENT )
393
+ if ( decision . Source == FeatureDecision . DECISION_SOURCE_FEATURE_TEST )
394
394
{
395
- experimentKey = decision . Experiment . Key ;
396
- variationKey = variation . Key ;
395
+ sourceInfo [ " experimentKey" ] = decision . Experiment . Key ;
396
+ sourceInfo [ " variationKey" ] = variation . Key ;
397
397
SendImpressionEvent ( decision . Experiment , variation , userId , userAttributes ) ;
398
398
}
399
399
else
@@ -412,11 +412,10 @@ public virtual bool IsFeatureEnabled(string featureKey, string userId, UserAttri
412
412
{ "featureKey" , featureKey } ,
413
413
{ "featureEnabled" , featureEnabled } ,
414
414
{ "source" , decision . Source } ,
415
- { "sourceExperimentKey" , experimentKey } ,
416
- { "sourceVariationKey" , variationKey } ,
415
+ { "sourceInfo" , sourceInfo } ,
417
416
} ;
418
417
419
- NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision , DecisionInfoTypes . FEATURE , userId ,
418
+ NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision , DecisionNotificationTypes . FEATURE , userId ,
420
419
userAttributes ?? new UserAttributes ( ) , decisionInfo ) ;
421
420
return featureEnabled ;
422
421
}
@@ -494,12 +493,11 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
494
493
$@ "User ""{ userId } "" is not in any variation for feature flag ""{ featureKey } "", returning default value ""{ variableValue } "".") ;
495
494
}
496
495
497
- string experimentKey = null ;
498
- string variationKey = null ;
499
- if ( decision ? . Source == FeatureDecision . DECISION_SOURCE_EXPERIMENT )
496
+ var sourceInfo = new Dictionary < string , string > ( ) ;
497
+ if ( decision ? . Source == FeatureDecision . DECISION_SOURCE_FEATURE_TEST )
500
498
{
501
- experimentKey = decision . Experiment . Key ;
502
- variationKey = decision . Variation . Key ;
499
+ sourceInfo [ " experimentKey" ] = decision . Experiment . Key ;
500
+ sourceInfo [ " variationKey" ] = decision . Variation . Key ;
503
501
}
504
502
505
503
var typeCastedValue = GetTypeCastedVariableValue ( variableValue , variableType ) ;
@@ -511,11 +509,10 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
511
509
{ "variableValue" , typeCastedValue } ,
512
510
{ "variableType" , variableType . ToString ( ) . ToLower ( ) } ,
513
511
{ "source" , decision ? . Source } ,
514
- { "sourceExperimentKey" , experimentKey } ,
515
- { "sourceVariationKey" , variationKey } ,
512
+ { "sourceInfo" , sourceInfo } ,
516
513
} ;
517
514
518
- NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision , DecisionInfoTypes . FEATURE_VARIABLE , userId ,
515
+ NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision , DecisionNotificationTypes . FEATURE_VARIABLE , userId ,
519
516
userAttributes ?? new UserAttributes ( ) , decisionInfo ) ;
520
517
return ( T ) typeCastedValue ;
521
518
}
0 commit comments