feat: [docs for ruby v3 ufc + bandits] (FF-2859)#432
feat: [docs for ruby v3 ufc + bandits] (FF-2859)#432leoromanovsky wants to merge 3 commits intomainfrom
Conversation
✅ Deploy Preview for eppo-data-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
aarsilv
left a comment
There was a problem hiding this comment.
Nice work! 🎉 Approving with a BOATLOAD 🛥️ of comments you are welcome to act on or ignore as you see fit!
| EppoClient::init(config) | ||
|
|
||
| # Allow the configuration to be loaded from the CDN. | ||
| sleep(1) |
There was a problem hiding this comment.
🤨 no awaits or callbacks in ruby? or can we make a synchronous version?
Don't love seeing sleep() in our example 😞
There was a problem hiding this comment.
agreed, ruby is single threaded by default though and doesnt have async primitives like async/await. we could have a callback instead, but that would require changing the interface
| To query the bandit for an action, you can use the `get_bandit_action` function. This function takes the following parameters: | ||
| - `flag_key` (str): The key of the feature flag corresponding to the bandit | ||
| - `subject_key` (str): The key of the subject or user assigned to the experiment variation | ||
| - `subject_attributes` (Attributes): The context of the subject |
There was a problem hiding this comment.
In other SDKs we allow either freeform attributes ([key] => bool | number | string) or contextual attributes (numeric_attributes => [key] => number, categorical_attributes => [key] => bool | number | string).
Assuming we do here (and if not, we should adjust) we should call this out in the documentation. It may also help to right after this explain the difference, as we do in our JavaScript documentation (link).
| - `flag_key` (str): The key of the feature flag corresponding to the bandit | ||
| - `subject_key` (str): The key of the subject or user assigned to the experiment variation | ||
| - `subject_attributes` (Attributes): The context of the subject | ||
| - `actions` (Hash{String => Attributes}): A hash that maps available actions to their attributes |
There was a problem hiding this comment.
Same for actions, except we also allow just a set of Strings too if we don't have any action context.
| The `bandit_result` is an instance of `BanditResult`, which has two fields: | ||
|
|
||
| - `variation` (String): The variation that was assigned to the subject | ||
| - `action` (Optional[String]): The action that was assigned to the subject |
There was a problem hiding this comment.
is Optional[String] Ruby-speek?
|
|
||
| The variation returns the feature flag variation; this can be the bandit itself, or the "status quo" variation if the user is not assigned to the bandit. | ||
| If we are unable to generate a variation, for example when the flag is turned off, then the `default` variation is returned. | ||
| In both of those cases, the `action` is `nil`, and you should use the status-quo algorithm to select an action. |
There was a problem hiding this comment.
this may not make sense because one of the above cases is the bandit itself, in which case action won't be nil.
Perhaps reword to "In both of those cases, when action is nil, you should use the status-quo algorithm to select an action.
| - `action` (Optional[String]): The action that was assigned to the subject | ||
|
|
||
| The variation returns the feature flag variation; this can be the bandit itself, or the "status quo" variation if the user is not assigned to the bandit. | ||
| If we are unable to generate a variation, for example when the flag is turned off, then the `default` variation is returned. |
There was a problem hiding this comment.
There is another case, where the bandit encounters an error selecting an action (or there are no actions provided) in which case it will return the bandit variation, but a nil action. I wonder if that's worth explicitly calling out--I think it is.
| or add to you `Gemfile`: | ||
|
|
||
| ``` | ||
| gem 'eppo-server-sdk', '~> 0.3.0' |
There was a problem hiding this comment.
I honestly find it really weird we're jumping from 0.3.0 to 3.0.0. I understand the motivation but would find it jarring as a user
| This generates a singleton client instance that can be reused throughout the application lifecycle. | ||
|
|
||
| If you are using the SDK for experiment assignments, make sure to pass in an assignment logging callback (see [section](#define-an-assignment-logger-experiment-assignment-only) below). | ||
| After initialization, the SDK begins polling Eppo's API at regular intervals to retrieve the most recent experiment configurations such as variation values and traffic allocation. The SDK stores these configurations in memory so that assignments are effectively instant. For more information, see the [architecture overview](/sdks/overview) page. |
There was a problem hiding this comment.
hmm not sure about "effectively instant" - I'd reword as "synchronous" to be more precise
| EppoClient::init(config) | ||
|
|
||
| # Allow the configuration to be loaded from the CDN. | ||
| sleep(1) |
There was a problem hiding this comment.
agreed, ruby is single threaded by default though and doesnt have async primitives like async/await. we could have a callback instead, but that would require changing the interface
ruby v3 has been published with the UFC changes and bandits. I have modeled these docs on the python layout.
Code is located: https://github.com/Eppo-exp/rust-sdk/tree/main/ruby-sdk
👉 The bandits sections needs some attention.