open-feature / dotnet-sdk-contrib

OpenFeature Providers and Hooks for .NET
https://openfeature.dev
Apache License 2.0
30 stars 23 forks source link

feat: relative weights in fractional, fix injected props #208

Closed bacherfl closed 4 months ago

bacherfl commented 6 months ago

This PR adds support for relative weights in the fractional evaluator. This new (non breaking) feature has been proposed in https://github.com/open-feature/flagd/issues/1282 (The related PR to implement this in flagd is this one: https://github.com/open-feature/flagd/pull/1313). In addition to supporting relative weights instead of percentages, the weight value for a distribution item can be omitted. In this case, a default weight of 1 will be applied.

Leaving this in draft until the related PR in flagd has been merged

toddbaert commented 5 months ago

@aepfli Not sure if .NET is your thing, but since you did a few others, could you quickly skim this?

toddbaert commented 4 months ago

I found a couple small issues with this when adding some additional e2e tests, working on some fixes.

toddbaert commented 4 months ago

@bacherfl I made a couple minor tweaks to the algorithm; we had a slight deviation when no bucking value was supplied. You can see them here. Also, this was fun.

I also added the e2e tests for this new functionality.

Thanks so much!