Skip to content

Conversation

@anna-git
Copy link
Contributor

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

Context

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

  1. #7548 - Add GitLab step and JSON configuration file
  2. #7688 - Cleanup configuration / platform keys + analyzers
  3. #7698 - Source generator for ConfigurationKeys
  4. #7689 - Aliases handling and analyzers (this PR)
  5. #7697 - Replace manual ConfigurationKeys with generated version

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/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).

@anna-git anna-git marked this pull request as ready for review October 21, 2025 16:24
@anna-git anna-git requested review from a team as code owners October 21, 2025 16:24
@anna-git anna-git requested a review from link04 October 21, 2025 16:24
@anna-git anna-git changed the base branch from master to anna/config-inversion-configuration-aliases-switch-3 October 21, 2025 16:25
@anna-git anna-git marked this pull request as draft October 21, 2025 16:25
@anna-git anna-git changed the title anna/config-inversion-configuration-analyzers-4 [Config registry] Analyzers for ConfigurationBuilder, ConfigurationKeys, PlatformKeys Oct 21, 2025
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from be32003 to c983088 Compare October 21, 2025 16:41
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from acaf6cf to c1f7943 Compare October 21, 2025 16:42
@pr-commenter
Copy link

pr-commenter bot commented Oct 21, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7689 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.275
  • 4 benchmarks have fewer allocations
  • 1 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 ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.9μs 60.1ns 345ns 0 0 0 5.5 KB
