Skip to content

Conversation

@anna-git
Copy link
Contributor

@anna-git anna-git commented Dec 9, 2025

(This PR is actually #7697 that accidentally got closed)

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. #7931 - Replace manual ConfigurationKeys by generated ones in the whole solution (this PR)
  6. #7932 - Forbid use of System.Environment methods and adapt everywhere
  7. #7937 - Integration names to generated keys

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.

@datadog-datadog-prod-us1

This comment has been minimized.

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from d18480f to c04dbe5 Compare December 9, 2025 16:48
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 95b0301 to 39a7db5 Compare December 9, 2025 16:48
@pr-commenter
Copy link

pr-commenter bot commented Dec 9, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7931 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.275
  • 2 benchmarks have fewer allocations
  • 2 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 #7931

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 5.92 KB 6 KB 80 B 1.35%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 11.2μs 43.8ns 169ns 0 0 0 5.49 KB
master StartStopWithChild netcoreapp3.1 13.5μs 71.2ns 356ns 0 0 0 5.71 KB
master StartStopWithChild net472 22.3μs 124ns 756ns 0.97 0.323 0.108 5.92 KB
#7931 StartStopWithChild net6.0 10.7μs 58.7ns 342ns 0 0 0 5.49 KB
#7931 StartStopWithChild netcoreapp3.1 13.9μs 72.6ns 348ns 0 0 0 5.7 KB
#7931 StartStopWithChild net472 22.1μs 109ns 486ns 0.985 0.328 0.109 6 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 1.29ms 381ns 1.47μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.38ms 368ns 1.42μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.74ms 2.76μs 10.7μs 0 0 0 3.26 KB
#7931 WriteAndFlushEnrichedTraces net6.0 1.25ms 77.6ns 290ns 0 0 0 2.7 KB
#7931 WriteAndFlushEnrichedTraces netcoreapp3.1 1.4ms 109ns 407ns 0 0 0 2.7 KB
#7931 WriteAndFlushEnrichedTraces net472 1.69ms 166ns 599ns 0 0 0 3.26 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 6.11ns 41.4ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.38μs 7.72ns 48.8ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.01μs 0.769ns 2.98ns 0.191 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.41μs 33.4ns 129ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 8.87μs 47.1ns 231ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 8.36μs 13.5ns 50.7ns 0.752 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 333ns 0.197ns 0.765ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 392ns 2.13ns 12ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 309ns 0.0176ns 0.0682ns 0.0436 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.52μs 33.9ns 163ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.82μs 38.1ns 157ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.69μs 1.42ns 5.48ns 0.572 0 0 3.8 KB
#7931 AllCycleSimpleBody net6.0 1.09μs 1.08ns 4.2ns 0 0 0 1.22 KB
#7931 AllCycleSimpleBody netcoreapp3.1 1.41μs 7.88ns 53.4ns 0 0 0 1.2 KB
#7931 AllCycleSimpleBody net472 1.11μs 0.702ns 2.63ns 0.194 0 0 1.23 KB
#7931 AllCycleMoreComplexBody net6.0 7.41μs 1.59ns 5.5ns 0 0 0 4.72 KB
#7931 AllCycleMoreComplexBody netcoreapp3.1 9.09μs 42.6ns 170ns 0 0 0 4.62 KB
#7931 AllCycleMoreComplexBody net472 7.68μs 2.76ns 10.7ns 0.73 0 0 4.74 KB
#7931 ObjectExtractorSimpleBody net6.0 329ns 1.63ns 7.31ns 0 0 0 280 B
#7931 ObjectExtractorSimpleBody netcoreapp3.1 399ns 2.21ns 14ns 0 0 0 272 B
#7931 ObjectExtractorSimpleBody net472 301ns 0.0825ns 0.32ns 0.044 0 0 281 B
#7931 ObjectExtractorMoreComplexBody net6.0 6.44μs 2.38ns 9.23ns 0 0 0 3.78 KB
#7931 ObjectExtractorMoreComplexBody netcoreapp3.1 7.76μs 40.6ns 195ns 0 0 0 3.69 KB
#7931 ObjectExtractorMoreComplexBody net472 6.71μs 4.53ns 16.9ns 0.572 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 245ns 883ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.5μs 233ns 872ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 11.2ns 43.2ns 4.9 0 0 32.5 KB
master EncodeLegacyArgs net6.0 148μs 33ns 128ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 200μs 209ns 808ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 264μs 40.4ns 157ns 0 0 0 2.14 KB
#7931 EncodeArgs net6.0 78.5μs 141ns 546ns 0 0 0 32.4 KB
#7931 EncodeArgs netcoreapp3.1 98.9μs 51.6ns 193ns 0 0 0 32.4 KB
#7931 EncodeArgs net472 108μs 10.4ns 40.3ns 4.86 0 0 32.5 KB
#7931 EncodeLegacyArgs net6.0 145μs 13.2ns 49.4ns 0 0 0 2.14 KB
#7931 EncodeLegacyArgs netcoreapp3.1 201μs 201ns 778ns 0 0 0 2.14 KB
#7931 EncodeLegacyArgs net472 263μs 16.9ns 63.1ns 0 0 0 2.14 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 422μs 1.33μs 4.62μs 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 448μs 2.1μs 7.86μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 496μs 389ns 1.46μs 0 0 0 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 308μs 1.45μs 5.61μs 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 335μs 1.44μs 5.19μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 363μs 650ns 2.52μs 0 0 0 0 b
#7931 RunWafRealisticBenchmark net6.0 415μs 783ns 2.71μs 0 0 0 4.55 KB
#7931 RunWafRealisticBenchmark netcoreapp3.1 449μs 2.96μs 28.2μs 0 0 0 4.48 KB
#7931 RunWafRealisticBenchmark net472 486μs 665ns 2.58μs 0 0 0 0 b
#7931 RunWafRealisticBenchmarkWithAttack net6.0 305μs 1E+03ns 3.6μs 0 0 0 2.24 KB
#7931 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 323μs 1.47μs 6.25μs 0 0 0 2.22 KB
#7931 RunWafRealisticBenchmarkWithAttack net472 363μs 278ns 1μs 0 0 0 0 b
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 84.2μs 245ns 883ns 0 0 0 18.97 KB
master SendRequest netcoreapp3.1 96.6μs 306ns 1.78μs 0 0 0 21.18 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#7931 SendRequest net6.0 83.4μs 97.3ns 337ns 0 0 0 18.97 KB
#7931 SendRequest netcoreapp3.1 97.2μs 328ns 1.64μs 0 0 0 21.18 KB
#7931 SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 2.06ms 9.96μs 39.9μs 0 0 0 640 KB
master OriginalCharSlice netcoreapp3.1 3.91ms 1.21μs 4.53μs 0 0 0 640.05 KB
master OriginalCharSlice net472 2.78ms 961ns 3.72μs 0 0 0 638.98 KB
master OptimizedCharSlice net6.0 1.47ms 252ns 907ns 0 0 0 0 b
master OptimizedCharSlice netcoreapp3.1 2.79ms 619ns 2.23μs 0 0 0 0 b
master OptimizedCharSlice net472 2.01ms 654ns 2.45μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 1.04ms 1.82μs 7.06μs 0 0 0 0 b
master OptimizedCharSliceWithPool netcoreapp3.1 1.89ms 965ns 3.74μs 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.14ms 400ns 1.55μs 0 0 0 0 b
#7931 OriginalCharSlice net6.0 1.98ms 1.36μs 5.28μs 0 0 0 640 KB
#7931 OriginalCharSlice netcoreapp3.1 3.95ms 1.39μs 5.19μs 0 0 0 640.05 KB
#7931 OriginalCharSlice net472 2.73ms 438ns 1.64μs 0 0 0 638.98 KB
#7931 OptimizedCharSlice net6.0 1.46ms 689ns 2.58μs 0 0 0 0 b
#7931 OptimizedCharSlice netcoreapp3.1 2.84ms 1.14μs 4.41μs 0 0 0 0 b
#7931 OptimizedCharSlice net472 2.05ms 765ns 2.86μs 0 0 0 0 b
#7931 OptimizedCharSliceWithPool net6.0 1.07ms 752ns 2.81μs 0 0 0 0 b
#7931 OptimizedCharSliceWithPool netcoreapp3.1 1.9ms 768ns 2.88μs 0 0 0 0 b
#7931 OptimizedCharSliceWithPool net472 1.13ms 718ns 2.78μs 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #7931

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.275 639,927.01 815,846.63

Fewer allocations 🎉 in #7931

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 42.21 KB 41.77 KB -435 B -1.03%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 706μs 336ns 1.26μs 0 0 0 41.62 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 648μs 3.43μs 17.1μs 0 0 0 42.21 KB
master WriteAndFlushEnrichedTraces net472 860μs 3.89μs 14μs 4.46 0 0 55.89 KB
#7931 WriteAndFlushEnrichedTraces net6.0 689μs 610ns 2.28μs 0 0 0 41.78 KB
#7931 WriteAndFlushEnrichedTraces netcoreapp3.1 814μs 2.2μs 7.94μs 0 0 0 41.77 KB
#7931 WriteAndFlushEnrichedTraces net472 876μs 3.99μs 16μs 4.46 0 0 56.11 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 1.87μs 0.936ns 3.62ns 0 0 0 968 B
master ExecuteNonQuery netcoreapp3.1 2.63μs 11.9ns 46.3ns 0 0 0 960 B
master ExecuteNonQuery net472 2.7μs 2.1ns 7.87ns 0.148 0 0 931 B
#7931 ExecuteNonQuery net6.0 1.86μs 0.571ns 2.14ns 0 0 0 968 B
#7931 ExecuteNonQuery netcoreapp3.1 2.49μs 9.91ns 37.1ns 0 0 0 960 B
#7931 ExecuteNonQuery net472 2.77μs 2.03ns 7.61ns 0.138 0 0 931 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.72μs 6.92ns 26.8ns 0 0 0 952 B
master CallElasticsearch netcoreapp3.1 2.16μs 11.2ns 52.3ns 0 0 0 968 B
master CallElasticsearch net472 3.39μs 4.54ns 17.6ns 0.137 0 0 955 B
master CallElasticsearchAsync net6.0 1.73μs 0.981ns 3.67ns 0 0 0 928 B
master CallElasticsearchAsync netcoreapp3.1 2.28μs 9.88ns 38.3ns 0 0 0 1.02 KB
master CallElasticsearchAsync net472 3.48μs 3.62ns 14ns 0.156 0 0 1.01 KB
#7931 CallElasticsearch net6.0 1.69μs 1.16ns 4.49ns 0 0 0 952 B
#7931 CallElasticsearch netcoreapp3.1 2.15μs 7.78ns 30.1ns 0 0 0 968 B
#7931 CallElasticsearch net472 3.4μs 5.85ns 22.7ns 0.136 0 0 955 B
#7931 CallElasticsearchAsync net6.0 1.76μs 3.76ns 14.5ns 0 0 0 928 B
#7931 CallElasticsearchAsync netcoreapp3.1 2.33μs 9.62ns 37.3ns 0 0 0 1.02 KB
#7931 CallElasticsearchAsync net472 3.46μs 1.52ns 5.89ns 0.156 0 0 1.01 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.76μs 7.45ns 28.8ns 0 0 0 896 B
master ExecuteAsync netcoreapp3.1 2.31μs 7.47ns 28.9ns 0 0 0 896 B
master ExecuteAsync net472 2.54μs 2.95ns 11.4ns 0.126 0 0 858 B
#7931 ExecuteAsync net6.0 1.8μs 9.1ns 40.7ns 0 0 0 896 B
#7931 ExecuteAsync netcoreapp3.1 2.35μs 7.43ns 28.8ns 0 0 0 896 B
#7931 ExecuteAsync net472 2.51μs 1.3ns 5.03ns 0.126 0 0 858 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.82μs 14.8ns 57.3ns 0 0 0 2.29 KB
master SendAsync netcoreapp3.1 8.4μs 34.4ns 133ns 0 0 0 2.83 KB
master SendAsync net472 11.8μs 10.8ns 41.9ns 0.474 0 0 3.08 KB
#7931 SendAsync net6.0 6.67μs 6.19ns 24ns 0 0 0 2.29 KB
#7931 SendAsync netcoreapp3.1 8.65μs 24ns 92.8ns 0 0 0 2.83 KB
#7931 SendAsync net472 11.7μs 10.5ns 40.5ns 0.465 0 0 3.08 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7931

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 256.94 KB 259.58 KB 2.63 KB 1.02%

Fewer allocations 🎉 in #7931

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 274.72 KB 249.74 KB -24.98 KB -9.09%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 45.1μs 245ns 1.27μs 0 0 0 42.51 KB
master StringConcatBenchmark netcoreapp3.1 49μs 260ns 1.3μs 0 0 0 42.54 KB
master StringConcatBenchmark net472 57.2μs 247ns 986ns 0 0 0 49.15 KB
master StringConcatAspectBenchmark net6.0 446μs 2.06μs 7.98μs 0 0 0 256.94 KB
master StringConcatAspectBenchmark netcoreapp3.1 530μs 991ns 4.95μs 0 0 0 274.72 KB
master StringConcatAspectBenchmark net472 399μs 2.3μs 19.4μs 0 0 0 271.01 KB
#7931 StringConcatBenchmark net6.0 44.6μs 247ns 1.4μs 0 0 0 42.51 KB
#7931 StringConcatBenchmark netcoreapp3.1 50μs 252ns 1.71μs 0 0 0 42.54 KB
#7931 StringConcatBenchmark net472 56.4μs 287ns 1.25μs 0 0 0 49.15 KB
#7931 StringConcatAspectBenchmark net6.0 474μs 2.28μs 9.41μs 0 0 0 259.58 KB
#7931 StringConcatAspectBenchmark netcoreapp3.1 499μs 1.37μs 5.98μs 0 0 0 249.74 KB
#7931 StringConcatAspectBenchmark net472 406μs 2.21μs 12.5μs 0 0 0 270.34 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.68μs 12.8ns 51.1ns 0 0 0 1.69 KB
master EnrichedLog netcoreapp3.1 3.61μs 18.1ns 85ns 0 0 0 1.7 KB
master EnrichedLog net472 3.82μs 4.62ns 17.9ns 0.246 0 0 1.6 KB
#7931 EnrichedLog net6.0 2.76μs 4.43ns 17.2ns 0 0 0 1.69 KB
#7931 EnrichedLog netcoreapp3.1 3.51μs 10.7ns 38.8ns 0 0 0 1.7 KB
#7931 EnrichedLog net472 3.88μs 3.94ns 14.7ns 0.251 0 0 1.6 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 122μs 85.5ns 320ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 117ns 423ns 0 0 0 4.31 KB
master EnrichedLog net472 166μs 192ns 743ns 0 0 0 4.51 KB
#7931 EnrichedLog net6.0 122μs 111ns 416ns 0 0 0 4.31 KB
#7931 EnrichedLog netcoreapp3.1 128μs 112ns 432ns 0 0 0 4.31 KB
#7931 EnrichedLog net472 167μs 28.3ns 106ns 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 5.08μs 24.9ns 108ns 0 0 0 2.24 KB
master EnrichedLog netcoreapp3.1 6.82μs 27.1ns 105ns 0 0 0 2.26 KB
master EnrichedLog net472 7.58μs 6.43ns 24.9ns 0.301 0 0 2.05 KB
#7931 EnrichedLog net6.0 5.08μs 5.06ns 18.9ns 0 0 0 2.24 KB
#7931 EnrichedLog netcoreapp3.1 6.94μs 19ns 73.7ns 0 0 0 2.26 KB
#7931 EnrichedLog net472 7.47μs 4.11ns 15.4ns 0.299 0 0 2.05 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.96μs 2.53ns 9.46ns 0 0 0 1.12 KB
master SendReceive netcoreapp3.1 2.51μs 12.3ns 53.6ns 0 0 0 1.14 KB
master SendReceive net472 2.9μs 1.4ns 5.42ns 0.177 0 0 1.12 KB
#7931 SendReceive net6.0 1.93μs 2.16ns 8.38ns 0 0 0 1.12 KB
#7931 SendReceive netcoreapp3.1 2.6μs 5.98ns 23.2ns 0 0 0 1.14 KB
#7931 SendReceive net472 2.92μs 4.74ns 18.4ns 0.176 0 0 1.12 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.36μs 19.6ns 73.3ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.85μs 13.3ns 51.5ns 0 0 0 1.63 KB
master EnrichedLog net472 6.7μs 11.5ns 44.5ns 0.301 0 0 2.03 KB
#7931 EnrichedLog net6.0 4.45μs 4.34ns 15ns 0 0 0 1.58 KB
#7931 EnrichedLog netcoreapp3.1 5.92μs 8.02ns 30ns 0 0 0 1.63 KB
#7931 EnrichedLog net472 6.62μs 7.29ns 28.2ns 0.299 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 768ns 0.295ns 1.14ns 0 0 0 520 B
master StartFinishSpan netcoreapp3.1 953ns 5.07ns 26.3ns 0 0 0 520 B
master StartFinishSpan net472 889ns 0.15ns 0.539ns 0.0823 0 0 522 B
master StartFinishScope net6.0 897ns 4.1ns 16.4ns 0 0 0 640 B
master StartFinishScope netcoreapp3.1 1.13μs 5.44ns 21.1ns 0 0 0 640 B
master StartFinishScope net472 1.1μs 0.248ns 0.961ns 0.0935 0 0 602 B
master StartFinishTwoScopes net6.0 1.84μs 0.671ns 2.6ns 0 0 0 1.19 KB
master StartFinishTwoScopes netcoreapp3.1 2.21μs 11.1ns 49.6ns 0 0 0 1.19 KB
master StartFinishTwoScopes net472 2.14μs 0.392ns 1.52ns 0.161 0 0 1.08 KB
#7931 StartFinishSpan net6.0 774ns 0.155ns 0.578ns 0 0 0 520 B
#7931 StartFinishSpan netcoreapp3.1 957ns 4.48ns 22.8ns 0 0 0 520 B
#7931 StartFinishSpan net472 886ns 0.147ns 0.531ns 0.0799 0 0 522 B
#7931 StartFinishScope net6.0 906ns 4.67ns 20.9ns 0 0 0 640 B
#7931 StartFinishScope netcoreapp3.1 1.16μs 6.4ns 36.2ns 0 0 0 640 B
#7931 StartFinishScope net472 1.09μs 0.281ns 1.09ns 0.0934 0 0 602 B
#7931 StartFinishTwoScopes net6.0 1.82μs 9.78ns 53.6ns 0 0 0 1.19 KB
#7931 StartFinishTwoScopes netcoreapp3.1 2.28μs 11.3ns 52ns 0 0 0 1.19 KB
#7931 StartFinishTwoScopes net472 2.18μs 0.434ns 1.68ns 0.164 0 0 1.08 KB
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.05μs 0.41ns 1.53ns 0 0 0 640 B
master RunOnMethodBegin netcoreapp3.1 1.36μs 6.81ns 31.2ns 0 0 0 640 B
master RunOnMethodBegin net472 1.47μs 0.812ns 3.04ns 0.0885 0 0 602 B
#7931 RunOnMethodBegin net6.0 1.05μs 4.9ns 19.6ns 0 0 0 640 B
#7931 RunOnMethodBegin netcoreapp3.1 1.31μs 7ns 35ns 0 0 0 640 B
#7931 RunOnMethodBegin net472 1.4μs 0.463ns 1.79ns 0.091 0 0 602 B

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from c04dbe5 to 400c48a Compare December 9, 2025 21:04
@anna-git anna-git requested a review from a team as a code owner December 9, 2025 21:04
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 39a7db5 to 7b7e9bf Compare December 9, 2025 21:04
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Dec 9, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7931) 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
duration74.72 ± (74.84 - 75.55) ms76.33 ± (76.04 - 76.89) ms+2.2%✅⬆️
.NET Framework 4.8 - Bailout
duration78.59 ± (78.58 - 79.22) ms79.39 ± (79.11 - 79.85) ms+1.0%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1057.65 ± (1060.61 - 1067.66) ms1078.97 ± (1080.42 - 1090.94) ms+2.0%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.78 ± (22.70 - 22.85) ms23.03 ± (22.95 - 23.12) ms+1.1%✅⬆️
process.time_to_main_ms85.84 ± (85.53 - 86.14) ms87.16 ± (86.75 - 87.57) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.91 - 10.91) MB10.92 ± (10.91 - 10.92) MB+0.1%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.89 ± (22.83 - 22.96) ms22.76 ± (22.70 - 22.82) ms-0.6%
process.time_to_main_ms88.27 ± (87.92 - 88.62) ms87.14 ± (86.79 - 87.50) ms-1.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.96 - 10.96) MB10.96 ± (10.96 - 10.96) MB+0.0%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms222.25 ± (220.86 - 223.65) ms222.12 ± (220.77 - 223.47) ms-0.1%
process.time_to_main_ms502.83 ± (501.75 - 503.91) ms504.81 ± (503.37 - 506.24) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.03 ± (48.01 - 48.06) MB48.06 ± (48.04 - 48.07) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.3%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.51 ± (21.45 - 21.56) ms21.64 ± (21.57 - 21.71) ms+0.6%✅⬆️
process.time_to_main_ms74.51 ± (74.21 - 74.80) ms74.97 ± (74.64 - 75.30) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.62 ± (10.62 - 10.62) MB10.63 ± (10.63 - 10.63) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.37 ± (21.32 - 21.43) ms21.68 ± (21.62 - 21.74) ms+1.4%✅⬆️
process.time_to_main_ms75.87 ± (75.57 - 76.18) ms77.27 ± (76.93 - 77.61) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.68 ± (10.67 - 10.68) MB10.67 ± (10.67 - 10.67) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms209.70 ± (208.61 - 210.79) ms210.44 ± (209.19 - 211.69) ms+0.4%✅⬆️
process.time_to_main_ms465.91 ± (464.89 - 466.94) ms469.27 ± (468.17 - 470.36) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.29 ± (48.27 - 48.32) MB48.27 ± (48.25 - 48.30) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.62 ± (19.55 - 19.68) ms19.92 ± (19.84 - 19.99) ms+1.5%✅⬆️
process.time_to_main_ms73.67 ± (73.35 - 73.98) ms74.90 ± (74.59 - 75.21) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.68 ± (7.67 - 7.68) MB7.68 ± (7.67 - 7.68) MB-0.0%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.67 ± (19.61 - 19.74) ms19.76 ± (19.70 - 19.83) ms+0.4%✅⬆️
process.time_to_main_ms75.30 ± (74.99 - 75.60) ms75.70 ± (75.34 - 76.06) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.73 ± (7.72 - 7.74) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms190.77 ± (189.81 - 191.73) ms191.25 ± (190.22 - 192.27) ms+0.2%✅⬆️
process.time_to_main_ms447.20 ± (446.43 - 447.98) ms453.12 ± (451.94 - 454.30) ms+1.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.43 ± (36.39 - 36.46) MB36.52 ± (36.48 - 36.55) MB+0.2%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration194.72 ± (194.83 - 195.80) ms195.33 ± (195.39 - 196.29) ms+0.3%✅⬆️
.NET Framework 4.8 - Bailout
duration199.07 ± (199.00 - 199.87) ms197.79 ± (197.73 - 198.68) ms-0.6%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1124.26 ± (1128.02 - 1138.07) ms1122.47 ± (1123.41 - 1131.01) ms-0.2%
.NET Core 3.1 - Baseline
process.internal_duration_ms189.79 ± (189.36 - 190.23) ms190.01 ± (189.55 - 190.47) ms+0.1%✅⬆️
process.time_to_main_ms81.40 ± (81.18 - 81.61) ms81.14 ± (80.89 - 81.39) ms-0.3%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.11 ± (16.09 - 16.14) MB16.11 ± (16.08 - 16.14) MB+0.0%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.4%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms190.10 ± (189.66 - 190.54) ms189.64 ± (189.20 - 190.08) ms-0.2%
process.time_to_main_ms82.83 ± (82.65 - 83.01) ms82.62 ± (82.44 - 82.81) ms-0.2%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.14 ± (16.12 - 16.17) MB16.23 ± (16.21 - 16.25) MB+0.5%✅⬆️
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (20 - 21)-0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms400.64 ± (397.80 - 403.49) ms397.98 ± (395.48 - 400.49) ms-0.7%
process.time_to_main_ms477.07 ± (476.31 - 477.83) ms480.83 ± (480.18 - 481.49) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.84 ± (58.70 - 58.99) MB58.80 ± (58.68 - 58.92) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 30)+0.1%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms194.72 ± (194.27 - 195.16) ms195.00 ± (194.52 - 195.47) ms+0.1%✅⬆️
process.time_to_main_ms70.47 ± (70.26 - 70.69) ms70.66 ± (70.46 - 70.85) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.36 ± (16.33 - 16.39) MB16.35 ± (16.32 - 16.38) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.6%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms193.53 ± (193.02 - 194.03) ms193.81 ± (193.32 - 194.31) ms+0.1%✅⬆️
process.time_to_main_ms71.41 ± (71.24 - 71.57) ms71.44 ± (71.26 - 71.61) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.25 ± (16.13 - 16.36) MB16.39 ± (16.37 - 16.42) MB+0.9%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 20)20 ± (20 - 20)+3.0%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms415.62 ± (413.17 - 418.07) ms410.65 ± (408.50 - 412.80) ms-1.2%
process.time_to_main_ms447.96 ± (447.30 - 448.61) ms448.50 ± (447.81 - 449.20) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed59.32 ± (59.22 - 59.43) MB59.14 ± (59.01 - 59.27) MB-0.3%
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (29 - 30)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms192.63 ± (192.22 - 193.04) ms192.02 ± (191.57 - 192.47) ms-0.3%
process.time_to_main_ms70.43 ± (70.19 - 70.66) ms69.87 ± (69.68 - 70.05) ms-0.8%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.67 ± (11.65 - 11.69) MB11.68 ± (11.65 - 11.70) MB+0.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.1%
.NET 8 - Bailout
process.internal_duration_ms190.95 ± (190.57 - 191.33) ms191.40 ± (190.99 - 191.82) ms+0.2%✅⬆️
process.time_to_main_ms70.64 ± (70.47 - 70.80) ms70.91 ± (70.74 - 71.08) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.72 ± (11.70 - 11.74) MB11.72 ± (11.69 - 11.74) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.2%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms369.15 ± (367.76 - 370.54) ms368.01 ± (366.80 - 369.23) ms-0.3%
process.time_to_main_ms433.08 ± (432.29 - 433.88) ms434.05 ± (433.34 - 434.77) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.97 ± (47.94 - 48.00) MB48.05 ± (48.02 - 48.07) MB+0.2%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.6%✅⬆️
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 (7931) - mean (76ms)  : 70, 83
    master - mean (75ms)  : 70, 80

    section Bailout
    This PR (7931) - mean (79ms)  : 74, 85
    master - mean (79ms)  : 74, 84

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (1,086ms)  : 1009, 1163
    master - mean (1,064ms)  : 1014, 1114

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 (7931) - mean (118ms)  : 110, 126
    master - mean (116ms)  : 110, 122

    section Bailout
    This PR (7931) - mean (117ms)  : 109, 125
    master - mean (119ms)  : 112, 125

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (768ms)  : 731, 806
    master - mean (760ms)  : 722, 799

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7931) - mean (103ms)  : 97, 110
    master - mean (103ms)  : 97, 109

    section Bailout
    This PR (7931) - mean (106ms)  : 100, 113
    master - mean (104ms)  : 98, 110

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (709ms)  : 674, 743
    master - mean (702ms)  : 675, 729

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7931) - mean (103ms)  : 97, 109
    master - mean (101ms)  : 94, 109

    section Bailout
    This PR (7931) - mean (104ms)  : 97, 110
    master - mean (103ms)  : 98, 109

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (679ms)  : 640, 719
    master - mean (666ms)  : 643, 689

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 (7931) - mean (196ms)  : 190, 202
    master - mean (195ms)  : 189, 201

    section Bailout
    This PR (7931) - mean (198ms)  : 194, 203
    master - mean (199ms)  : 195, 204

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (1,127ms)  : 1072, 1182
    master - mean (1,133ms)  : 1058, 1208

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 (7931) - mean (280ms)  : 274, 285
    master - mean (279ms)  : 272, 286

    section Bailout
    This PR (7931) - mean (281ms)  : 272, 289
    master - mean (281ms)  : 273, 290

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (915ms)  : 874, 956
    master - mean (916ms)  : 868, 965

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7931) - mean (274ms)  : 267, 281
    master - mean (274ms)  : 265, 282

    section Bailout
    This PR (7931) - mean (274ms)  : 266, 282
    master - mean (273ms)  : 267, 279

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (892ms)  : 851, 933
    master - mean (898ms)  : 853, 943

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7931) - mean (272ms)  : 265, 279
    master - mean (273ms)  : 266, 280

    section Bailout
    This PR (7931) - mean (272ms)  : 265, 279
    master - mean (271ms)  : 266, 276

    section CallTarget+Inlining+NGEN
    This PR (7931) - mean (833ms)  : 808, 858
    master - mean (833ms)  : 811, 855

Loading

anna-git added a commit that referenced this pull request Dec 9, 2025
…any string key (#7689)

## Context

Part of **Configuration Inversion (Step 4)** - Stack progress:
1. [#7548](#7548) - Add
GitLab step and JSON configuration file
2. [#7688](#7688) -
Cleanup configuration / platform keys + analyzers
3. [#7698](#7698) -
Source generator for ConfigurationKeys
4. **→ [#7689](#7689) -
Aliases handling and analyzers (this PR)**
5. [#7931](#7931) -
Replace manual ConfigurationKeys with generated version
6. #[7932](#7932 Forbid
use of System.Environment methods and adapt everywhere

## Summary

Adds source generator for configuration key aliases, integrates alias
resolution into `ConfigurationBuilder`, and adds Roslyn analyzers to
enforce proper configuration key usage.

## Changes

**Alias Source Generator:**
- `ConfigKeyAliasesSwitcherGenerator` reads aliases from
`supported-configurations.json`
- Auto-generates switch statements to resolve primary keys from aliases
- Generated for all target frameworks (net461, netstandard2.0,
netcoreapp3.1, net6.0)

**ConfigurationBuilder Improvements:**
- Integrated alias resolution directly into
`ConfigurationBuilder.WithKeys()`
- Removed manual fallback overloads throughout codebase
- Added `GetKeyWithAlias()` method to `IConfigurationSource` interface

**IntegrationSettings Special Handling:**
- Updated to use pattern-based key construction (e.g.,
`DD_TRACE_{INTEGRATION}_ENABLED`)
- Simplified configuration reading by leveraging alias system

**Roslyn Analyzers:**
- **DD0007**: `PlatformKeysAnalyzer` - Enforces use of `PlatformKeys`
for external platform environment variables
- **DD0008**: `ConfigurationBuilderWithKeysAnalyzer` - Enforces use of
[ConfigurationKeys](cci:2://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/ConfigurationKeys.Logging.cs:9:0-58:1)/`PlatformKeys`
constants in `ConfigurationBuilder.WithKeys()` calls

**Special Cases:**
- Fixed `DatadogLoggingFactory` to handle deprecated `DD_TRACE_LOG_PATH`
with proper analyzer suppression
- Updated configuration tests to work with alias resolution

## Motivation

Completes configuration inversion by:
- Auto-generating alias resolution from `supported-configurations.json`
- Eliminating manual fallback chains
- Enforcing compile-time validation of configuration keys
- Preventing hardcoded strings and typos

## Test Coverage

- Added `ConfigKeyAliasesSwitcherGeneratorTests` with comprehensive test
coverage
- Added `PlatformKeysAnalyzerTests` with 146 lines of tests
- Added `ConfigurationBuilderWithKeysAnalyzerTests` with 538 lines of
tests
- Updated existing configuration tests for alias support
- All tests pass with new alias system

## Related Work

Builds on #7548 (configuration registry), #7688 (PlatformKeys
separation), and #7698 (source generator for ConfigurationKeys).
Base automatically changed from anna/config-inversion-configuration-analyzers-4 to master December 9, 2025 22:23
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 7b7e9bf to 8ba62d5 Compare December 10, 2025 11:44
@anna-git anna-git changed the title [Config Registry] 5/6 Replace manual ConfigurationKeys by generated ones in the whole solution [Config Registry] 5/7 Replace manual ConfigurationKeys by generated ones in the whole solution Dec 10, 2025
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.

🙈 assuming it's like the one that got accidentally merged 😄

@anna-git anna-git merged commit 7d52b22 into master Dec 10, 2025
155 of 159 checks passed
@anna-git anna-git deleted the anna/config-inversion-use-generate-config-keys-5 branch December 10, 2025 14:56
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 10, 2025
anna-git added a commit that referenced this pull request Dec 10, 2025
…ersion (#7944)

## Summary of changes

Due to this
[Rider](https://youtrack.jetbrains.com/projects/RIDER/issues/RIDER-132634/Source-Generated-files-missing-when-using-System.Text.Json)
issue , the IDE doesn't index source generated files using the last
version of the package properly which considerably degrades the dev
experience. And following the merge [of this
PR](#7931), we now have
the issue:
<img width="2148" height="980" alt="image"
src="https://github.com/user-attachments/assets/5c113a18-9126-4a57-9cda-eb1168a41876"
/>

It still builds but Rider doesn't see the generated sources and
generates errors and doesn't autocompletes or index anything.

## Reason for change

Downgrade the package version to fix the dev experience.

## Implementation details

## Test coverage

## Other details
<!-- Fixes #{issue} -->


<!--  ⚠️ Note:

Where possible, please obtain 2 approvals prior to merging. Unless
CODEOWNERS specifies otherwise, for external teams it is typically best
to have one review from a team member, and one review from apm-dotnet.
Trivial changes do not require 2 reviews.

MergeQueue is NOT enabled in this repository. If you have write access
to the repo, the PR has 1-2 approvals (see above), and all of the
required checks have passed, you can use the Squash and Merge button to
merge the PR. If you don't have write access, or you need help, reach
out in the #apm-dotnet channel in Slack.
-->
anna-git added a commit that referenced this pull request Jan 20, 2026
…apt everywhere (#7932)

## Context

Part of **Configuration Inversion (Step 6)** - Stack progress:
1. [#7548](#7548) - Add
GitLab step and JSON configuration file
2. [#7688](#7688) -
Cleanup configuration / platform keys + source generator
3. [#7698](#7698) -
Aliases handling via source generator
4. [#7689](#7689) -
Analyzers for platform and ConfigurationBuilder
5. [#7931](#7931) -
Replace manual ConfigurationKeys by generated ones in the whole solution
6. **→ [#7932](#7932) -
Forbid use of System.Environment methods and adapt everywhere (this
PR)**
7. [#7937](#7937) -
Integration names to generated keys

I'll update the PR summary to mention the YAML documentation file:

## Summary of changes

Banned direct `System.Environment.GetEnvironmentVariable()` usage and
migrated all environment variable access to use `EnvironmentHelpers`
with strongly-typed
[ConfigurationKeys](cci:2://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator/ConfigurationKeys.g.cs:15:0-737:1)
and `PlatformKeys` constants.

### Key changes:
- **Banned `System.Environment.GetEnvironmentVariable()`** via
`BannedApiAnalyzers`
- **Added `EnvironmentGetEnvironmentVariableAnalyzer` (DD0009)** to
enforce
[ConfigurationKeys](cci:2://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator/ConfigurationKeys.g.cs:15:0-737:1)/`PlatformKeys`
usage only
- **Nested `PlatformKeys` by category** (Ci, Aws, AzureAppService,
ServiceFabric, DotNet)
- **Migrated ~50+ files** across CI Visibility, AWS Lambda, AppSec,
Telemetry, Profiler, and Agent components
- **Added missing keys** to
[supported-configurations.json](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations.json:0:0-0:0)
and their documentation to
[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)

## Reason for change

Direct `System.Environment.GetEnvironmentVariable()` calls with string
literals are error-prone. Centralizing through `EnvironmentHelpers` with
strongly-typed constants provides compile-time validation,
discoverability, and refactoring safety.

## Implementation details

1. **Banned API enforcement** - Added `BannedSymbols.txt` and configured
`.editorconfig` to treat RS0030 as error (vendored code excluded)
2. **Custom analyzer** - DD0009 validates all `EnvironmentHelpers` calls
accept only
[ConfigurationKeys](cci:2://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator/ConfigurationKeys.g.cs:15:0-737:1)/`PlatformKeys`
constants, rejecting hardcoded strings
3. **PlatformKeys organization** - Nested by category for better
discoverability
4. **EnvironmentHelpers refactoring** - Added overloads for nested class
constants, maintained backward compatibility
5. **Configuration documentation** - Added missing configuration keys to
[supported-configurations.json](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations.json:0:0-0:0)
and comprehensive XML documentation to
[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),
which the source generator uses to generate XML doc comments in
[ConfigurationKeys](cci:2://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator/ConfigurationKeys.g.cs:15:0-737:1)
classes

## Test coverage

- ✅ Comprehensive analyzer tests covering valid/invalid scenarios
- ✅ All existing unit tests pass
- ✅ Banned API analyzer correctly flags direct `System.Environment`
usage

## Other details

+2,600/-940 lines. No breaking changes, negligible performance impact.
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.

5 participants