Skip to content

[FFE] Feature Flags SDK - #7896

Merged
dromanol merged 54 commits into
masterfrom
dani/apm/feature_flags
Jan 12, 2026
Merged

dromanol merged 54 commits into
masterfrom
dani/apm/feature_flags

Conversation

@dromanol

@dromanol dromanol commented Dec 3, 2025 •

Copy link
Copy Markdown
Contributor

Summary of changes

Add support for Feature Flag configuration frameworks

Reason for change

Spec document can be found here

Implementation details

Retrieved FF config from backend through Remote Config. Enable SDK functions.
Created Tracer.FeatureFlags.OpenFeature.nupkg to add support for OpenFeature from V2.0.0 onwards

Test coverage

Added unit and integration tests

Other details

@pr-commenter

pr-commenter Bot commented Dec 3, 2025 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-01-12 15:14:59

Comparing candidate commit 688c62c in PR branch dani/apm/feature_flags with baseline commit 02f5187 in branch master.

Found 9 performance improvements and 9 performance regressions! Performance is the same for 158 metrics, 10 unstable metrics.

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟩 execution_time [-89.632ms; -89.080ms] or [-44.630%; -44.355%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 execution_time [+21.281ms; +27.498ms] or [+10.866%; +14.040%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 execution_time [-20.074ms; -14.094ms] or [-9.246%; -6.492%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-17.047ms; -12.683ms] or [-7.881%; -5.864%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1

  • 🟩 throughput [+161.994op/s; +406.679op/s] or [+6.165%; +15.477%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟩 execution_time [-19.990ms; -15.630ms] or [-9.002%; -7.039%]
  • 🟩 throughput [+82.492op/s; +106.454op/s] or [+7.632%; +9.849%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟩 throughput [+153.691op/s; +181.582op/s] or [+11.797%; +13.937%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+49.843ms; +56.211ms] or [+32.389%; +36.527%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0

  • 🟥 execution_time [+56.328µs; +60.739µs] or [+5.548%; +5.983%]
  • 🟥 throughput [-55.640op/s; -51.731op/s] or [-5.649%; -5.252%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery netcoreapp3.1

  • 🟥 throughput [-31017.752op/s; -22890.164op/s] or [-7.852%; -5.794%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟩 execution_time [-21.950ms; -19.896ms] or [-10.247%; -9.288%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟩 throughput [+40454.872op/s; +53671.822op/s] or [+7.418%; +9.841%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 throughput [-25954.066op/s; -24371.475op/s] or [-7.411%; -6.959%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟥 execution_time [+13.531ms; +16.370ms] or [+6.775%; +8.197%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟥 execution_time [+13.994ms; +19.831ms] or [+7.137%; +10.114%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472

  • 🟥 throughput [-41149.928op/s; -38617.020op/s] or [-5.730%; -5.378%]

@dromanol
dromanol force-pushed the dani/apm/feature_flags branch from cba84d3 to bda4ee9 Compare December 15, 2025 13:03
@datadog-official

This comment has been minimized.

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Dec 15, 2025 •

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7896) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration68.62 ± (68.60 - 68.83) ms68.54 ± (68.56 - 68.81) ms-0.1%✅
.NET Framework 4.8 - Bailout
duration72.60 ± (72.50 - 72.71) ms72.10 ± (72.02 - 72.24) ms-0.7%✅
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1009.91 ± (1012.97 - 1020.81) ms1004.50 ± (1007.11 - 1014.17) ms-0.5%✅
.NET Core 3.1 - Baseline
process.internal_duration_ms21.95 ± (21.93 - 21.98) ms21.98 ± (21.95 - 22.01) ms+0.1%✅⬆️
process.time_to_main_ms78.81 ± (78.69 - 78.94) ms78.85 ± (78.71 - 78.99) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed10.90 ± (10.90 - 10.91) MB10.95 ± (10.94 - 10.95) MB+0.4%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%✅
.NET Core 3.1 - Bailout
process.internal_duration_ms21.93 ± (21.91 - 21.95) ms21.85 ± (21.83 - 21.87) ms-0.4%✅
process.time_to_main_ms80.28 ± (80.19 - 80.37) ms79.77 ± (79.68 - 79.86) ms-0.6%✅
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.95) MB10.94 ± (10.94 - 10.95) MB+0.0%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%✅
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms243.05 ± (239.28 - 246.81) ms242.96 ± (238.86 - 247.06) ms-0.0%✅
process.time_to_main_ms471.84 ± (471.35 - 472.34) ms472.98 ± (472.39 - 473.57) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed48.25 ± (48.23 - 48.27) MB48.27 ± (48.25 - 48.30) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.2%✅
.NET 6 - Baseline
process.internal_duration_ms20.73 ± (20.70 - 20.75) ms20.62 ± (20.59 - 20.66) ms-0.5%✅
process.time_to_main_ms68.53 ± (68.40 - 68.65) ms68.11 ± (67.99 - 68.23) ms-0.6%✅
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.61) MB10.64 ± (10.63 - 10.64) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%✅
.NET 6 - Bailout
process.internal_duration_ms20.62 ± (20.60 - 20.65) ms20.51 ± (20.48 - 20.53) ms-0.6%✅
process.time_to_main_ms69.19 ± (69.13 - 69.24) ms68.90 ± (68.85 - 68.94) ms-0.4%✅
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed10.71 ± (10.70 - 10.71) MB10.74 ± (10.73 - 10.74) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%✅
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms247.69 ± (246.13 - 249.26) ms238.95 ± (236.08 - 241.83) ms-3.5%✅
process.time_to_main_ms443.03 ± (442.54 - 443.51) ms442.67 ± (442.22 - 443.12) ms-0.1%✅
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed48.69 ± (48.65 - 48.73) MB48.78 ± (48.76 - 48.81) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms18.88 ± (18.86 - 18.91) ms18.86 ± (18.83 - 18.89) ms-0.1%✅
process.time_to_main_ms67.28 ± (67.17 - 67.39) ms67.22 ± (67.10 - 67.33) ms-0.1%✅
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.68) MB7.67 ± (7.66 - 7.67) MB-0.1%✅
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%✅
.NET 8 - Bailout
process.internal_duration_ms18.93 ± (18.91 - 18.95) ms18.84 ± (18.81 - 18.87) ms-0.4%✅
process.time_to_main_ms68.36 ± (68.30 - 68.43) ms68.28 ± (68.23 - 68.34) ms-0.1%✅
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed7.70 ± (7.70 - 7.71) MB7.73 ± (7.72 - 7.73) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%✅
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms179.20 ± (178.11 - 180.29) ms178.85 ± (177.80 - 179.89) ms-0.2%✅
process.time_to_main_ms426.05 ± (425.44 - 426.66) ms426.78 ± (426.24 - 427.31) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%✅
runtime.dotnet.mem.committed36.31 ± (36.27 - 36.36) MB36.42 ± (36.39 - 36.46) MB+0.3%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.4%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration191.60 ± (191.70 - 192.61) ms192.23 ± (192.19 - 193.50) ms+0.3%✅⬆️
.NET Framework 4.8 - Bailout
duration194.59 ± (194.50 - 194.92) ms195.07 ± (194.89 - 195.33) ms+0.2%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1109.02 ± (1110.07 - 1117.11) ms1115.71 ± (1118.49 - 1126.36) ms+0.6%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms186.81 ± (186.53 - 187.09) ms187.36 ± (187.02 - 187.69) ms+0.3%✅⬆️
process.time_to_main_ms79.62 ± (79.45 - 79.79) ms79.99 ± (79.74 - 80.24) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%✅
runtime.dotnet.mem.committed16.07 ± (16.04 - 16.09) MB16.04 ± (16.01 - 16.08) MB-0.1%✅
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (19 - 20)-0.2%✅
.NET Core 3.1 - Bailout
process.internal_duration_ms186.11 ± (185.72 - 186.50) ms187.06 ± (186.70 - 187.42) ms+0.5%✅⬆️
process.time_to_main_ms80.95 ± (80.81 - 81.09) ms81.29 ± (81.17 - 81.41) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%✅
runtime.dotnet.mem.committed16.15 ± (16.08 - 16.21) MB16.22 ± (16.19 - 16.25) MB+0.4%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 21)21 ± (21 - 21)+1.5%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms426.50 ± (423.52 - 429.47) ms422.98 ± (419.46 - 426.50) ms-0.8%✅
process.time_to_main_ms471.22 ± (470.70 - 471.74) ms473.52 ± (472.87 - 474.17) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%✅
runtime.dotnet.mem.committed58.78 ± (58.67 - 58.90) MB58.80 ± (58.67 - 58.92) MB+0.0%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 30)30 ± (29 - 30)+0.1%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms191.39 ± (190.98 - 191.80) ms191.34 ± (190.95 - 191.72) ms-0.0%✅
process.time_to_main_ms69.28 ± (69.11 - 69.45) ms69.21 ± (69.06 - 69.36) ms-0.1%✅
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%✅
runtime.dotnet.mem.committed15.75 ± (15.57 - 15.92) MB16.00 ± (15.84 - 16.16) MB+1.6%✅⬆️
runtime.dotnet.threads.count18 ± (17 - 18)18 ± (18 - 18)+2.1%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms189.59 ± (189.33 - 189.84) ms189.95 ± (189.71 - 190.19) ms+0.2%✅⬆️
process.time_to_main_ms69.88 ± (69.79 - 69.97) ms70.01 ± (69.93 - 70.09) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%✅
runtime.dotnet.mem.committed16.12 ± (15.97 - 16.28) MB16.15 ± (16.00 - 16.30) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.3%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms452.56 ± (449.70 - 455.42) ms445.54 ± (442.43 - 448.65) ms-1.6%✅
process.time_to_main_ms444.45 ± (443.94 - 444.96) ms446.07 ± (445.58 - 446.56) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%✅
runtime.dotnet.mem.committed58.32 ± (58.19 - 58.45) MB58.58 ± (58.45 - 58.71) MB+0.4%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.1%✅
.NET 8 - Baseline
process.internal_duration_ms188.96 ± (188.66 - 189.25) ms188.95 ± (188.60 - 189.30) ms-0.0%✅
process.time_to_main_ms68.76 ± (68.55 - 68.98) ms68.61 ± (68.44 - 68.78) ms-0.2%✅
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%✅
runtime.dotnet.mem.committed11.79 ± (11.76 - 11.82) MB11.72 ± (11.69 - 11.75) MB-0.6%✅
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.1%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms188.00 ± (187.78 - 188.22) ms188.13 ± (187.87 - 188.39) ms+0.1%✅⬆️
process.time_to_main_ms69.65 ± (69.55 - 69.76) ms69.63 ± (69.52 - 69.74) ms-0.0%✅
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%✅
runtime.dotnet.mem.committed11.82 ± (11.77 - 11.87) MB11.68 ± (11.59 - 11.76) MB-1.2%✅
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (18 - 19)-2.6%✅
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms360.88 ± (359.37 - 362.40) ms362.98 ± (361.44 - 364.52) ms+0.6%✅⬆️
process.time_to_main_ms427.13 ± (426.47 - 427.79) ms429.03 ± (428.30 - 429.77) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%✅
runtime.dotnet.mem.committed47.95 ± (47.92 - 47.98) MB48.05 ± (48.01 - 48.09) MB+0.2%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.8%✅
Comparison explanation

Execution-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:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7896) - mean (69ms)  : 67, 70
    master - mean (69ms)  : 67, 70

    section Bailout
    This PR (7896) - mean (72ms)  : 71, 73
    master - mean (73ms)  : 72, 74

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (1,011ms)  : 961, 1061
    master - mean (1,017ms)  : 961, 1073

Loading
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 (7896) - mean (106ms)  : 103, 109
    master - mean (106ms)  : 104, 108

    section Bailout
    This PR (7896) - mean (107ms)  : 106, 108
    master - mean (107ms)  : 106, 108

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (742ms)  : 682, 802
    master - mean (742ms)  : 686, 798

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7896) - mean (94ms)  : 91, 96
    master - mean (94ms)  : 92, 96

    section Bailout
    This PR (7896) - mean (94ms)  : 93, 95
    master - mean (94ms)  : 93, 95

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (707ms)  : 665, 749
    master - mean (715ms)  : 690, 740

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7896) - mean (92ms)  : 89, 95
    master - mean (92ms)  : 90, 94

    section Bailout
    This PR (7896) - mean (93ms)  : 92, 94
    master - mean (93ms)  : 92, 94

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (633ms)  : 618, 648
    master - mean (634ms)  : 620, 647

Loading
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 (7896) - mean (193ms)  : 186, 200
    master - mean (192ms)  : 188, 196

    section Bailout
    This PR (7896) - mean (195ms)  : 193, 197
    master - mean (195ms)  : 193, 197

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (1,122ms)  : 1066, 1179
    master - mean (1,114ms)  : 1062, 1165

Loading
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 (7896) - mean (276ms)  : 271, 280
    master - mean (275ms)  : 270, 279

    section Bailout
    This PR (7896) - mean (277ms)  : 272, 281
    master - mean (275ms)  : 271, 279

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (922ms)  : 861, 984
    master - mean (923ms)  : 869, 976

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7896) - mean (269ms)  : 264, 274
    master - mean (269ms)  : 264, 274

    section Bailout
    This PR (7896) - mean (268ms)  : 265, 271
    master - mean (267ms)  : 263, 271

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (920ms)  : 874, 966
    master - mean (926ms)  : 885, 966

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7896) - mean (268ms)  : 263, 272
    master - mean (268ms)  : 261, 274

    section Bailout
    This PR (7896) - mean (267ms)  : 263, 271
    master - mean (267ms)  : 264, 270

    section CallTarget+Inlining+NGEN
    This PR (7896) - mean (822ms)  : 804, 841
    master - mean (819ms)  : 801, 836

Loading

@dd-oleksii dd-oleksii left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a review pass, mostly focusing on evaluator. This is probably the cleanest evaluation outline that I've seen 👍

Main things to handle before release:

  • We should error out on invalid configuration with PARSE_ERROR instead of trying to continue and serving potentially unexpected values.
  • Various conversion inconsistencies (see inline comments).
  • Need to check that user-expected type matches variationType. I'm not sure that using Type is a good approach here and all other SDKs use explicit enums. (Example where Type can fall short: string could be either a string or a JSON flag, and JSON flags could basically be anything.)
  • It looks like a lot of types and methods are public, which makes it hard to evolve SDK without breaking backward compatibility. We generally prefer exposing little to no surface except OpenFeature provider interface and configuration options.

I have started collecting some of the edge case requirements over here, so we're aligned between SDKs. If you have any questions or notice any requirements missing, just drop me a note and I'll add it 🙏

Comment thread tracer/src/Datadog.Trace.Manual/FeatureFlags/FeatureFlagsSdk.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/EvaluationContext.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/EvaluationContext.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/Rcm/Model/Variant.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs
Comment thread tracer/src/Datadog.Trace/FeatureFlags/EvaluationContext.cs Outdated
@dromanol
dromanol marked this pull request as ready for review December 17, 2025 13:32
@dromanol
dromanol requested review from a team as code owners December 17, 2025 13:32
@dromanol
dromanol marked this pull request as draft December 17, 2025 13:40
@dromanol
dromanol marked this pull request as ready for review December 17, 2025 14:06
Comment thread docs/Datadog.FeatureFlags.OpenFeature/README.md Outdated
@DataDog DataDog deleted a comment from chatgpt-codex-connector Bot Dec 18, 2025
@DataDog DataDog deleted a comment from chatgpt-codex-connector Bot Dec 18, 2025
@DataDog DataDog deleted a comment from e-n-0 Dec 18, 2025
@dromanol

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracer/src/Datadog.Trace/FeatureFlags/Rcm/FfeProduct.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just nits, but there's a few important aspects:

  • As discussed, we should probably look at a different approach to supporting OpenFeature, instead of a NuGet package. To get this PR merged ASAP I would suggest
  • Remove the new NuGet package, and just copy the DatadogProvider into the test project for now
  • In a subsequent PR, explore the source generator approach
  • We should add public API telemetry to the public APIs
  • Do we need all of the public APIs that we've added? If the provider is the expect approach, can/should we just provide that. Because we can never remove these public APIs once they're added, but we can always add new ones later. I would prefer we kept them internal until we're sure they're the correct shape
  • There are some problems around initialization and setting handling. We need to handle changes in setting values, and ensure we aren't calling TracerSettings.FromDefaultSources or anything

Comment thread docs/Datadog.FeatureFlags.OpenFeature/README.md Outdated
Comment thread docs/Datadog.FeatureFlags.OpenFeature/README.md Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/Exposure/Model/Allocation.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/Exposure/Model/ExposureEvent.cs Outdated
Comment thread tracer/test/test-applications/feature-flags/Samples.FeatureFlags/Program.cs Outdated
Comment thread tracer/test/test-applications/feature-flags/Samples.OpenFeature-2.9/Program.cs Outdated
Comment thread tracer/test/test-applications/feature-flags/Samples.OpenFeature-2.9/Program.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/Rcm/FfeProduct.cs Outdated
Comment thread tracer/src/Datadog.Trace.Manual/FeatureFlags/FeatureFlagsSdk.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsModule.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/IEvaluationContext.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs Outdated
@dromanol
dromanol force-pushed the dani/apm/feature_flags branch 2 times, most recently from 70878df to 4bb7279 Compare December 22, 2025 18:18

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! A bunch of nits really, but main feedback:

  • We should avoid using ! in any new code, there's almost always ways around it, which we should use
  • Tweaked the config code
  • We should think about the public API a little in terms of what we instrument for future proofing. I've added one suggestion
  • Create a throw helper for FormatException
  • Use concrete types where possible

And then for later:

  • Public API telemetry
  • Nuget/Source gen discussion for DatadogProvider

I haven't approved yet, just so I can keep track a bit better, but there's nothing specifically blocking now I think, just improvements we can make 😄

Comment thread tracer/build/PackageVersionsGeneratorDefinitions.json Outdated
Comment thread tracer/src/Datadog.Trace.Manual/FeatureFlags/FeatureFlagsSdk.cs Outdated
Comment thread tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsModule.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsModule.cs Outdated
Comment thread tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsModule.cs
Comment thread tracer/src/Datadog.Trace/FeatureFlags/IEvaluationContext.cs Outdated
Comment thread tracer/src/Datadog.Trace.Manual/FeatureFlags/FeatureFlagsSdk.cs Outdated
@dromanol
dromanol force-pushed the dani/apm/feature_flags branch from 231eaa5 to 9f485c7 Compare December 24, 2025 11:01
@dromanol
dromanol force-pushed the dani/apm/feature_flags branch from 04cb92c to 688c62c Compare January 12, 2026 14:30
@dromanol
dromanol merged commit 370c5a6 into master Jan 12, 2026
154 checks passed
@dromanol
dromanol deleted the dani/apm/feature_flags branch January 12, 2026 16:53
@github-actions github-actions Bot added this to the vNext-v3 milestone Jan 12, 2026
andrewlock added a commit that referenced this pull request Jan 15, 2026
## Summary of changes

Use the new `PostAsJsonAsync` API to avoid serializing to string and
byte array locally

## Reason for change

We recently added support for `PostAsJsonAsync` in
#8017, and this is a good
example where we can easily swap it in in the new Exposures API used by
FFE: #7896

## Implementation details

Just updated to use the new APIs. A couple of points to notice:

- This doesn't enable gzip. If the endpoint supports it, we should
probably enable that, but would need testing
- This changes the serialization settings, by using
`SerializationHelpers.DefaultJsonSettings`, which omits serializing null
members, and uses snake-case serialization, instead of the PascalCase we
have currently
- However, [looking at the
spec](https://github.com/DataDog/dd-source/blob/main/domains/evp-workers/apps/exposures-worker/schemas/batched_exposures.json),
I'm pretty sure we're not compliant today, and what we're changing to is
correct
  - Which suggests we're missing tests...

## Test coverage

This _should_ be covered by existing tests... and if it's not, then we
need to add those tests 😄
pavlokhrebto added a commit that referenced this pull request Sep 17, 2026
…9260)

## Summary of changes

Removes `Datadog.Trace.FeatureFlags.FeatureFlagsSdk`, the manual
non-OpenFeature Feature Flags
API, from `Datadog.Trace.Manual`, along with its three CallTargets and
its test sample.
OpenFeature (`Datadog.FeatureFlags.OpenFeature`) becomes the only way to
evaluate flags in .NET.

## Reason for change

.NET was the only tracer with a second, Datadog-specific evaluation
surface — Java, Go and Node
ship OpenFeature only. If OpenFeature is the intended supported
approach, the duplicate is better
removed now, while Feature Flags is experimental and gated behind
`DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED`, than after customers adopt
it.

The surface shipped in v3.36.0 (#7896). It is undocumented and excluded
from the public API
snapshot: `PublicApiTestsBase` skips types carrying both
`[Browsable(false)]` and
`[EditorBrowsable(Never)]`, so `FeatureFlagsSdk` appears nowhere in

`PublicApiTests.Datadog.Trace.Manual.PublicApiHasNotChanged.verified.txt`.

It also makes sense to remove it now while no customers use it.

## Implementation details

Deleted:
- `Datadog.Trace.Manual/FeatureFlags/` — `FeatureFlagsSdk`,
`EvaluationContext`, `IEvaluation.Manual`
- `ManualInstrumentation/FeatureFlags/` — the `Evaluate`, `IsAvailable`
and
  `RegisterOnNewConfigEventHandler` CallTargets
- the three `<Compile Include>` links in `Datadog.Trace.Manual.csproj`
(`EvaluationReason`,
`ValueType`, `IEvaluation`). `Datadog.FeatureFlags.OpenFeature.csproj`
links its own copies
  straight from `Datadog.Trace` and is unaffected
- the `Samples.FeatureFlags` project, with its `Datadog.Trace.sln` and
CODEOWNERS entries

`Program.cs` was shared by both samples through a `<Compile Include>`
link, so it moves into
`Samples.OpenFeature` and the link is dropped.

Generated files regenerated with `CompileManagedSrc` and
`RegenerateSolutions`. The diffs are pure
deletions of the three rows, with no signature renumbering.

## Test coverage

`FeatureFlagsTests`, `OpenFeatureFeatureFlagsTests` and
`FeatureFlagsTestsBase` collapse into a
single `FeatureFlagsTests` on the OpenFeature sample. Coverage of the
manual surface goes away
with the surface itself.

Two sample-side improvements come with the move:
- `Samples.OpenFeature`'s `Evaluator.Init()` awaits `SetProviderAsync`
instead of calling `.Wait()`
- a new `<INITIALIZED: READY>` probe and assertion — the only coverage
of the OpenFeature
  `InitializeAsync` CallTarget merged in #9044

## Other details

Breaking change for anyone calling
`Datadog.Trace.FeatureFlags.FeatureFlagsSdk` directly.
pavlokhrebto added a commit that referenced this pull request Sep 24, 2026
…ror (#9299)

## Summary of changes

- `FeatureFlagsModule.Evaluate` returns the caller's default instead of
`null` when no configuration has arrived.
- `FeatureFlagsSdk.GetResolutionDetails` returns the caller's default
for every evaluation that carries an error, and when the tracer is not
attached.
- `Datadog.FeatureFlags.OpenFeature` 2.3.1 → 2.3.2.

## Reason for change

Before configuration arrives, `GetStringValueAsync("flag", "fallback")`
returned `null` instead of `"fallback"`, with `PROVIDER_NOT_READY`. That
is the startup window every application passes through.

OpenFeature substitutes the caller's default only when a provider
throws. This provider reports errors as resolution details instead, so
the default must travel with the details. Three layers could have
supplied it, and none did:

1. **Tracer** — the module's not-ready shortcut returned `null`. It came
in with the original SDK in #7896, where the error string was `No config
loaded`. #8367 changed the string to `PROVIDER_NOT_READY` and kept the
`null`. The evaluator's own not-ready path already returned
`defaultValue`, so the two paths disagreed.
2. **Package** — `GetResolutionDetails` never received the default. It
copied whatever value the tracer returned, and returned `default!` when
the tracer is not attached. For a string flag that is `null`. It came in
with the package in #8077.
3. **OpenFeature client** — it does not step in, because the provider
does not throw.

The same gap also lost JSON defaults. On error the tracer hands back the
caller's OpenFeature `Value`, which `JsonToValue` cannot convert, so the
caller got an empty `Value`.

## How we found it

system-tests [#7496](DataDog/system-tests#7496)
enabled the Feature Flags configuration-source tests for .NET for the
first time. On the first run, the five cold-start cases failed with
`{'errorCode': 'PROVIDER_NOT_READY', 'value': None}` where they expect
the default. Those tests had been `missing_feature` for .NET, and the
unit tests on this path asserted only the error, never the value, so
nothing had covered it.

## Implementation details

The package is the layer that owns the rule: any evaluation with an
error type resolves to the caller's default. The tracer fix is still
needed on its own, because it ships with the tracer, while the package
reaches customers only when they upgrade it.

`Resolve<T>` now takes `T defaultValue` instead of `object?`. No
CallTarget instruments `Resolve`, so changing the signature is safe.

## Test coverage

`Evaluate_WhenNoConfigurationYet_ReturnsTheDefaultValue` covers string,
boolean, integer and numeric flags, and asserts the value. The package
has no unit-test project. The system-tests cold-start cases cover the
not-ready path end to end.

## Other details

Jira: [FFL-3325](https://datadoghq.atlassian.net/browse/FFL-3325)

Delivery: the tracer fix ships in the next tracer release. The package
fix needs `Datadog.FeatureFlags.OpenFeature` 2.3.2.


[FFL-3325]:
https://datadoghq.atlassian.net/browse/FFL-3325?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
pavlokhrebto added a commit that referenced this pull request Sep 24, 2026
…iguration file (#9304)

## Summary of changes

`FfeProduct.UpdateFromRcm` replaces the stored version of a flags file
when a modified version arrives, instead of appending it.

## Reason for change

Fixes #9301. When a flag was disabled or removed for an environment, a
running process kept evaluating it with its last value until restart.
Rule and variant changes propagated; only removals were lost.

A modified file arrives under the path it already has, and never in the
removed set, so `FfeProduct` kept both the old and the new version. The
module merges all stored versions, and a merge only adds or overwrites
keys, so a flag missing from the new version was still served from the
old one. The stored list also grew by one full copy of the flags file on
every update, for the life of the process.

Only the Remote Configuration source is affected. The agentless source
replaces the whole configuration on every update.

### Origin

- [#7896](#7896) made
`FfeProduct` append a modified file instead of replacing it. Removals
still worked, because the module used only the last entry, so the
duplicates were only a memory leak.
- [#8074](#8074) changed
the module to merge all entries. This is where removals broke.
- [#8616](#8616) rewrote
`FlagCollection` with the same add-or-overwrite merge, so the behaviour
did not change.

## Implementation details

Remove any entry stored under the incoming path before adding the new
one, as suggested in the issue. Go does the equivalent: each update
replaces the provider's configuration.

## Test coverage

-
`UpdateRemoteConfig_WhenAModifiedFileDropsAFlag_TheFlagIsNoLongerFound`:
v1 of a file holds two flags, v2 under the same path holds one. The
dropped flag returns `FLAG_NOT_FOUND`, and the kept flag still resolves.
-
`UpdateFromRcm_WhenTheSameFileIsModifiedRepeatedly_HoldsOneVersionOfIt`:
three updates to one path leave exactly one stored version.

## Other details

Jira: [FFL-3338](https://datadoghq.atlassian.net/browse/FFL-3338)

The issue also reports update events arriving as `ProviderReady` with a
null provider name. That was already fixed by #9044, which emits
`ProviderConfigurationChanged` with the provider name, and shipped in
`Datadog.FeatureFlags.OpenFeature` 2.3.1.


[FFL-3338]:
https://datadoghq.atlassian.net/browse/FFL-3338?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants