fix(openfeature): compute correct reason and fix enum string format#8373
fix(openfeature): compute correct reason and fix enum string format#8373leoromanovsky wants to merge 3 commits intomasterfrom
Conversation
…ing mapping - Replace hardcoded EvaluationReason.TargetingMatch with three-way reason computation - Add ToReasonString mapping for OpenFeature spec uppercase strings in FeatureFlagsSdk
- Add reason field to all 21 fixture JSON files with correct PascalCase values - Add unconditional reason assertion in bundle test runner - Update unit test assertions: Split for simple flags, Static for exposure/time-based flags - Rename EvaluateSimpleStringFlagReturnsTargetingMatch to ReturnsSplit
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8373) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (72ms) : 70, 75
master - mean (73ms) : 70, 76
section Bailout
This PR (8373) - mean (76ms) : 74, 77
master - mean (76ms) : 75, 78
section CallTarget+Inlining+NGEN
This PR (8373) - mean (1,079ms) : 1032, 1126
master - mean (1,080ms) : 1032, 1129
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (113ms) : 110, 116
master - mean (113ms) : 109, 118
section Bailout
This PR (8373) - mean (113ms) : 111, 116
master - mean (113ms) : 110, 117
section CallTarget+Inlining+NGEN
This PR (8373) - mean (796ms) : 778, 815
master - mean (800ms) : 782, 817
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (99ms) : 96, 102
master - mean (99ms) : 96, 103
section Bailout
This PR (8373) - mean (100ms) : 97, 104
master - mean (100ms) : 97, 103
section CallTarget+Inlining+NGEN
This PR (8373) - mean (786ms) : 766, 806
master - mean (784ms) : 765, 802
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (99ms) : 96, 102
master - mean (99ms) : 96, 101
section Bailout
This PR (8373) - mean (100ms) : 97, 103
master - mean (99ms) : 97, 101
section CallTarget+Inlining+NGEN
This PR (8373) - mean (688ms) : 664, 711
master - mean (692ms) : 668, 715
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (195ms) : 191, 199
master - mean (216ms) : 208, 223
section Bailout
This PR (8373) - mean (197ms) : 195, 200
master - mean (221ms) : 213, 229
section CallTarget+Inlining+NGEN
This PR (8373) - mean (1,178ms) : 1100, 1256
master - mean (1,251ms) : 1208, 1294
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (278ms) : 274, 282
master - mean (312ms) : 298, 326
section Bailout
This PR (8373) - mean (279ms) : 274, 284
master - mean (313ms) : 301, 324
section CallTarget+Inlining+NGEN
This PR (8373) - mean (953ms) : 928, 978
master - mean (1,033ms) : 1004, 1062
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (271ms) : 266, 276
master - mean (309ms) : 291, 326
section Bailout
This PR (8373) - mean (271ms) : 267, 275
master - mean (309ms) : 295, 323
section CallTarget+Inlining+NGEN
This PR (8373) - mean (973ms) : 949, 998
master - mean (1,068ms) : 1020, 1116
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8373) - mean (271ms) : 265, 277
master - mean (312ms) : 293, 330
section Bailout
This PR (8373) - mean (270ms) : 266, 274
master - mean (312ms) : 292, 332
section CallTarget+Inlining+NGEN
This PR (8373) - mean (857ms) : 835, 878
master - mean (1,034ms) : 955, 1114
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-03-26 04:42:48 Comparing candidate commit f865797 in PR branch Found 6 performance improvements and 5 performance regressions! Performance is the same for 257 metrics, 20 unstable metrics.
|
- Add ffe-system-test-data submodule at tracer/test/Datadog.Trace.Tests/FeatureFlags/ - Switch from embedded resources to file-based fixture loading - Add SCREAMING_SNAKE to PascalCase reason mapping (STATIC->Static, etc.) - Add KnownReasonOverrides for .NET-specific behavior (Error vs Default for missing flags) - Use JToken.DeepEquals for order-independent JSON comparison - Update csproj to reference submodule fixtures with CopyToOutputDirectory - Delete old local FeatureFlags/resources/ directory
Motivation
FeatureFlagsEvaluatorhardcodesEvaluationReason.TargetingMatchfor all successful evaluations. Additionally,FeatureFlagsSdk.csuses.ToString()on the enum which produces"Static"instead of the OpenFeature spec"STATIC"(COMPAT-01).Changes
Evaluator Fix
FeatureFlagsEvaluator.cs: Three-way reason computation based onallocation.Rulesandsplit.Shards— replaces hardcodedTargetingMatchCOMPAT-01: String Format
FeatureFlagsSdk.cs: AddedToReasonString()switch expression mapping eachEvaluationReasonenum to the correct OpenFeature spec uppercase string ("STATIC","SPLIT","TARGETING_MATCH", etc.)Test Updates
"reason"field to all 21 JSON fixture files (211 occurrences)FeatureFlagsEvaluatorTests.Bundle.csFeatureFlagsEvaluatorTests.csDecisions
ToReasonString()uses explicit switch expression (not reflection or attributes) for clarity"Static","TargetingMatch") for C# deserialization; the OpenFeature string conversion happens at the SDK boundary