Skip to content

Conversation

@anna-git
Copy link
Contributor

@anna-git anna-git commented Oct 22, 2025

Context

Part of Configuration Inversion (Step 5) - Stack progress:

  1. #7548 - Add GitLab step and JSON configuration file
  2. #7688 - Cleanup configuration / platform keys + source generator
  3. #7698 - Aliases handling via source generator
  4. #7689 - Analyzers for platform and ConfigurationBuilder
  5. #7697 - Replace manual ConfigurationKeys by generated ones in the whole solution (this PR)

Summary of changes

Fixed the ConfigurationKeysGenerator to properly read and apply the configuration_keys_mapping.json file, and extracted common file header comments to a reusable constant.

Key changes:

  • Fixed JSON array extraction in ParseMappingFile method - the generator was incorrectly trying to extract the "mappings" field as an object instead of an array
  • Extracted configuration generator comments to Constants.ConfigurationGeneratorComment for reuse across multiple generators
  • Updated both ConfigurationKeysGenerator and ConfigKeyAliasesSwitcherGenerator to use the shared constant
  • Added documentation as to how to add a key now

Reason for change

The configuration_keys_mapping.json file was being ignored during code generation, causing the generator to produce incorrect constant names. This meant that any manual edits to constant names in the mapping file were not being respected, and the generated code would use auto-generated names instead of the explicitly mapped ones.

Additionally, the file header comments explaining that files are auto-generated were duplicated across generators, violating DRY principles.

Implementation details

  1. Fixed array extraction logic: Replaced the call to JsonReader.ExtractJsonObjectSection() with custom array extraction code that:

    • Finds the "mappings": key in the JSON
    • Locates the opening [ bracket
    • Tracks bracket nesting to find the matching closing ]
    • Extracts the complete array content
  2. Resolved variable scope issue: Reused existing inString and escapeNext variables from the outer scope instead of redeclaring them, fixing compilation errors.

  3. Centralized header comments: Created Constants.ConfigurationGeneratorComment containing the standardized auto-generation notice and updated both generators to use it.

Test coverage

  • Verified the generator builds successfully without errors
  • The mapping file is now properly parsed and applied during code generation
  • Generated constant names now match the mappings defined in configuration_keys_mapping.json

Other details

This fix ensures that the explicit naming conventions defined in configuration_keys_mapping.json are respected, maintaining consistency with the existing codebase and preventing future confusion when constant names don't match their expected values.

@anna-git anna-git changed the title [Config Registry] Anna/config inversion use generate config keys 5 [Config Registry] Replace manual ConfigurationKeys by generated ones in the whole solution Oct 22, 2025
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from a74a26f to 864cbb6 Compare October 22, 2025 15:45
@pr-commenter
Copy link

pr-commenter bot commented Oct 22, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7697 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.117
  • 1 benchmarks are slower, with geometric mean 1.205
  • 8 benchmarks have fewer allocations
  • 8 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.05 KB 6.1 KB 50 B 0.83%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.9μs 56.6ns 265ns 0 0 0 5.51 KB