master StartStopWithChild netcoreapp3.1 13.3μs 64ns 271ns 0 0 0 5.71 KB
master StartStopWithChild net472 22.6μs 113ns 490ns 0.901 0.113 0 6 KB
#7689 StartStopWithChild net6.0 10.3μs 53.3ns 272ns 0 0 0 5.51 KB
#7689 StartStopWithChild netcoreapp3.1 14μs 61.3ns 238ns 0 0 0 5.71 KB
#7689 StartStopWithChild net472 22.4μs 122ns 741ns 0.933 0.207 0 5.98 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7689

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.39 KB 3.26 KB -128 B -3.77%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 1.27ms 129ns 464ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.4ms 3.16μs 12.2μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.73ms 1.22μs 4.74μs 0 0 0 3.39 KB
#7689 WriteAndFlushEnrichedTraces net6.0 1.27ms 238ns 857ns 0 0 0 2.7 KB
#7689 WriteAndFlushEnrichedTraces netcoreapp3.1 1.4ms 521ns 2.02μs 0 0 0 2.7 KB
#7689 WriteAndFlushEnrichedTraces net472 1.68ms 163ns 633ns 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.09μs 5.85ns 33.6ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.39μs 7.92ns 58.2ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.05μs 0.31ns 1.2ns 0.19 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.28μs 33.1ns 128ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 9.07μs 39.3ns 152ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.7μs 4.18ns 16.2ns 0.73 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 328ns 1.64ns 6.98ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 397ns 2.16ns 12.8ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 300ns 0.0223ns 0.0863ns 0.0438 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.26μs 7.67ns 29.7ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.87μs 40.8ns 192ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.77μs 1.04ns 4.02ns 0.576 0 0 3.8 KB
#7689 AllCycleSimpleBody net6.0 1.1μs 6.25ns 47.2ns 0 0 0 1.22 KB
#7689 AllCycleSimpleBody netcoreapp3.1 1.42μs 7.77ns 47.3ns 0 0 0 1.2 KB
#7689 AllCycleSimpleBody net472 1.08μs 1.52ns 5.89ns 0.19 0 0 1.23 KB
#7689 AllCycleMoreComplexBody net6.0 7.31μs 8.19ns 31.7ns 0 0 0 4.72 KB
#7689 AllCycleMoreComplexBody netcoreapp3.1 9.02μs 34.7ns 130ns 0 0 0 4.62 KB
#7689 AllCycleMoreComplexBody net472 7.63μs 2.31ns 8.66ns 0.727 0 0 4.74 KB
#7689 ObjectExtractorSimpleBody net6.0 335ns 1.63ns 6.72ns 0 0 0 280 B
#7689 ObjectExtractorSimpleBody netcoreapp3.1 396ns 1.86ns 7.65ns 0 0 0 272 B
#7689 ObjectExtractorSimpleBody net472 311ns 0.0604ns 0.234ns 0.0438 0 0 281 B
#7689 ObjectExtractorMoreComplexBody net6.0 6.33μs 31.2ns 132ns 0 0 0 3.78 KB
#7689 ObjectExtractorMoreComplexBody netcoreapp3.1 7.9μs 29.9ns 116ns 0 0 0 3.69 KB
#7689 ObjectExtractorMoreComplexBody net472 6.77μs 7.22ns 28ns 0.575 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 166ns 643ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 99.5μs 120ns 449ns 0 0 0 32.4 KB
master EncodeArgs net472 108μs 16.7ns 64.5ns 4.88 0 0 32.5 KB
master EncodeLegacyArgs net6.0 144μs 70.9ns 265ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 197μs 87.9ns 329ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 20.3ns 78.5ns 0 0 0 2.14 KB
#7689 EncodeArgs net6.0 76.1μs 374ns 1.4μs 0 0 0 32.4 KB
#7689 EncodeArgs netcoreapp3.1 98.8μs 287ns 1.11μs 0 0 0 32.4 KB
#7689 EncodeArgs net472 110μs 66.5ns 258ns 4.93 0 0 32.5 KB
#7689 EncodeLegacyArgs net6.0 149μs 79.3ns 307ns 0 0 0 2.14 KB
#7689 EncodeLegacyArgs netcoreapp3.1 197μs 79.3ns 307ns 0 0 0 2.14 KB
#7689 EncodeLegacyArgs net472 262μs 26.3ns 102ns 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 426μs 782ns 2.93μs 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 490μs 5.79μs 52.8μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 498μs 845ns 3.16μs 0 0 0 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 310μs 1.45μs 5.62μs 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 372μs 3.87μs 37.7μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 372μs 216ns 779ns 0 0 0 0 b
#7689 RunWafRealisticBenchmark net6.0 429μs 797ns 2.88μs 0 0 0 4.55 KB
#7689 RunWafRealisticBenchmark netcoreapp3.1 456μs 2.07μs 11.9μs 0 0 0 4.48 KB
#7689 RunWafRealisticBenchmark net472 499μs 468ns 1.69μs 0 0 0 0 b
#7689 RunWafRealisticBenchmarkWithAttack net6.0 326μs 1.17μs 4.22μs 0 0 0 2.24 KB
#7689 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 338μs 1.2μs 4.15μs 0 0 0 2.22 KB
#7689 RunWafRealisticBenchmarkWithAttack net472 369μs 902ns 3.49μs 0 0 0 0 b
Benchmarks.Trace.AspNetCoreBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 84.3μs 71.4ns 258ns 0 0 0 19.03 KB
master SendRequest netcoreapp3.1 97.9μs 478ns 3.67μs 0 0 0 21.25 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#7689 SendRequest net6.0 84.4μs 315ns 1.84μs 0 0 0 19.04 KB
#7689 SendRequest netcoreapp3.1 97.4μs 351ns 1.86μs 0 0 0 21.25 KB
#7689 SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7689

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 1.563 2,811,800.00 1,799,300.00

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.94ms 1.33μs 5.14μs 0 0 0 640 KB
master OriginalCharSlice netcoreapp3.1 3.91ms 816ns 3.16μs 0 0 0 640.05 KB
master OriginalCharSlice net472 2.68ms 772ns 2.99μs 0 0 0 638.98 KB
master OptimizedCharSlice net6.0 1.5ms 545ns 1.89μs 0 0 0 0 b
master OptimizedCharSlice netcoreapp3.1 2.81ms 798ns 2.99μs 0 0 0 0 b
master OptimizedCharSlice net472 1.93ms 754ns 2.92μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 1.07ms 227ns 788ns 0 0 0 0 b
master OptimizedCharSliceWithPool netcoreapp3.1 1.86ms 2.14μs 8.29μs 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.13ms 402ns 1.51μs 0 0 0 0 b
#7689 OriginalCharSlice net6.0 2.12ms 1.27μs 4.93μs 0 0 0 640 KB
#7689 OriginalCharSlice netcoreapp3.1 3.95ms 1.67μs 6.26μs 0 0 0 640.05 KB
#7689 OriginalCharSlice net472 2.68ms 494ns 1.78μs 0 0 0 638.98 KB
#7689 OptimizedCharSlice net6.0 1.45ms 396ns 1.43μs 0 0 0 0 b
#7689 OptimizedCharSlice netcoreapp3.1 1.8ms 4.4μs 28.8μs 0 0 0 0 b
#7689 OptimizedCharSlice net472 1.95ms 700ns 2.71μs 0 0 0 0 b
#7689 OptimizedCharSliceWithPool net6.0 1.06ms 2.17μs 8.41μs 0 0 0 0 b
#7689 OptimizedCharSliceWithPool netcoreapp3.1 1.91ms 2.32μs 8.99μs 0 0 0 0 b
#7689 OptimizedCharSliceWithPool net472 1.15ms 494ns 1.85μs 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7689

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.164 787,737.05 677,002.01

More allocations ⚠️ in #7689

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 55.71 KB 56.18 KB 478 B 0.86%

Fewer allocations 🎉 in #7689

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 42.48 KB 41.67 KB -807 B -1.90%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 704μs 3.36μs 15μs 0 0 0 42.48 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 768μs 4.74μs 46.2μs 0 0 0 42.05 KB
master WriteAndFlushEnrichedTraces net472 873μs 1.94μs 7μs 8.33 4.17 0 55.71 KB
#7689 WriteAndFlushEnrichedTraces net6.0 637μs 845ns 3.16μs 0 0 0 41.67 KB
#7689 WriteAndFlushEnrichedTraces netcoreapp3.1 676μs 1.52μs 5.69μs 0 0 0 41.9 KB
#7689 WriteAndFlushEnrichedTraces net472 856μs 3.52μs 16.5μs 8.33 4.17 0 56.18 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.99μs 10.1ns 48.5ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.79μs 12.8ns 51.1ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.72μs 1.61ns 5.81ns 0.149 0 0 987 B
#7689 ExecuteNonQuery net6.0 1.95μs 1.72ns 6.43ns 0 0 0 1.02 KB
#7689 ExecuteNonQuery netcoreapp3.1 2.58μs 7.72ns 29.9ns 0 0 0 1.02 KB
#7689 ExecuteNonQuery net472 2.78μs 2.45ns 9.48ns 0.153 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.69μs 8.66ns 41.5ns 0 0 0 1.01 KB
master CallElasticsearch netcoreapp3.1 2.36μs 6.77ns 26.2ns 0 0 0 1.02 KB
master CallElasticsearch net472 3.3μs 5.6ns 21.7ns 0.148 0 0 1.01 KB
master CallElasticsearchAsync net6.0 1.73μs 1.26ns 4.86ns 0 0 0 984 B
master CallElasticsearchAsync netcoreapp3.1 2.49μs 7.99ns 31ns 0 0 0 1.07 KB
master CallElasticsearchAsync net472 3.6μs 2.19ns 7.9ns 0.162 0 0 1.07 KB
#7689 CallElasticsearch net6.0 1.8μs 3.97ns 15.4ns 0 0 0 1.01 KB
#7689 CallElasticsearch netcoreapp3.1 2.19μs 2.97ns 11.5ns 0 0 0 1.02 KB
#7689 CallElasticsearch net472 3.46μs 2.82ns 10.5ns 0.155 0 0 1.01 KB
#7689 CallElasticsearchAsync net6.0 1.87μs 1.02ns 3.97ns 0 0 0 984 B
#7689 CallElasticsearchAsync netcoreapp3.1 2.56μs 9.38ns 36.3ns 0 0 0 1.07 KB
#7689 CallElasticsearchAsync net472 3.64μs 1.97ns 7.36ns 0.163 0 0 1.07 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.85μs 8.87ns 36.6ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.45μs 8.82ns 34.2ns 0 0 0 952 B
master ExecuteAsync net472 2.67μs 0.607ns 2.27ns 0.133 0 0 915 B
#7689 ExecuteAsync net6.0 1.94μs 4.7ns 18.2ns 0 0 0 952 B
#7689 ExecuteAsync netcoreapp3.1 2.42μs 2.17ns 8.41ns 0 0 0 952 B
#7689 ExecuteAsync net472 2.72μs 2.46ns 9.54ns 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 7.26μs 7.62ns 28.5ns 0 0 0 2.34 KB
master SendAsync netcoreapp3.1 8.24μs 21.4ns 83.1ns 0 0 0 2.89 KB
master SendAsync net472 12.3μs 10.3ns 40ns 0.489 0 0 3.14 KB
#7689 SendAsync net6.0 7.24μs 15.4ns 57.5ns 0 0 0 2.34 KB
#7689 SendAsync netcoreapp3.1 8.84μs 21.3ns 82.7ns 0 0 0 2.89 KB
#7689 SendAsync net472 12μs 8.2ns 29.5ns 0.478 0 0 3.14 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 Fewer allocations 🎉

Faster 🎉 in #7689

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 1.141 506,700.00 444,000.00

Fewer allocations 🎉 in #7689

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 273.73 KB 246.46 KB -27.27 KB -9.96%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 275.78 KB 246.29 KB -29.49 KB -10.69%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 44.2μs 242ns 1.28μs 0 0 0 42.51 KB
master StringConcatBenchmark netcoreapp3.1 49.9μs 335ns 3.13μs 0 0 0 42.54 KB
master StringConcatBenchmark net472 57μs 267ns 1.07μs 0 0 0 49.15 KB
master StringConcatAspectBenchmark net6.0 510μs 1.92μs 9.42μs 0 0 0 273.73 KB
master StringConcatAspectBenchmark netcoreapp3.1 469μs 5.64μs 55.8μs 0 0 0 275.78 KB
master StringConcatAspectBenchmark net472 406μs 2.18μs 18.9μs 0 0 0 270.34 KB
#7689 StringConcatBenchmark net6.0 45.1μs 239ns 1.99μs 0 0 0 42.51 KB
#7689 StringConcatBenchmark netcoreapp3.1 49.7μs 276ns 1.56μs 0 0 0 42.54 KB
#7689 StringConcatBenchmark net472 57.5μs 233ns 903ns 0 0 0 49.15 KB
#7689 StringConcatAspectBenchmark net6.0 446μs 1.27μs 6.35μs 0 0 0 246.46 KB
#7689 StringConcatAspectBenchmark netcoreapp3.1 476μs 2.37μs 10.1μs 0 0 0 246.29 KB
#7689 StringConcatAspectBenchmark net472 402μs 2.11μs 10.1μ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.69μs 13.2ns 54.6ns 0 0 0 1.69 KB
master EnrichedLog netcoreapp3.1 3.53μs 16.1ns 62.3ns 0 0 0 1.7 KB
master EnrichedLog net472 3.76μs 4.8ns 18.6ns 0.244 0 0 1.6 KB
#7689 EnrichedLog net6.0 2.8μs 14.2ns 63.6ns 0 0 0 1.69 KB
#7689 EnrichedLog netcoreapp3.1 3.58μs 16.5ns 63.7ns 0 0 0 1.7 KB
#7689 EnrichedLog net472 3.87μs 2.83ns 10.9ns 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 124μs 42ns 157ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 128μs 34.8ns 126ns 0 0 0 4.31 KB
master EnrichedLog net472 169μs 462ns 1.79μs 0 0 0 4.51 KB
#7689 EnrichedLog net6.0 125μs 98.8ns 383ns 0 0 0 4.31 KB
#7689 EnrichedLog netcoreapp3.1 129μs 562ns 2.1μs 0 0 0 4.31 KB
#7689 EnrichedLog net472 178μs 622ns 2.41μ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 5.04μs 6.63ns 25.7ns 0 0 0 2.24 KB
master EnrichedLog netcoreapp3.1 6.87μs 3.7ns 13.8ns 0 0 0 2.26 KB
master EnrichedLog net472 7.59μs 6.82ns 26.4ns 0.303 0 0 2.05 KB
#7689 EnrichedLog net6.0 5.13μs 12ns 46.6ns 0 0 0 2.24 KB
#7689 EnrichedLog netcoreapp3.1 6.68μs 18.2ns 70.4ns 0 0 0 2.26 KB
#7689 EnrichedLog net472 7.58μs 5.41ns 20.9ns 0.303 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.92μs 1.85ns 7.18ns 0 0 0 1.18 KB
master SendReceive netcoreapp3.1 2.51μs 2.13ns 7.99ns 0 0 0 1.19 KB
master SendReceive net472 2.96μs 1.84ns 6.87ns 0.178 0 0 1.17 KB
#7689 SendReceive net6.0 1.96μs 0.708ns 2.55ns 0 0 0 1.18 KB
#7689 SendReceive netcoreapp3.1 2.54μs 12.2ns 47.4ns 0 0 0 1.19 KB
#7689 SendReceive net472 2.98μs 2.93ns 11ns 0.179 0 0 1.17 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.31μs 7.06ns 27.3ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.57μs 22.7ns 87.8ns 0 0 0 1.63 KB
master EnrichedLog net472 6.61μs 9.56ns 37ns 0.296 0 0 2.03 KB
#7689 EnrichedLog net6.0 4.56μs 4.9ns 17.7ns 0 0 0 1.58 KB
#7689 EnrichedLog netcoreapp3.1 5.88μs 24.3ns 94ns 0 0 0 1.63 KB
#7689 EnrichedLog net472 6.62μs 7.8ns 29.2ns 0.297 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 787ns 3.97ns 18.6ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 970ns 5.15ns 27.8ns 0 0 0 576 B
master StartFinishSpan net472 899ns 0.0761ns 0.285ns 0.0901 0 0 578 B
master StartFinishScope net6.0 947ns 1.91ns 7.41ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.16μs 5.53ns 22.1ns 0 0 0 696 B
master StartFinishScope net472 1.11μs 0.458ns 1.77ns 0.0997 0 0 658 B
master StartFinishTwoScopes net6.0 1.78μs 8.37ns 35.5ns 0 0 0 1.19 KB
master StartFinishTwoScopes netcoreapp3.1 2.2μs 8.76ns 33.9ns 0 0 0 1.19 KB
master StartFinishTwoScopes net472 2.13μs 2.11ns 8.16ns 0.16 0 0 1.08 KB
#7689 StartFinishSpan net6.0 853ns 4.44ns 20.8ns 0 0 0 576 B
#7689 StartFinishSpan netcoreapp3.1 970ns 5.2ns 26.5ns 0 0 0 576 B
#7689 StartFinishSpan net472 915ns 0.457ns 1.77ns 0.0918 0 0 578 B
#7689 StartFinishScope net6.0 960ns 3.51ns 13.2ns 0 0 0 696 B
#7689 StartFinishScope netcoreapp3.1 1.21μs 0.942ns 3.65ns 0 0 0 696 B
#7689 StartFinishScope net472 1.13μs 1.35ns 5.22ns 0.101 0 0 658 B
#7689 StartFinishTwoScopes net6.0 1.78μs 0.815ns 3.05ns 0 0 0 1.19 KB
#7689 StartFinishTwoScopes netcoreapp3.1 2.24μs 9.6ns 37.2ns 0 0 0 1.19 KB
#7689 StartFinishTwoScopes net472 2.15μs 2.38ns 9.22ns 0.161 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.07μs 0.985ns 3.81ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.41μs 5.98ns 23.1ns 0 0 0 696 B
master RunOnMethodBegin net472 1.48μs 2.63ns 10.2ns 0.0983 0 0 658 B
#7689 RunOnMethodBegin net6.0 1.08μs 5.38ns 24.7ns 0 0 0 696 B
#7689 RunOnMethodBegin netcoreapp3.1 1.42μs 5.35ns 20.7ns 0 0 0 696 B
#7689 RunOnMethodBegin net472 1.44μs 1.56ns 6.05ns 0.101 0 0 658 B

@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Oct 21, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7689) 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
duration75.23 ± (75.13 - 76.01) ms75.01 ± (75.03 - 75.73) ms-0.3%
.NET Framework 4.8 - Bailout
duration79.25 ± (79.36 - 79.98) ms79.29 ± (79.28 - 80.00) ms+0.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1061.97 ± (1060.82 - 1068.33) ms1071.83 ± (1071.51 - 1080.80) ms+0.9%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.88 ± (22.80 - 22.96) ms22.92 ± (22.85 - 22.99) ms+0.2%✅⬆️
process.time_to_main_ms86.99 ± (86.58 - 87.40) ms87.95 ± (87.58 - 88.33) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.91 - 10.92) MB10.92 ± (10.91 - 10.92) MB+0.0%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.67 ± (22.60 - 22.75) ms22.76 ± (22.70 - 22.82) ms+0.4%✅⬆️
process.time_to_main_ms88.12 ± (87.79 - 88.44) ms88.89 ± (88.48 - 89.31) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.95 - 10.96) MB10.95 ± (10.95 - 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.43 ± (220.99 - 223.86) ms221.45 ± (220.06 - 222.85) ms-0.4%
process.time_to_main_ms500.79 ± (499.75 - 501.84) ms501.82 ± (500.69 - 502.94) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.84 ± (47.82 - 47.86) MB47.88 ± (47.86 - 47.91) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.5%
.NET 6 - Baseline
process.internal_duration_ms21.78 ± (21.71 - 21.86) ms21.62 ± (21.54 - 21.69) ms-0.8%
process.time_to_main_ms76.71 ± (76.42 - 77.01) ms75.08 ± (74.70 - 75.47) ms-2.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.60 ± (10.59 - 10.60) MB10.62 ± (10.62 - 10.63) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.84 ± (21.77 - 21.91) ms21.48 ± (21.41 - 21.54) ms-1.7%
process.time_to_main_ms79.15 ± (78.80 - 79.50) ms75.70 ± (75.41 - 75.98) ms-4.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.65 - 10.65) MB10.66 ± (10.66 - 10.67) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms210.55 ± (209.50 - 211.61) ms211.69 ± (210.53 - 212.86) ms+0.5%✅⬆️
process.time_to_main_ms469.04 ± (467.83 - 470.25) ms470.46 ± (469.21 - 471.71) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.06 ± (48.03 - 48.08) MB48.18 ± (48.16 - 48.20) MB+0.3%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.87 ± (19.80 - 19.93) ms19.87 ± (19.80 - 19.93) ms-0.0%
process.time_to_main_ms74.54 ± (74.25 - 74.84) ms74.76 ± (74.41 - 75.11) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.67) MB7.65 ± (7.64 - 7.66) MB-0.2%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms20.06 ± (20.00 - 20.12) ms19.76 ± (19.70 - 19.82) ms-1.5%
process.time_to_main_ms77.49 ± (77.19 - 77.80) ms75.22 ± (74.90 - 75.55) ms-2.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.70 ± (7.69 - 7.70) MB-0.3%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms193.57 ± (192.56 - 194.57) ms191.90 ± (190.96 - 192.84) ms-0.9%
process.time_to_main_ms456.31 ± (455.15 - 457.46) ms455.23 ± (454.10 - 456.36) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.44 ± (36.40 - 36.47) MB36.42 ± (36.38 - 36.46) MB-0.0%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.0%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.34 ± (192.30 - 192.89) ms192.27 ± (192.47 - 193.23) ms-0.0%
.NET Framework 4.8 - Bailout
duration196.30 ± (196.18 - 196.88) ms196.59 ± (196.70 - 197.66) ms+0.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1111.88 ± (1116.28 - 1125.65) ms1111.47 ± (1114.67 - 1123.30) ms-0.0%
.NET Core 3.1 - Baseline
process.internal_duration_ms187.72 ± (187.36 - 188.08) ms188.72 ± (188.33 - 189.11) ms+0.5%✅⬆️
process.time_to_main_ms80.51 ± (80.31 - 80.71) ms80.77 ± (80.54 - 81.01) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.09 ± (16.07 - 16.12) MB16.06 ± (16.03 - 16.08) MB-0.2%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.3%
.NET Core 3.1 - Bailout
process.internal_duration_ms187.18 ± (186.89 - 187.47) ms187.45 ± (187.22 - 187.68) ms+0.1%✅⬆️
process.time_to_main_ms81.66 ± (81.53 - 81.80) ms81.60 ± (81.47 - 81.73) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.12 ± (16.09 - 16.16) MB16.14 ± (16.11 - 16.17) MB+0.1%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)-0.5%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms401.27 ± (398.56 - 403.97) ms400.95 ± (398.19 - 403.72) ms-0.1%
process.time_to_main_ms471.46 ± (470.88 - 472.03) ms477.14 ± (476.39 - 477.88) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.41 ± (58.27 - 58.56) MB59.00 ± (58.90 - 59.10) MB+1.0%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 30)+0.1%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms191.92 ± (191.57 - 192.27) ms192.44 ± (192.05 - 192.83) ms+0.3%✅⬆️
process.time_to_main_ms69.77 ± (69.61 - 69.94) ms70.03 ± (69.85 - 70.21) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.08 ± (15.94 - 16.22) MB16.08 ± (15.94 - 16.22) MB+0.0%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 19)+0.2%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms190.88 ± (190.57 - 191.20) ms190.98 ± (190.67 - 191.29) ms+0.1%✅⬆️
process.time_to_main_ms70.69 ± (70.58 - 70.80) ms70.78 ± (70.67 - 70.88) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.08 ± (15.92 - 16.25) MB16.28 ± (16.15 - 16.41) MB+1.2%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (20 - 20)+4.2%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms407.28 ± (405.05 - 409.52) ms408.64 ± (406.44 - 410.84) ms+0.3%✅⬆️
process.time_to_main_ms441.08 ± (440.49 - 441.66) ms444.30 ± (443.50 - 445.10) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.91 ± (58.76 - 59.06) MB58.81 ± (58.66 - 58.96) MB-0.2%
runtime.dotnet.threads.count30 ± (29 - 30)29 ± (29 - 30)-0.1%
.NET 8 - Baseline
process.internal_duration_ms189.97 ± (189.70 - 190.25) ms190.13 ± (189.85 - 190.41) ms+0.1%✅⬆️
process.time_to_main_ms69.42 ± (69.25 - 69.58) ms69.34 ± (69.14 - 69.54) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.79 ± (11.76 - 11.82) MB11.80 ± (11.77 - 11.83) MB+0.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.1%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms189.52 ± (189.26 - 189.78) ms189.93 ± (189.62 - 190.25) ms+0.2%✅⬆️
process.time_to_main_ms70.41 ± (70.31 - 70.51) ms70.20 ± (70.09 - 70.31) ms-0.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.88 ± (11.85 - 11.91) MB11.84 ± (11.80 - 11.87) MB-0.4%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms365.91 ± (364.37 - 367.45) ms364.52 ± (362.92 - 366.12) ms-0.4%
process.time_to_main_ms428.08 ± (427.55 - 428.60) ms427.55 ± (427.06 - 428.04) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.93 ± (47.90 - 47.96) MB47.97 ± (47.94 - 48.00) MB+0.1%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.2%
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 (7689) - mean (75ms)  : 70, 81
    master - mean (76ms)  : 69, 82

    section Bailout
    This PR (7689) - mean (80ms)  : 74, 85
    master - mean (80ms)  : 75, 84

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (1,076ms)  : 1007, 1146
    master - mean (1,065ms)  : 1009, 1120

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 (7689) - mean (119ms)  : 111, 127
    master - mean (117ms)  : 110, 124

    section Bailout
    This PR (7689) - mean (119ms)  : 111, 127
    master - mean (118ms)  : 112, 125

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (759ms)  : 718, 801
    master - mean (761ms)  : 718, 804

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7689) - mean (104ms)  : 95, 113
    master - mean (106ms)  : 98, 113

    section Bailout
    This PR (7689) - mean (104ms)  : 98, 110
    master - mean (108ms)  : 102, 115

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (709ms)  : 672, 746
    master - mean (709ms)  : 671, 747

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7689) - mean (103ms)  : 95, 111
    master - mean (103ms)  : 98, 108

    section Bailout
    This PR (7689) - mean (103ms)  : 97, 109
    master - mean (106ms)  : 100, 112

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (681ms)  : 647, 716
    master - mean (688ms)  : 651, 725

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 (7689) - mean (193ms)  : 189, 197
    master - mean (193ms)  : 190, 195

    section Bailout
    This PR (7689) - mean (197ms)  : 192, 202
    master - mean (197ms)  : 193, 200

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (1,119ms)  : 1057, 1181
    master - mean (1,121ms)  : 1050, 1192

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 (7689) - mean (278ms)  : 270, 286
    master - mean (277ms)  : 271, 283

    section Bailout
    This PR (7689) - mean (277ms)  : 274, 281
    master - mean (277ms)  : 273, 281

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (914ms)  : 860, 967
    master - mean (903ms)  : 851, 955

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7689) - mean (271ms)  : 265, 276
    master - mean (270ms)  : 266, 274

    section Bailout
    This PR (7689) - mean (270ms)  : 267, 273
    master - mean (270ms)  : 265, 274

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (888ms)  : 836, 939
    master - mean (882ms)  : 842, 922

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

    section Bailout
    This PR (7689) - mean (270ms)  : 266, 274
    master - mean (269ms)  : 266, 272

    section CallTarget+Inlining+NGEN
    This PR (7689) - mean (823ms)  : 799, 847
    master - mean (825ms)  : 799, 852

Loading

@anna-git anna-git changed the title [Config registry] Analyzers for ConfigurationBuilder, ConfigurationKeys, PlatformKeys [ConfigRegistry] Analyzers for platform and ConfigurationBuilder Oct 22, 2025
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from c983088 to 9e2a61b Compare October 22, 2025 17:26
@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-configuration-aliases-switch-3 branch 2 times, most recently from f242046 to 153e7b3 Compare October 22, 2025 18:14
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 56bd199 to e52fd10 Compare October 22, 2025 18:14
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from 153e7b3 to bd34118 Compare October 22, 2025 18:27
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from bea714d to a6668f3 Compare October 29, 2025 17:48
@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 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-aliases-switch-3 branch from a6668f3 to d90d571 Compare October 30, 2025 18:03
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch 2 times, most recently from 3197af6 to e6d6574 Compare October 30, 2025 20:47
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from 6ccb01e to ed3a6bc Compare October 31, 2025 01:39
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch 2 times, most recently from dcd2f3c to 196d5e0 Compare October 31, 2025 21:41
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from f3473db to 5a68b3b Compare November 25, 2025 16:33
@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-configuration-aliases-switch-3 branch from 5a68b3b to affec1a Compare November 25, 2025 20:08
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch 3 times, most recently from 667cda0 to 888141d 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).
Base automatically changed from anna/config-inversion-configuration-aliases-switch-3 to master November 26, 2025 10:26
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 888141d to 1a1742c Compare November 28, 2025 14:31
Copy link
Contributor

@daniel-romano-DD daniel-romano-DD left a comment

Choose a reason for hiding this comment

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

TY!

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 1a1742c to 13b5134 Compare December 1, 2025 15:59
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 13b5134 to 20ca6c4 Compare December 2, 2025 11:41
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.

6 participants