Skip to content

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.

4 participants