master StartStopWithChild netcoreapp3.1 14μs 72.6ns 340ns 0 0 0 5.73 KB
master StartStopWithChild net472 21.8μs 114ns 605ns 1.01 0.337 0.112 6.05 KB
#7697 StartStopWithChild net6.0 10.4μs 57.4ns 329ns 0 0 0 5.52 KB
#7697 StartStopWithChild netcoreapp3.1 13.5μs 68.8ns 300ns 0 0 0 5.71 KB
#7697 StartStopWithChild net472 22μs 113ns 517ns 0.963 0.214 0 6.1 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.35 KB 3.31 KB -46 B -1.37%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 935μs 44.1ns 159ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 480ns 1.86μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.23ms 428ns 1.66μs 0 0 0 3.35 KB
#7697 WriteAndFlushEnrichedTraces net6.0 924μs 61.5ns 230ns 0 0 0 2.71 KB
#7697 WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 58.2ns 218ns 0 0 0 2.7 KB
#7697 WriteAndFlushEnrichedTraces net472 1.2ms 30ns 112ns 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 1.08μs 5.4ns 22.9ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.37μs 7.87ns 63.9ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.01μs 0.432ns 1.62ns 0.191 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.28μs 34.1ns 132ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 9.17μs 45.4ns 203ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.68μs 5.18ns 20.1ns 0.735 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 333ns 1.73ns 8.46ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 399ns 2ns 8.24ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 299ns 0.164ns 0.637ns 0.0437 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.49μs 23.2ns 89.8ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 8.05μs 41.2ns 189ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.76μs 3.52ns 13.2ns 0.571 0 0 3.8 KB
#7697 AllCycleSimpleBody net6.0 1.05μs 5.91ns 39.2ns 0 0 0 1.22 KB
#7697 AllCycleSimpleBody netcoreapp3.1 1.4μs 7.8ns 51.8ns 0 0 0 1.2 KB
#7697 AllCycleSimpleBody net472 1.01μs 0.448ns 1.68ns 0.193 0 0 1.23 KB
#7697 AllCycleMoreComplexBody net6.0 7.25μs 37.7ns 177ns 0 0 0 4.72 KB
#7697 AllCycleMoreComplexBody netcoreapp3.1 9.25μs 5.49ns 21.3ns 0 0 0 4.62 KB
#7697 AllCycleMoreComplexBody net472 7.63μs 6.62ns 25.7ns 0.726 0 0 4.74 KB
#7697 ObjectExtractorSimpleBody net6.0 320ns 0.372ns 1.44ns 0 0 0 280 B
#7697 ObjectExtractorSimpleBody netcoreapp3.1 402ns 1.91ns 7.89ns 0 0 0 272 B
#7697 ObjectExtractorSimpleBody net472 300ns 0.0378ns 0.142ns 0.0436 0 0 281 B
#7697 ObjectExtractorMoreComplexBody net6.0 6.59μs 3.86ns 15ns 0 0 0 3.78 KB
#7697 ObjectExtractorMoreComplexBody netcoreapp3.1 8.03μs 37.1ns 153ns 0 0 0 3.69 KB
#7697 ObjectExtractorMoreComplexBody net472 6.7μs 0.887ns 3.2ns 0.603 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 76.8μs 240ns 930ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 96.7μs 205ns 796ns 0 0 0 32.4 KB
master EncodeArgs net472 110μs 15.5ns 60.1ns 4.98 0 0 32.51 KB
master EncodeLegacyArgs net6.0 149μs 42ns 151ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 197μs 128ns 480ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 264μs 142ns 531ns 0 0 0 2.16 KB
#7697 EncodeArgs net6.0 76.4μs 277ns 1.07μs 0 0 0 32.4 KB
#7697 EncodeArgs netcoreapp3.1 95.9μs 308ns 1.19μs 0 0 0 32.4 KB
#7697 EncodeArgs net472 111μs 67.3ns 261ns 4.99 0 0 32.51 KB
#7697 EncodeLegacyArgs net6.0 141μs 23.7ns 91.9ns 0 0 0 2.15 KB
#7697 EncodeLegacyArgs netcoreapp3.1 199μs 173ns 671ns 0 0 0 2.15 KB
#7697 EncodeLegacyArgs net472 263μs 61.1ns 237ns 0 0 0 2.17 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net472 0 b 8.19 KB 8.19 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472 0 b 8.19 KB 8.19 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net6.0 5.14 KB 5.48 KB 336 B 6.53%

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net6.0 3.17 KB 2.54 KB -624 B -19.70%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 424μs 856ns 3.09μs 0 0 0 5.14 KB
master RunWafRealisticBenchmark netcoreapp3.1 447μs 1.52μs 5.26μs 0 0 0 4.58 KB
master RunWafRealisticBenchmark net472 495μs 433ns 1.56μs 0 0 0 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 308μs 534ns 1.93μs 0 0 0 3.17 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 367μs 3.92μs 38μs 0 0 0 2.32 KB
master RunWafRealisticBenchmarkWithAttack net472 368μs 307ns 1.11μs 0 0 0 0 b
#7697 RunWafRealisticBenchmark net6.0 424μs 952ns 3.43μs 0 0 0 5.48 KB
#7697 RunWafRealisticBenchmark netcoreapp3.1 459μs 2.6μs 17μs 0 0 0 4.58 KB
#7697 RunWafRealisticBenchmark net472 495μs 410ns 1.48μs 0 0 0 8.19 KB
#7697 RunWafRealisticBenchmarkWithAttack net6.0 313μs 1.25μs 4.52μs 0 0 0 2.54 KB
#7697 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 330μs 704ns 4.28μs 0 0 0 2.32 KB
#7697 RunWafRealisticBenchmarkWithAttack net472 371μs 170ns 590ns 0 0 0 8.19 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 61μs 42.6ns 159ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.4μs 104ns 362ns 0 0 0 17.42 KB
master SendRequest net472 0.16ns 0.00366ns 0.0142ns 0 0 0 0 b
#7697 SendRequest net6.0 61.4μs 63.4ns 246ns 0 0 0 14.52 KB
#7697 SendRequest netcoreapp3.1 70.4μs 62.1ns 215ns 0 0 0 17.42 KB
#7697 SendRequest net472 0.159ns 0.00418ns 0.0162ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7697

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 1.117 1,265,000.00 1,132,400.00

