-
Notifications
You must be signed in to change notification settings - Fork 68
feat(optimizely): implement optimizely provider #802
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @JonCanning, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Optimizely provider for the OpenFeature Go SDK, enabling seamless integration with Optimizely Feature Experimentation. The provider allows Go applications to leverage Optimizely's feature flagging and A/B testing capabilities by mapping OpenFeature evaluation contexts to Optimizely user contexts, supporting various flag types and providing clear documentation and examples for implementation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a new Optimizely provider for the OpenFeature Go SDK. The implementation is a good start, but there are several areas for improvement. The core provider logic in provider.go contains significant code duplication that should be refactored for better maintainability. The accompanying tests in provider_test.go are minimal and need to be expanded to cover various evaluation scenarios and error conditions to ensure the provider's reliability. Additionally, the example code and README documentation could be clearer and more helpful for users trying to integrate the provider. My review includes specific suggestions to address these points.
|
@JonCanning Thank you for raising this and for the work you’ve put in so far! There are a few things we’ll need to address before moving forward:
Thanks again, and happy to help clarify any of these! |
|
Thanks for the feedback and apologies for the quality issues, I was a bit too "Jesus take the wheel" with AI. I have reworked it so it's all my fault now 🙂 |
|
Thanks for this contribution! And, thank you @erka for the excellent feedback. I noticed that there's an Optimizely Provider implementation in java-sdk-contrib, where the authors of that Provider have taken a different approach. For example, the Java Provider does not even support string, int, or float evaluations. I am not convinced that that's the right strategy though. Mapping vendor SDK concepts to OpenFeature concepts is not always straightforward. There are often multiple ways of doing so, each with their own trade-offs. Before accepting this contribution, I first really want to come to a consensus on the design of this Provider. I will try to get some more eyes on this. https://github.com/open-feature/java-sdk-contrib/tree/main/providers/optimizely |
|
Sorry for the delay. This Provider is of particular interest to me because my org has built a custom internal Provider that wraps Optimizely. We spent quite a bit of time deliberating various design decisions. It's tough because Optimizely's flags are quite different from other vendors in the sense that a single flag key does not always map to a single value. Here are my thoughts. Optimizely consists of projects, where a project contains flags. Flag keys must be unique across a project, and flags in Optimizely can have zero or more variables. There are three main cases to consider when mapping these to OpenFeature: a flag with zero variables, a flag with one variable, and a flag with more than one variable. The OpenFeature evaluation methods only accept a flag key and return a single value. To solve for that, we considered several approaches:
Here's what we landed on: For flags with no variables, we support only the bool evaluation method and the value of For flags with a single variable, we support the evaluation method based on the type and return the value of the only variable in the flag. If the type doesn't match, return an error. For flags with multiple variables, we use the ObjectEvaluation method, which returns an object of variables names to their values. All other evaluation methods return an error. There is a problematic case where a flag has a single variable and a developer attempts to add another variable. As an example, this would cause a string evaluation to suddenly error because it now has multiple variables. Since this case is not possible as long as the flag is "running" in production, we decided this is OK. Let me know where I can clarify our approach. |
|
@sahidvelji Kinda sad that this hasn’t been open-sourced. I think your approach is reasonable. We’ll probably need a good guide on how to use Optimizely with Open Feature ecosystem. |
Since it's a custom Provider for an internal API, it wouldn't be of value to others. We were also hoping to build Optimizely SDK Providers (which we could open source), but that hasn't been prioritized. |
|
Thanks @sahidvelji, that's very helpful, I'll update it with your suggestions |
|
The DCO check is failing. See https://github.com/open-feature/go-sdk/blob/main/CONTRIBUTING.md#developer-certificate-of-origin |
|
I will try to review this soon. |
This PR