-
Notifications
You must be signed in to change notification settings - Fork 32
[FSSDK-11448] Java Implementation: Add Experiment ID and Variation ID to Decision Notification #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
66ecd7e
4bf0e2a
098f47a
332b87f
1b393cb
05d7d81
7ac8437
295aacd
d813b31
7dc7c14
e226329
11f7daf
d846544
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,9 +97,13 @@ public static ExperimentDecisionNotificationBuilder newExperimentDecisionNotific | |
public static class ExperimentDecisionNotificationBuilder { | ||
public final static String EXPERIMENT_KEY = "experimentKey"; | ||
public final static String VARIATION_KEY = "variationKey"; | ||
public final static String EXPERIMENT_ID = "experimentId"; | ||
public final static String VARIATION_ID = "variationId"; | ||
|
||
private String type; | ||
private String experimentKey; | ||
private String experimentId; | ||
private String variationId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these also are not needed |
||
private Variation variation; | ||
private String userId; | ||
private Map<String, ?> attributes; | ||
|
@@ -130,6 +134,16 @@ public ExperimentDecisionNotificationBuilder withVariation(Variation variation) | |
return this; | ||
} | ||
|
||
public ExperimentDecisionNotificationBuilder withExperimentId(String experimentId) { | ||
this.experimentId = experimentId; | ||
return this; | ||
} | ||
|
||
public ExperimentDecisionNotificationBuilder withVariationId(String variationId) { | ||
this.variationId = variationId; | ||
return this; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably why FSC is getting null values as experiment_id and variation_id. Not needed. |
||
public DecisionNotification build() { | ||
if (type == null) { | ||
throw new OptimizelyRuntimeException("type not set"); | ||
|
@@ -141,7 +155,9 @@ public DecisionNotification build() { | |
|
||
decisionInfo = new HashMap<>(); | ||
decisionInfo.put(EXPERIMENT_KEY, experimentKey); | ||
decisionInfo.put(EXPERIMENT_ID, experimentId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
||
decisionInfo.put(VARIATION_KEY, variation != null ? variation.getKey() : null); | ||
decisionInfo.put(VARIATION_ID, variationId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
||
|
||
return new DecisionNotification( | ||
type, | ||
|
@@ -364,6 +380,8 @@ public static class FlagDecisionNotificationBuilder { | |
public final static String RULE_KEY = "ruleKey"; | ||
public final static String REASONS = "reasons"; | ||
public final static String DECISION_EVENT_DISPATCHED = "decisionEventDispatched"; | ||
public final static String EXPERIMENT_ID = "experimentId"; | ||
public final static String VARIATION_ID = "variationId"; | ||
|
||
private String flagKey; | ||
private Boolean enabled; | ||
|
@@ -374,6 +392,8 @@ public static class FlagDecisionNotificationBuilder { | |
private String ruleKey; | ||
private List<String> reasons; | ||
private Boolean decisionEventDispatched; | ||
private String experimentId; | ||
private String variationId; | ||
|
||
private Map<String, Object> decisionInfo; | ||
|
||
|
@@ -422,6 +442,16 @@ public FlagDecisionNotificationBuilder withDecisionEventDispatched(Boolean dispa | |
return this; | ||
} | ||
|
||
public FlagDecisionNotificationBuilder withExperimentId(String experimentId) { | ||
this.experimentId = experimentId; | ||
return this; | ||
} | ||
|
||
public FlagDecisionNotificationBuilder withVariationId(String variationId) { | ||
this.variationId = variationId; | ||
return this; | ||
} | ||
|
||
public DecisionNotification build() { | ||
if (flagKey == null) { | ||
throw new OptimizelyRuntimeException("flagKey not set"); | ||
|
@@ -439,6 +469,8 @@ public DecisionNotification build() { | |
put(RULE_KEY, ruleKey); | ||
put(REASONS, reasons); | ||
put(DECISION_EVENT_DISPATCHED, decisionEventDispatched); | ||
put(EXPERIMENT_ID, experimentId); | ||
put(VARIATION_ID, variationId); | ||
}}; | ||
|
||
return new DecisionNotification( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this class is responsible for activate api and other stuff that are failing in FSC. The createOptimizelyDecision method uses FlagDecisionNotificationBuilder. This class needs to stay unchanged.