More allocations ⚠️ in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 0 b 8.19 KB 8.19 KB
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 0 b 8.19 KB 8.19 KB

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 976 B 640 B -336 B -34.43%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 688 B 304 B -384 B -55.81%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 2.01ms 445ns 1.6μs 0 0 0 640.3 KB
master OriginalCharSlice netcoreapp3.1 3.97ms 1.07μs 3.99μs 0 0 0 640.1 KB
master OriginalCharSlice net472 2.61ms 816ns 3.16μs 0 0 0 647.17 KB
master OptimizedCharSlice net6.0 1.41ms 688ns 2.67μs 0 0 0 976 B
master OptimizedCharSlice netcoreapp3.1 2.78ms 1.29μs 4.82μs 0 0 0 104 B
master OptimizedCharSlice net472 1.94ms 436ns 1.63μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 1.01ms 814ns 3.15μs 0 0 0 688 B
master OptimizedCharSliceWithPool netcoreapp3.1 1.86ms 1.8μs 6.72μs 0 0 0 104 B
master OptimizedCharSliceWithPool net472 1.27ms 2.43μs 9.4μs 0 0 0 0 b
#7697 OriginalCharSlice net6.0 2.02ms 1.74μs 6.52μs 0 0 0 640.64 KB
#7697 OriginalCharSlice netcoreapp3.1 3.93ms 1.54μs 5.33μs 0 0 0 640.1 KB
#7697 OriginalCharSlice net472 2.64ms 591ns 2.05μs 0 0 0 647.17 KB
#7697 OptimizedCharSlice net6.0 1.44ms 790ns 2.95μs 0 0 0 640 B
#7697 OptimizedCharSlice netcoreapp3.1 2.97ms 1.01μs 3.79μs 0 0 0 104 B
#7697 OptimizedCharSlice net472 1.94ms 1.08μs 4.2μs 0 0 0 8.19 KB
#7697 OptimizedCharSliceWithPool net6.0 1.02ms 622ns 2.41μs 0 0 0 304 B
#7697 OptimizedCharSliceWithPool netcoreapp3.1 1.86ms 1.88μs 7.29μs 0 0 0 104 B
#7697 OptimizedCharSliceWithPool net472 1.13ms 590ns 2.29μs 0 0 0 8.19 KB
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #7697

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 1.205 860,581.64 1,036,767.86

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 42.36 KB 41.78 KB -576 B -1.36%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 709μs 3.94μs 24.9μs 0 0 0 41.63 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 770μs 2.93μs 13.4μs 0 0 0 42.36 KB
master WriteAndFlushEnrichedTraces net472 861μs 2.69μs 10μs 7.81 0 0 56.03 KB
#7697 WriteAndFlushEnrichedTraces net6.0 640μs 2.72μs 13.1μs 0 0 0 41.71 KB
#7697 WriteAndFlushEnrichedTraces netcoreapp3.1 798μs 4.56μs 32.2μs 0 0 0 41.78 KB
#7697 WriteAndFlushEnrichedTraces net472 1.05ms 6.09μs 52.8μs 4.46 0 0 56.17 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 2μs 10.5ns 52.3ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.59μs 10.7ns 41.3ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.73μs 1.01ns 3.77ns 0.151 0 0 987 B
#7697 ExecuteNonQuery net6.0 1.9μs 4.03ns 15.6ns 0 0 0 1.02 KB
#7697 ExecuteNonQuery netcoreapp3.1 2.54μs 2.28ns 8.55ns 0 0 0 1.02 KB
#7697 ExecuteNonQuery net472 2.87μs 2.78ns 10.8ns 0.143 0 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.68μs 9.06ns 48.8ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.33μs 9.54ns 36.9ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.55μs 5.4ns 20.9ns 0.16 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.78μs 8.8ns 37.3ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.46μs 11.4ns 45.5ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.83μs 1.42ns 4.91ns 0.174 0 0 1.1 KB
#7697 CallElasticsearch net6.0 1.76μs 0.901ns 3.49ns 0 0 0 1.03 KB
#7697 CallElasticsearch netcoreapp3.1 2.31μs 11.2ns 48.9ns 0 0 0 1.03 KB
#7697 CallElasticsearch net472 3.53μs 8.81ns 34.1ns 0.159 0 0 1.04 KB
#7697 CallElasticsearchAsync net6.0 1.9μs 7.18ns 27.8ns 0 0 0 1.01 KB
#7697 CallElasticsearchAsync netcoreapp3.1 2.44μs 12.3ns 53.8ns 0 0 0 1.08 KB
#7697 CallElasticsearchAsync net472 3.74μs 6.48ns 25.1ns 0.168 0 0 1.1 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.89μs 6.44ns 24.9ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.45μs 9.74ns 37.7ns 0 0 0 952 B
master ExecuteAsync net472 2.61μs 3.17ns 12.3ns 0.142 0 0 915 B
#7697 ExecuteAsync net6.0 1.82μs 8.04ns 31.1ns 0 0 0 952 B
#7697 ExecuteAsync netcoreapp3.1 2.4μs 12.4ns 59.5ns 0 0 0 952 B
#7697 ExecuteAsync net472 2.71μs 1.79ns 6.95ns 0.136 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 6.93μs 17.6ns 65.9ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.36μs 23.5ns 90.9ns 0 0 0 2.9 KB
master SendAsync net472 12.4μs 8.43ns 31.5ns 0.5 0 0 3.18 KB
#7697 SendAsync net6.0 6.93μs 11.4ns 42.7ns 0 0 0 2.36 KB
#7697 SendAsync netcoreapp3.1 8.9μs 30.8ns 119ns 0 0 0 2.9 KB
#7697 SendAsync net472 12.3μs 3.99ns 13.8ns 0.488 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 43.42 KB 86.19 KB 42.78 KB 98.53%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 256.53 KB 258.62 KB 2.09 KB 0.81%

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 275.57 KB 260.77 KB -14.8 KB -5.37%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 73.73 KB 57.34 KB -16.38 KB -22.22%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 417.82 KB 278.53 KB -139.29 KB -33.34%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 44.6μs 144ns 841ns 0 0 0 43.64 KB
master StringConcatBenchmark netcoreapp3.1 50.5μs 295ns 2.49μs 0 0 0 43.42 KB
master StringConcatBenchmark net472 57.6μs 130ns 504ns 0 0 0 73.73 KB
master StringConcatAspectBenchmark net6.0 494μs 1.78μs 6.4μs 0 0 0 275.57 KB
master StringConcatAspectBenchmark netcoreapp3.1 512μs 2.35μs 8.46μs 0 0 0 256.53 KB
master StringConcatAspectBenchmark net472 407μs 2.17μs 15.8μs 0 0 0 417.82 KB
#7697 StringConcatBenchmark net6.0 43.2μs 179ns 646ns 0 0 0 43.73 KB
#7697 StringConcatBenchmark netcoreapp3.1 52.6μs 672ns 6.55μs 0 0 0 86.19 KB
#7697 StringConcatBenchmark net472 56.8μs 272ns 1.15μs 0 0 0 57.34 KB
#7697 StringConcatAspectBenchmark net6.0 480μs 1.76μs 6.33μs 0 0 0 260.77 KB
#7697 StringConcatAspectBenchmark netcoreapp3.1 513μs 1.74μs 6.96μs 0 0 0 258.62 KB
#7697 StringConcatAspectBenchmark net472 406μs 2.23μs 12.8μs 0 0 0 278.53 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.73μs 1.19ns 4.61ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.63μs 15.6ns 60.3ns 0 0 0 1.7 KB
master EnrichedLog net472 3.72μs 2.28ns 8.82ns 0.26 0 0 1.64 KB
#7697 EnrichedLog net6.0 2.66μs 13.8ns 67.7ns 0 0 0 1.7 KB
#7697 EnrichedLog netcoreapp3.1 3.53μs 13ns 50.3ns 0 0 0 1.7 KB
#7697 EnrichedLog net472 3.79μs 4.09ns 15.8ns 0.247 0 0 1.64 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 124μs 80.4ns 290ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 129μs 174ns 628ns 0 0 0 4.31 KB
master EnrichedLog net472 168μs 127ns 494ns 0 0 0 4.52 KB
#7697 EnrichedLog net6.0 126μs 633ns 2.69μs 0 0 0 4.31 KB
#7697 EnrichedLog netcoreapp3.1 127μs 94.8ns 342ns 0 0 0 4.31 KB
#7697 EnrichedLog net472 176μs 981ns 6.28μs 0 0 0 4.51 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.8μs 23.5ns 91.1ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.79μs 17.7ns 68.6ns 0 0 0 2.26 KB
master EnrichedLog net472 7.53μs 8.52ns 33ns 0.302 0 0 2.08 KB
#7697 EnrichedLog net6.0 5.16μs 22.1ns 85.5ns 0 0 0 2.26 KB
#7697 EnrichedLog netcoreapp3.1 7μs 15.7ns 60.7ns 0 0 0 2.26 KB
#7697 EnrichedLog net472 7.58μs 7.25ns 28.1ns 0.302 0 0 2.08 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.97μs 1.52ns 5.89ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.49μs 12.1ns 48.5ns 0 0 0 1.2 KB
master SendReceive net472 3.24μs 5.93ns 23ns 0.179 0 0 1.2 KB
#7697 SendReceive net6.0 1.97μs 9.72ns 40.1ns 0 0 0 1.2 KB
#7697 SendReceive netcoreapp3.1 2.66μs 12.6ns 49ns 0 0 0 1.2 KB
#7697 SendReceive net472 3.12μs 3.97ns 15.4ns 0.185 0 0 1.2 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.35μs 1.22ns 4.56ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.98μs 20.3ns 78.7ns 0 0 0 1.63 KB
master EnrichedLog net472 6.46μs 5.54ns 20.7ns 0.321 0 0 2.03 KB
#7697 EnrichedLog net6.0 4.28μs 15.9ns 61.5ns 0 0 0 1.58 KB
#7697 EnrichedLog netcoreapp3.1 5.86μs 14.7ns 56.8ns 0 0 0 1.63 KB
#7697 EnrichedLog net472 6.38μs 2.83ns 10.2ns 0.318 0 0 2.03 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 780ns 0.208ns 0.804ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 971ns 5.33ns 30.6ns 0 0 0 576 B
master StartFinishSpan net472 909ns 0.0952ns 0.356ns 0.091 0 0 578 B
master StartFinishScope net6.0 924ns 4.81ns 24.5ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.15μs 5.92ns 26.5ns 0 0 0 696 B
master StartFinishScope net472 1.1μs 0.311ns 1.21ns 0.0995 0 0 658 B
#7697 StartFinishSpan net6.0 829ns 3.9ns 14.6ns 0 0 0 576 B
#7697 StartFinishSpan netcoreapp3.1 1.01μs 5.28ns 27.4ns 0 0 0 576 B
#7697 StartFinishSpan net472 910ns 0.478ns 1.85ns 0.0911 0 0 578 B
#7697 StartFinishScope net6.0 928ns 0.406ns 1.57ns 0 0 0 696 B
#7697 StartFinishScope netcoreapp3.1 1.16μs 6.32ns 36.9ns 0 0 0 696 B
#7697 StartFinishScope net472 1.17μs 0.902ns 3.38ns 0.0997 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 1.08μs 5.26ns 21.7ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.4μs 6.19ns 22.3ns 0 0 0 696 B
master RunOnMethodBegin net472 1.45μs 1.54ns 5.95ns 0.102 0 0 658 B
#7697 RunOnMethodBegin net6.0 1.08μs 5.05ns 20.2ns 0 0 0 696 B
#7697 RunOnMethodBegin netcoreapp3.1 1.4μs 6.59ns 25.5ns 0 0 0 696 B
#7697 RunOnMethodBegin net472 1.5μs 1.15ns 4.44ns 0.104 0 0 658 B

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from c1f7943 to 56bd199 Compare October 22, 2025 17:26
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch 2 times, most recently from a70301b to caf072d Compare October 22, 2025 17:50
@anna-git anna-git changed the base branch from anna/config-inversion-configuration-analyzers-4 to master October 22, 2025 18:01
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch 2 times, most recently from 52bf0a8 to 38efd42 Compare October 22, 2025 18:27
@anna-git anna-git changed the base branch from master to anna/config-inversion-configuration-analyzers-4 October 22, 2025 18:30
@datadog-official
Copy link

