Skip to content
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

feat: Experiment override service #164

Merged
merged 18 commits into from
Nov 4, 2019
Merged

feat: Experiment override service #164

merged 18 commits into from
Nov 4, 2019

Conversation

mjc1283
Copy link
Contributor

@mjc1283 mjc1283 commented Nov 1, 2019

Summary

Add ExperimentOverrideService, a decision service that can pull variations from an ExperimentOverrideStore, which is an interface that returns variations for experiment key/user ID pairs.

Included is an implementation of ExperimentOverrideStore based on a map.

Test plan

New unit tests

JIRA Issues

https://optimizely.atlassian.net/browse/OASIS-5419

@mjc1283 mjc1283 removed their assignment Nov 1, 2019
Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks great! I have some suggestions

if variation.Key == variationKey {
decision.Variation = &variation
decision.Reason = reasons.OverrideVariationAssignmentFound
eosLogger.Info(fmt.Sprintf("Override variation %v found for user %v", variationKey, userContext.ID))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a debug level message

return decision, nil
}

// TODO(Matt): Add a VariationsByKey map to the Experiment struct, and use it to look up Variation by key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a keyToID map and then you can just look up by ID

return decision, nil
}

// TODO(Matt): Add a VariationsByKey map to the Experiment struct, and use it to look up Variation by key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this TODO still needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's needed. Ideally we would not have to iterate over variations to find the one with a given key.

@mjc1283 mjc1283 merged commit 86062a1 into master Nov 4, 2019
@mjc1283 mjc1283 deleted the oasis5419 branch November 4, 2019 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants