Skip to content

Commit

Permalink
Merge pull request #37 from configcat/consolidate-perc-rule-logs
Browse files Browse the repository at this point in the history
Consolidate perc rule logs
  • Loading branch information
z4kn4fein authored Aug 5, 2022
2 parents aea93d4 + a5af2e7 commit 6dc6228
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 6.5.2
- Consolidate percentage rule evaluation logs.

### 6.5.1
- Add net461 to the target frameworks list to force the usage of `System.Text.Json` rather than `Newtonsoft.Json`.

Expand Down
6 changes: 3 additions & 3 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Steps to Deploy
1. Run tests
2. Set version in `appveyor.yml` (e.g: from `build_version: 6.5.0` to `build_version: 6.5.1`)
3. Update release notes in ConfigCatClient.csproj (PackageReleaseNotes)
4. Push to `master`
5. Deploy to NuGet.org
3. Update release notes in CHANGELOG.md
4. Open a PR
5. When the PR is merged to master, start a deploy to NuGet.org

Create a new deployment on https://ci.appveyor.com/project/configcat/net-sdk/deployments
6. Make sure new package is available via Nuget.org: https://www.nuget.org/packages/ConfigCat.Client
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environment:
build_version: 6.5.1
build_version: 6.5.2
version: $(build_version)-{build}
image: Visual Studio 2022
configuration: Release
Expand Down
13 changes: 4 additions & 9 deletions src/ConfigCatClient/Evaluate/RolloutEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,13 @@ private EvaluateResult EvaluateLogic(IDictionary<string, Setting> settings, stri

// evaluate variations

if (TryEvaluateVariations(setting.RolloutPercentageItems, key, user, out result))
if (TryEvaluateVariations(setting.RolloutPercentageItems, key, user, evaluateLog, out result))
{
evaluateLog.Log("Evaluate % option => user targeted");
evaluateLog.ReturnValue = result.Value.ToString();
evaluateLog.VariationId = result.VariationId;

result.SettingType = setting.SettingType;
return result;
}
else
{
evaluateLog.Log("Evaluate % option => user not targeted");
}
}
else if (setting.RolloutRules.Any() || setting.RolloutPercentageItems.Any())
{
Expand All @@ -139,7 +133,8 @@ private EvaluateResult EvaluateLogic(IDictionary<string, Setting> settings, stri
}
}

private static bool TryEvaluateVariations(ICollection<RolloutPercentageItem> rolloutPercentageItems, string key, User user, out EvaluateResult result)
private static bool TryEvaluateVariations<T>(ICollection<RolloutPercentageItem> rolloutPercentageItems, string key, User user,
EvaluateLogger<T> evaluateLog, out EvaluateResult result)
{
result = new EvaluateResult();

Expand All @@ -160,7 +155,7 @@ private static bool TryEvaluateVariations(ICollection<RolloutPercentageItem> rol
if (hashScale >= bucket) continue;
result.Value = variation.Value;
result.VariationId = variation.VariationId;

evaluateLog.Log($"Evaluating % options, '{key}' evaluated to '{variation.Value}'.");
return true;
}
}
Expand Down

0 comments on commit 6dc6228

Please sign in to comment.