datadog-official bot commented Oct 22, 2025

⚠️ Tests

⚠️ Warnings

🧪 1 Test failed

StableConfigWhenProfilingEnabled from Datadog.Profiler.IntegrationTests.SingleStepInstrumentation.SingleStepInstrumentationTest (Datadog)
The test Samples.BuggyBits is running for too long or was lost

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6f43191 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 83d9c7d to 22a4a69 Compare October 22, 2025 19:40
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 38efd42 to 77c76ec Compare October 22, 2025 19:40
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 22a4a69 to 8c8402b Compare October 22, 2025 20:12
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 77c76ec to 5959568 Compare October 22, 2025 20:12
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 8c8402b to 15b3e9b Compare October 22, 2025 21:02
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 5959568 to 0672899 Compare October 22, 2025 21:02
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 15b3e9b to 071fbd4 Compare October 22, 2025 21:25
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 0672899 to 64b591b Compare October 22, 2025 21:25
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 071fbd4 to 0a751b8 Compare October 22, 2025 21:31
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 64b591b to 4b52ac0 Compare October 22, 2025 21:31
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 0a751b8 to f5dd040 Compare October 22, 2025 22:22
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 4b52ac0 to cf4f9e4 Compare October 22, 2025 22:22
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from f5dd040 to df4a547 Compare October 22, 2025 22:48
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from cf4f9e4 to d5e1ed2 Compare October 22, 2025 22:48
anna-git added a commit that referenced this pull request Oct 28, 2025
… yaml for doc (#7548)

## Context

Part of **Configuration Inversion (Step 1)** - Stack progress:
1. **→ [#7548](#7548) -
Add GitLab step and JSON configuration file (this PR)**
2. [#7688](#7688) -
Reorganize keys, split config keys and platform keys
3. [#7698](#7698) -
Generate ConfigurationKeys with source generator
4. [#7689](#7689) -
Aliases handling and analyzers
5. [#7697](#7697) -
Replace manual ConfigurationKeys by generated ones in the whole solution



## Summary

Adds centralized configuration registry (`supported-configurations.json`
+
[supported-configurations-docs.yaml](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml:0:0-0:0))
containing ~280 configuration keys with automated GitLab CI validation.

## Changes

**Configuration Files:**
- `supported-configurations.json` - Machine-readable registry of all
configuration keys with versions, aliases, and deprecations
-
[supported-configurations-docs.yaml](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml:0:0-0:0)
- Human-readable documentation for each configuration key

**CI/CD:**
- Added `validate_supported_configurations_local_file` step to
`.gitlab-ci.yml`
- Updated `.gitlab/one-pipeline.locked.yaml` to reference validation
template

**File Structure:**
```json
{
  "supportedConfigurations": { "DD_TRACE_ENABLED": { "version": ["A"] }, ... },
  "aliases": { "DD_AGENT_HOST": ["DD_TRACE_AGENT_HOSTNAME", ...], ... },
  "deprecations": { "DD_TRACE_ANALYTICS_ENABLED": "Deprecated - ...", ... }
}
```

## Motivation

Provides single source of truth for configuration keys to enable:
- Automated documentation validation
- Cross-tracer compatibility checks
- Configuration migration tooling
- Automated doc generation

See: [Configuration Registry Design
Doc](https://docs.google.com/document/d/1VIvOyQPfuQIWBIgNY68A9hzLir0-3eJijTwmpWASO8s/edit?tab=t.0#heading=h.jy2ajbk2b8ba)

## Validation

GitLab CI validates JSON structure, naming conventions, and schema
compliance on every build.

## Commit Details

**`2639cf0` - Initial Configuration Registry**
- Added `supported-configurations.json` with ~280 configuration keys
organized by version (A/B/C)
- Includes `aliases` section mapping primary keys to
deprecated/alternative names
- Includes `deprecations` section with deprecation messages
- Added GitLab CI validation step to ensure file integrity
- Updated one-pipeline lock file to reference validation template

**`70e632e` - Configuration Documentation**
- Added
[supported-configurations-docs.yaml](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml:0:0-0:0)
with detailed XML documentation for each configuration key
- Provides human-readable descriptions, default values, and usage
examples
- Includes `<seealso>` references to relevant code classes
- Complements the machine-readable JSON with developer-friendly
documentation
- Enables automated generation of configuration documentation from a
single source
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

Nice 🎉


### 1. Add the Configuration Key Definition

Add your new configuration key to `tracer/src/Datadog.Trace/Configuration/supported-configurations.json`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Add your new configuration key to `tracer/src/Datadog.Trace/Configuration/supported-configurations.json`.
Add your new configuration key to `tracer/src/Datadog.Trace/Configuration/supported-configurations.json`, specifying an arbitrary version string (e.g. `"A"`, as shown below). and specifying the product if required.

},
"OTEL_EXPORTER_OTLP_TIMEOUT": {
"version": ["A"],
"product": "OpenTelemetry"
Copy link
Member

Choose a reason for hiding this comment

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

Can we explain:

  1. What the allowed product values are
  2. When you should use them


### 2. Add Documentation

Add XML documentation for your key in `tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml`.
Copy link
Member

Choose a reason for hiding this comment

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

It makes me wonder, why can't we include this in supportedConfigurations to keep everything together? 🤔 Having to edit multiple files to add a new config is a bit annoying


### 5. Build to Generate Code

Build the `Datadog.Trace` project to run the source generator:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Build the `Datadog.Trace` project to run the source generator:
Build the `Datadog.Trace` project to run the source generator, either using Nuke or by building the project directly from the command line or your IDE:


Generates: `ConfigurationKeys.OpenTelemetry.ExporterOtlpEndpoint`

**Common products:**
Copy link
Member

Choose a reason for hiding this comment

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

Ah, in which case we can add a link to this section in step 1 above I think

<Compile Include="..\Datadog.Trace\Configuration\ConfigurationKeys.Exporter.cs" Link="ConfigurationKeys.Exporter.cs" />
<Compile Include="..\Datadog.Trace\Configuration\DeprecationMessages.cs" Link="DeprecationMessages.cs" />
<Compile Include="..\Datadog.Trace\Configuration\ExporterSettings.Shared.cs" Link="ExporterSettings.Shared.cs" />
<!-- Link to generated ConfigurationKeys from Datadog.Trace project -->
Copy link
Member

Choose a reason for hiding this comment

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

Should we just link in all the ConfigurationKeysGenerator files 🤔 After all we included them above?

Copy link
Member

Choose a reason for hiding this comment

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

Nice documentation👍 Could/should we add a link to this document at the top of all the generated ConfigurationKeys files? Rather than mentioning the files to change in those comments, it might make sense to link to this document instead, seeing as that covers everything and means we're not duplicating the explanation? Or just include both 🙂

var enabled = source.GetBool(ConfigurationKeys.FeatureFlags.TraceId128BitGenerationEnabled);
```

## Troubleshooting
Copy link
Member

Choose a reason for hiding this comment

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

Should we mention about the analyzers in this section, and the fact that they enforce not using strings directly etc?

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 2a09875 to 279b292 Compare October 29, 2025 17:15
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from b95387d to e3ec6e4 Compare October 29, 2025 17:15
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 279b292 to 9860a88 Compare October 29, 2025 17:49
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from e3ec6e4 to 98f48d6 Compare October 29, 2025 17:49
anna-git added a commit that referenced this pull request Oct 30, 2025
… keys (#7688)

## Context

Part of **Configuration Inversion (Step 2)** - Stack progress:
1. [#7548](#7548) - Add
GitLab step and JSON configuration file
2. **→ [#7688](#7688) -
[Config registry] Reorganize keys, split config keys and platform
keys(this PR)**
3. [#7698](#7698) -
Generate ConfigurationKeys with source generator
4. [#7689](#7689) -
Aliases handling and analyzers
5. [#7697](#7697) -
Replace manual ConfigurationKeys by generated ones in the whole solution
## Summary

Separates platform-specific environment variables into `PlatformKeys`
class and adds Roslyn analyzers to enforce proper usage of configuration
keys throughout the codebase.

## Changes

**Platform Keys Separation:**
- Created `PlatformKeys` class for external platform environment
variables (AWS, Azure, GCP, Kubernetes, CLR Profiler), those that don't
start with DD_ and come from other platforms.
- Updated all references throughout codebase to use `PlatformKeys` for
platform-specific variables
- Keeps `ConfigurationKeys` focused only on Datadog configuration

**Roslyn Analyzers:**
- **DD0007**: Platform key analyzer - Enforces use of `PlatformKeys` for
external platform environment variables
- **DD0008**: ConfigurationBuilder analyzer - Enforces use of
`ConfigurationKeys` or `PlatformKeys` constants in
`ConfigurationBuilder.WithKeys()` calls
- Prevents hardcoded strings and ensures type safety

**Configuration Mapping:**
- Added `configuration_keys_mapping.json` to map environment variable
names to their `ConfigurationKeys` constant names, so that we avoid
renaming hundreds of variables according to automatically source
generated deducted ones.
- Enables preservation of original constant names during refactoring
- Supports source generator integration

**Code Updates:**
- Updated `TracerSettings`, test files, and profiler code to use
`PlatformKeys`
- Replaced manual `ConfigurationKeys` with generated version from
`supported-configurations.json`
- Added missing `DD_TRACE_LOG_PATH` to configuration registry

## Motivation

Ensures clean separation between Datadog and platform configuration by:
- Preventing accidental mixing of platform and Datadog keys
- Enforcing compile-time validation of configuration key usage
- Making it clear which keys are owned by Datadog vs external platforms
- Catching configuration errors at build time instead of runtime

## Validation

- Roslyn analyzers run on every build
- All existing tests pass with updated key references
- Analyzers report clear diagnostic messages for violations

## Related Work

This PR builds on the configuration registry foundation established in
#7548:
- **Commit `2639cf0`** added `supported-configurations.json` with ~280
keys, aliases, deprecations, and GitLab CI validation
- **Commit `70e632e`** added
[supported-configurations-docs.yaml](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml:0:0-0:0)
with XML documentation for automated doc generation
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 9860a88 to 3197af6 Compare October 30, 2025 18:03
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch 2 times, most recently from 4289adc to efb749a Compare October 30, 2025 19:39
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 3197af6 to e6d6574 Compare October 30, 2025 20:46
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from efb749a to 4a09baa Compare October 30, 2025 20:47
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from e6d6574 to dcd2f3c Compare October 31, 2025 01:39
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 4a09baa to 6d0d644 Compare October 31, 2025 01:39
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from dcd2f3c to 196d5e0 Compare October 31, 2025 21:41
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 6d0d644 to 0949fba Compare October 31, 2025 21:41
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 196d5e0 to 3d682bd Compare November 25, 2025 16:33
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 0949fba to 4f85efe Compare November 25, 2025 16:33
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 3d682bd to e99b9b3 Compare November 25, 2025 20:08
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 4f85efe to 3ea1404 Compare November 25, 2025 20:08
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from e99b9b3 to 667cda0 Compare November 25, 2025 20:35
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 3ea1404 to 9662e0f Compare November 25, 2025 20:35
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 667cda0 to 888141d Compare November 25, 2025 20:51
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 9662e0f to 6f43191 Compare November 25, 2025 20:51
anna-git added a commit that referenced this pull request Nov 26, 2025
…#7698)

## Context

Part of **Configuration Inversion (Step 3)** - Stack progress:
1. [#7548](#7548) - Add
GitLab step and JSON configuration file
2. [#7688](#7688) -
Cleanup configuration / platform keys + analyzers
3. **→ [#7698](#7698) -
Generate ConfigurationKeys with source generator (this PR)**
4. [#7689](#7689) -
Aliases handling via source generator
5. [#7697](#7697) -
Replace manual ConfigurationKeys by generated ones in the whole solution

## Summary

Adds source generator to auto-generate `ConfigurationKeys` from
`supported-configurations.json` with name mapping to preserve existing
constant names.

## Changes

**Source Generator:**
-
[ConfigurationKeysGenerator](cci:7://file:///var/folders/4j/q1f1tvc503g_thnq6p79cp500000gp/T/SourceGeneratedDocuments/D0E9C9C62821E2CB6FADE080/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator:0:0-0:0)
reads `supported-configurations.json` and
[supported-configurations-docs.yaml](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml:0:0-0:0)
- Auto-generates `ConfigurationKeys` with nested product classes
(AppSec, CIVisibility, OpenTelemetry, etc.)
- Generates XML documentation and `[Obsolete]` attributes from JSON

**Configuration Mapping:**
- `configuration_keys_mapping.json` maps env vars to original constant
names (e.g., `DD_TRACE_ENABLED` → `TraceEnabled`)
- Avoids refactoring hundreds of references across codebase

**Updates:**
- Added missing `DD_TRACE_ACTIVITY_LISTENER_ENABLED` key
- Committed temporary
[ConfigurationKeys2.g.cs](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator/ConfigurationKeys2.g.cs:0:0-0:0)
files for validation

## Motivation

Makes `supported-configurations.json` the single source of truth while
preserving existing constant names to avoid massive refactoring.

## Test Coverage

- Added `ConfigurationKeysGeneratorTests.cs` with comprehensive unit
tests
- Tests validate generator output, XML documentation generation, and
obsolete attribute application
- Tests cover nested product classes, deprecations, and YAML
documentation integration
- All existing tests pass without modification

## Related Work

Builds on #7548 (configuration registry) and #7688 (PlatformKeys
separation + analyzers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants