-
Notifications
You must be signed in to change notification settings - Fork 596
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
Add diffing for ABT Experiments in real-time RC #5623
base: main
Are you sure you want to change the base?
Conversation
Release note changesNo release note changes were detected. If you made changes that should be |
Generated by 🚫 Danger |
Coverage Report 1Affected Products
Test Logs |
Size Report 1Affected Products
Test Logs |
Startup Time Report 1Note: Layout is sometimes suboptimal due to limited formatting support on GitHub. Please check this report on GCS. Notes
Startup Times
|
for (int j = 0; j < affectedKeys.length(); j++) { | ||
String key = affectedKeys.getString(j); | ||
JSONObject experimentsCopy = new JSONObject(experiment.toString()); | ||
// Removing `affectedParameterKeys` because its values never come in the same order which |
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.
thinking: and because we're diffing the metadata w.r.t. the key(s) itself so we don't need to diff the key
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.
yeah that makes sense, removed this
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.
Will want to add a changelog entry too, but can happen in a followup PR
@@ -189,6 +193,38 @@ public boolean equals(Object o) { | |||
return containerJson.toString().equals(that.toString()); | |||
} | |||
|
|||
/** Creates a map where the key is the config key and the value if the experiment description. */ |
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.
/** Creates a map where the key is the config key and the value if the experiment description. */ | |
/** Creates a map where the key is the config key and the value is the experiment description. */ |
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.
updated
@@ -189,6 +193,38 @@ public boolean equals(Object o) { | |||
return containerJson.toString().equals(that.toString()); | |||
} | |||
|
|||
/** Creates a map where the key is the config key and the value if the experiment description. */ | |||
private Map<String, JSONObject> createExperimentsMap(JSONArray allExperiments) |
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 believe this could be static
? Though alternatively it could be nice to make it have a similar signature to createRolloutParameterKeyMap
work as an instance method so we call this.createExperimentsMap()
and other.createExperimentsMap()
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.
updated to just use instance vars
@@ -138,23 +139,99 @@ public void getChangedParams_sameP13nMetadata_returnsEmptySet() throws Exception | |||
} | |||
|
|||
@Test |
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.
Nice tests for this
Adds diffing logic between experiments fetched via real-time and experiments active on the device. The config keys that have been affected by the differences will be added to ConfigUpdate. Testing below:
Created experiments with https://docs.google.com/document/d/1MXxUg1JSBbh3m_Qy4tGPrGs3-Nh8FAwKmg5ZWOKQ3J8/edit
Add experiments to configs using Management API, example: https://rpc.corp.google.com/rpc/builder?rpcId=15352346049097272373
2.1) Add/Remove Experiment to Config Key.
2.2) Replace experiment in Config Key
2.3) Create new param with experiment attached
See changes in SDK