Skip to content

Conversation

@anna-git
Copy link
Contributor

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

Context

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

  1. #7548 - Add GitLab step and JSON configuration file
  2. #7688 - Cleanup configuration / platform keys + source generator
  3. #7690 - Aliases handling via source generator (this PR)
  4. #7689 - Analyzers for platform and ConfigurationBuilder
  5. #7697 - Fix configuration mapping file parsing

Summary of changes

  • Created ConfigKeyAliasesSwitcher source generator to automatically generate alias mappings from supported-configurations.json
  • Refactored ConfigurationBuilder to automatically handle aliases using the generated switcher, removing explicit fallback key parameters
  • Restored WithIntegrationKey, WithIntegrationAnalyticsKey, and WithIntegrationAnalyticsSampleRateKey helper methods for integration-specific configuration
  • Removed explicit fallback keys from all WithKeys() call sites throughout the codebase
  • Updated configuration tests to work with automatic alias resolution
  • Fixed special cases for DatadogLoggingFactory to handle deprecated keys properly

Reason for change

This PR centralizes alias handling by auto-generating the alias mappings from the JSON file.

Implementation details

ConfigKeyAliasesSwitcher source generator:

  • Reads supported-configurations.json at compile time
  • Generates a static GetAliases(string key) method that returns aliases for any configuration key
  • Generated code example:
internal static partial class ConfigKeyAliasesSwitcher
{
    public static string[] GetAliases(string key) => key switch
    {
        "DD_TRACE_AGENT_PORT" => new[] { "DATADOG_TRACE_AGENT_PORT" },
        "DD_AGENT_HOST" => new[] { "DD_TRACE_AGENT_HOSTNAME", "DATADOG_TRACE_AGENT_HOSTNAME_OPTIMIZED" },
        "DD_TRACE_LOG_DIRECTORY" => new[] { "DD_TRACE_LOG_PATH" },
        "DD_TRACE_CLIENT_IP_HEADER" => new[] { "DD_APPSEC_IPHEADER" },
        "DD_TRACE_PROPAGATION_STYLE_INJECT" => new[] { "DD_PROPAGATION_STYLE_INJECT", "DD_TRACE_PROPAGATION_STYLE" },
        "DD_TRACE_PROPAGATION_STYLE_EXTRACT" => new[] { "DD_PROPAGATION_STYLE_EXTRACT", "DD_TRACE_PROPAGATION_STYLE" },
        _ => Array.Empty<string>()
    };
}

ConfigurationBuilder refactoring:

// BEFORE: Manual fallback keys
public HasKeys WithKeys(string key, string fallbackKey1 = null, string fallbackKey2 = null, string fallbackKey3 = null)

// AFTER: Automatic alias resolution
public HasKeys WithKeys(string key) => new(_source, _telemetry, key);

private ConfigurationResult<T> GetResultWithFallback<T>(Func<string, ConfigurationResult<T>> selector)
{
    var result = selector(Key);
    if (!result.ShouldFallBack)
    {
        return result;
    }

    // Automatically get aliases from generated switcher
    string[] aliases = ConfigKeyAliasesSwitcher.GetAliases(Key);
    
    foreach (var alias in aliases)
    {
        result = selector(alias);
        if (!result.ShouldFallBack)
        {
            break;
        }
    }
    
    return result;
}

Integration-specific helper methods restored:

public HasKeys WithIntegrationKey(string integrationName) => new(
    _source,
    _telemetry,
    string.Format(IntegrationSettings.IntegrationEnabledKey, integrationName.ToUpperInvariant()),
    [
        string.Format(IntegrationSettings.IntegrationEnabledKey, integrationName),
        $"DD_{integrationName}_ENABLED"
    ]);

public HasKeys WithIntegrationAnalyticsKey(string integrationName) => new(...);
public HasKeys WithIntegrationAnalyticsSampleRateKey(string integrationName) => new(...);

These handle the special case where integration keys follow a pattern (e.g., DD_TRACE_{INTEGRATION}_ENABLED) and need dynamic alias generation.

Simplified call sites:

// BEFORE: Explicit fallbacks
config.WithKeys(ConfigurationKeys.PropagationStyleInject, 
                "DD_PROPAGATION_STYLE_INJECT", 
                ConfigurationKeys.PropagationStyle)

// AFTER: Automatic aliases
config.WithKeys(ConfigurationKeys.PropagationStyleInject)

Special handling for deprecated keys:
For DatadogLoggingFactory, deprecated keys like DD_TRACE_LOG_PATH need special handling (extracting directory from file path). This is handled by checking the deprecated key explicitly when the primary key is not found.

Test coverage

  • Updated all configuration tests to work with automatic alias resolution
  • Tests verify that aliases are correctly resolved in the expected order
  • Integration tests ensure backward compatibility with deprecated keys
  • Source generator tests validate correct generation from JSON file

Other details

Benefits:

  • Single source of truth: Aliases defined once in supported-configurations.json
  • Automatic synchronization: Changes to JSON automatically reflected in code
  • Cleaner code: No more explicit fallback parameters at call sites
  • Type-safe: Generated code is strongly-typed and compile-time checked
  • Maintainable: Adding/removing aliases only requires JSON changes
  • Consistent: All code uses the same alias resolution logic

Performance:

  • Alias lookup is a simple switch statement (O(1) with compiler optimizations)
  • No runtime reflection or dynamic lookups
  • Generated code is inlined by JIT compiler

@pr-commenter
Copy link

pr-commenter bot commented Oct 21, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7690 compared to master:

  • 1 benchmarks are faster, with geometric mean 2.470
  • 7 benchmarks are slower, with geometric mean 1.246
  • 4 benchmarks have fewer allocations
  • 11 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 #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6 KB 6.11 KB 112 B 1.87%

Fewer allocations 🎉 in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.71 KB 5.68 KB -33 B -0.58%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.6μs 58.5ns 336ns 0 0 0 5.52 KB
master StartStopWithChild netcoreapp3.1 13.8μs 55.7ns 216ns 0 0 0 5.71 KB
master StartStopWithChild net472 22.4μs 87.6ns 316ns 0.999 0.444 0.111 6 KB
#7690 StartStopWithChild net6.0 10.7μs 52.2ns 215ns 0 0 0 5.51 KB
#7690 StartStopWithChild netcoreapp3.1 14.1μs 66.1ns 256ns 0 0 0 5.68 KB
#7690 StartStopWithChild net472 22.5μs 124ns 745ns 0.953 0.318 0 6.11 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 947μs 220ns 850ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.01ms 316ns 1.22μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.19ms 145ns 542ns 0 0 0 3.31 KB
#7690 WriteAndFlushEnrichedTraces net6.0 932μs 41ns 154ns 0 0 0 2.71 KB
#7690 WriteAndFlushEnrichedTraces netcoreapp3.1 1.06ms 107ns 371ns 0 0 0 2.7 KB
#7690 WriteAndFlushEnrichedTraces net472 1.2ms 78.4ns 283ns 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7690

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 1.286 512,196.73 658,556.60
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 1.266 349,932.81 442,868.75
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 1.232 362,488.66 446,585.55
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 1.215 530,464.93 644,444.62
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 1.203 471,077.31 566,692.12
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 1.186 485,247.12 575,450.28

More allocations ⚠️ in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 179.56 KB 296.38 KB 116.82 KB 65.06%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 183.08 KB 299.9 KB 116.82 KB 63.81%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 185.32 KB 302.14 KB 116.82 KB 63.03%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 188.75 KB 305.57 KB 116.82 KB 61.89%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 205.41 KB 323.66 KB 118.25 KB 57.57%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 208.94 KB 327.18 KB 118.24 KB 56.59%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 348μs 1.38μs 5.36μs 0 0 0 179.56 KB
master AllCycleSimpleBody netcoreapp3.1 510μs 1.9μs 7.36μs 0 0 0 185.32 KB
master AllCycleSimpleBody net472 471μs 263ns 983ns 32.4 0 0 205.41 KB
master AllCycleMoreComplexBody net6.0 362μs 1.31μs 5.06μs 0 0 0 183.08 KB
master AllCycleMoreComplexBody netcoreapp3.1 530μs 1.41μs 5.08μs 0 0 0 188.75 KB
master AllCycleMoreComplexBody net472 485μs 135ns 504ns 31.2 0 0 208.94 KB
master ObjectExtractorSimpleBody net6.0 320ns 1.58ns 7.08ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 393ns 2.21ns 13.8ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 298ns 0.0452ns 0.169ns 0.0436 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.25μs 33.4ns 170ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.82μs 37.2ns 144ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.69μs 4.82ns 18.7ns 0.601 0 0 3.8 KB
#7690 AllCycleSimpleBody net6.0 438μs 2.37μs 12.5μs 0 0 0 296.38 KB
#7690 AllCycleSimpleBody netcoreapp3.1 657μs 2.19μs 8.49μs 0 0 0 302.14 KB
#7690 AllCycleSimpleBody net472 567μs 119ns 430ns 48.9 2.72 0 323.66 KB
#7690 AllCycleMoreComplexBody net6.0 447μs 1.16μs 4.51μs 0 0 0 299.9 KB
#7690 AllCycleMoreComplexBody netcoreapp3.1 642μs 2.56μs 9.59μs 0 0 0 305.57 KB
#7690 AllCycleMoreComplexBody net472 575μs 112ns 404ns 51.1 2.84 0 327.18 KB
#7690 ObjectExtractorSimpleBody net6.0 334ns 0.141ns 0.527ns 0 0 0 280 B
#7690 ObjectExtractorSimpleBody netcoreapp3.1 409ns 2.29ns 14.7ns 0 0 0 272 B
#7690 ObjectExtractorSimpleBody net472 295ns 0.0397ns 0.148ns 0.0433 0 0 281 B
#7690 ObjectExtractorMoreComplexBody net6.0 6.5μs 32.5ns 142ns 0 0 0 3.78 KB
#7690 ObjectExtractorMoreComplexBody netcoreapp3.1 7.84μs 26.5ns 103ns 0 0 0 3.69 KB
#7690 ObjectExtractorMoreComplexBody net472 6.69μs 3.42ns 13.2ns 0.601 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 75.9μs 255ns 954ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 95.6μs 214ns 828ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 19.1ns 71.4ns 4.91 0 0 32.51 KB
master EncodeLegacyArgs net6.0 145μs 49.3ns 191ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 196μs 293ns 1.14μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 262μs 207ns 803ns 0 0 0 2.16 KB
#7690 EncodeArgs net6.0 77.6μs 297ns 1.15μs 0 0 0 32.4 KB
#7690 EncodeArgs netcoreapp3.1 97.8μs 224ns 867ns 0 0 0 32.4 KB
#7690 EncodeArgs net472 108μs 9.13ns 35.4ns 4.87 0 0 32.51 KB
#7690 EncodeLegacyArgs net6.0 145μs 10.4ns 38.9ns 0 0 0 2.15 KB
#7690 EncodeLegacyArgs netcoreapp3.1 198μs 115ns 429ns 0 0 0 2.14 KB
#7690 EncodeLegacyArgs net472 263μs 31ns 116ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7690

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.470 732,635.94 296,608.84

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 394μs 118ns 442ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 412μs 116ns 433ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 436μs 41.3ns 154ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 285μs 28.7ns 108ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 667μs 14.6μs 146μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 313μs 26.1ns 101ns 0 0 0 2.29 KB
#7690 RunWafRealisticBenchmark net6.0 390μs 26.3ns 94.8ns 0 0 0 4.56 KB
#7690 RunWafRealisticBenchmark netcoreapp3.1 410μs 422ns 1.58μs 0 0 0 4.48 KB
#7690 RunWafRealisticBenchmark net472 429μs 45.2ns 175ns 0 0 0 4.66 KB
#7690 RunWafRealisticBenchmarkWithAttack net6.0 286μs 37.4ns 145ns 0 0 0 2.24 KB
#7690 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 297μs 106ns 410ns 0 0 0 2.22 KB
#7690 RunWafRealisticBenchmarkWithAttack net472 309μs 55.2ns 207ns 0 0 0 2.29 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 62.2μs 48ns 186ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.9μs 48.8ns 176ns 0 0 0 17.42 KB
master SendRequest net472 0.00346ns 0.00135ns 0.00524ns 0 0 0 0 b
#7690 SendRequest net6.0 60.9μs 114ns 409ns 0 0 0 14.52 KB
#7690 SendRequest netcoreapp3.1 71.8μs 80.9ns 303ns 0 0 0 17.42 KB
#7690 SendRequest net472 0.00758ns 0.00151ns 0.00583ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7690

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 1.341 797,175.30 1,068,628.57

More allocations ⚠️ in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 0 b 1 B 1 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 4 B 6 B 2 B 50.00%

Fewer allocations 🎉 in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 3 B 1 B -2 B -66.67%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.95ms 4.73μs 17μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.15ms 5.05μs 19.5μs 0 0 0 640 KB
master OriginalCharSlice net472 2.59ms 106ns 398ns 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.54ms 281ns 1.05μs 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.69ms 234ns 907ns 0 0 0 1 B
master OptimizedCharSlice net472 1.91ms 169ns 655ns 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 849μs 20ns 77.3ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 797μs 132ns 493ns 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.13ms 82.7ns 320ns 0 0 0 0 b
#7690 OriginalCharSlice net6.0 2.03ms 451ns 1.63μs 0 0 0 640 KB
#7690 OriginalCharSlice netcoreapp3.1 2.16ms 1.87μs 7μs 0 0 0 640 KB
#7690 OriginalCharSlice net472 2.56ms 450ns 1.69μs 100 0 0 641.95 KB
#7690 OptimizedCharSlice net6.0 1.44ms 227ns 879ns 0 0 0 6 B
#7690 OptimizedCharSlice netcoreapp3.1 1.74ms 242ns 907ns 0 0 0 1 B
#7690 OptimizedCharSlice net472 2.06ms 319ns 1.23μs 0 0 0 0 b
#7690 OptimizedCharSliceWithPool net6.0 826μs 18.8ns 70.3ns 0 0 0 1 B
#7690 OptimizedCharSliceWithPool netcoreapp3.1 1.07ms 840ns 3.25μs 0 0 0 1 B
#7690 OptimizedCharSliceWithPool net472 1.15ms 81.7ns 295ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 42.35 KB 41.66 KB -693 B -1.64%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 731μs 909ns 3.52μs 0 0 0 42.35 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 749μs 4.12μs 24μs 0 0 0 41.78 KB
master WriteAndFlushEnrichedTraces net472 940μs 4.46μs 17.3μs 4.81 0 0 55.94 KB
#7690 WriteAndFlushEnrichedTraces net6.0 667μs 1.07μs 4.13μs 0 0 0 41.66 KB
#7690 WriteAndFlushEnrichedTraces netcoreapp3.1 723μs 4.17μs 32.9μs 0 0 0 41.8 KB
#7690 WriteAndFlushEnrichedTraces net472 963μs 3.2μs 12.4μs 8.33 0 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.96μs 9.75ns 41.4ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.62μs 10.3ns 39.7ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.86μs 4.37ns 16.9ns 0.143 0.0143 0 987 B
#7690 ExecuteNonQuery net6.0 1.88μs 1.12ns 4.36ns 0 0 0 1.02 KB
#7690 ExecuteNonQuery netcoreapp3.1 2.65μs 7.94ns 30.8ns 0 0 0 1.02 KB
#7690 ExecuteNonQuery net472 2.78μs 3.24ns 12.5ns 0.152 0.0138 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.77μs 9.27ns 43.5ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.33μs 10.2ns 36.6ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.54μs 1.11ns 4.31ns 0.159 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.85μs 1.09ns 3.92ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.37μs 6.58ns 24.6ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.71μs 1.96ns 7.59ns 0.166 0 0 1.1 KB
#7690 CallElasticsearch net6.0 1.83μs 9.3ns 41.6ns 0 0 0 1.03 KB
#7690 CallElasticsearch netcoreapp3.1 2.37μs 7.14ns 26.7ns 0 0 0 1.03 KB
#7690 CallElasticsearch net472 3.52μs 4.41ns 17.1ns 0.158 0 0 1.04 KB
#7690 CallElasticsearchAsync net6.0 1.91μs 9.62ns 43ns 0 0 0 1.01 KB
#7690 CallElasticsearchAsync netcoreapp3.1 2.39μs 9.02ns 34.9ns 0 0 0 1.08 KB
#7690 CallElasticsearchAsync net472 3.78μs 1.84ns 6.64ns 0.169 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.85μs 7.61ns 27.5ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.29μs 10.8ns 45.9ns 0 0 0 952 B
master ExecuteAsync net472 2.71μs 7.73ns 28.9ns 0.133 0 0 915 B
#7690 ExecuteAsync net6.0 1.89μs 5.26ns 20.4ns 0 0 0 952 B
#7690 ExecuteAsync netcoreapp3.1 2.38μs 6.81ns 24.6ns 0 0 0 952 B
#7690 ExecuteAsync net472 2.51μs 1.33ns 5.16ns 0.138 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.84μs 7.28ns 26.2ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.42μs 26.3ns 102ns 0 0 0 2.9 KB
master SendAsync net472 12.8μs 6.69ns 25ns 0.448 0 0 3.18 KB
#7690 SendAsync net6.0 7.08μs 6.59ns 23.8ns 0 0 0 2.36 KB
#7690 SendAsync netcoreapp3.1 8.68μs 17.6ns 68.3ns 0 0 0 2.9 KB
#7690 SendAsync net472 12.1μs 10.2ns 39.7ns 0.484 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 57.34 KB 65.54 KB 8.19 KB 14.29%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.82 KB 45.85 KB 2.03 KB 4.64%

Fewer allocations 🎉 in #7690

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 274.26 KB 256.72 KB -17.54 KB -6.40%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 44.1μs 235ns 1.17μs 0 0 0 43.82 KB
master StringConcatBenchmark netcoreapp3.1 46.8μs 226ns 1.26μs 0 0 0 42.68 KB
master StringConcatBenchmark net472 55.7μs 232ns 898ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 476μs 1.02μs 3.52μs 0 0 0 274.26 KB
master StringConcatAspectBenchmark netcoreapp3.1 524μs 2.52μs 9.78μs 0 0 0 273.64 KB
master StringConcatAspectBenchmark net472 406μs 2.34μs 18.4μs 0 0 0 278.53 KB
#7690 StringConcatBenchmark net6.0 43.8μs 208ns 883ns 0 0 0 45.85 KB
#7690 StringConcatBenchmark netcoreapp3.1 49.7μs 277ns 1.66μs 0 0 0 42.77 KB
#7690 StringConcatBenchmark net472 56.1μs 251ns 906ns 0 0 0 65.54 KB
#7690 StringConcatAspectBenchmark net6.0 441μs 1.85μs 6.41μs 0 0 0 256.72 KB
#7690 StringConcatAspectBenchmark netcoreapp3.1 524μs 1.85μs 6.92μs 0 0 0 272.58 KB
#7690 StringConcatAspectBenchmark net472 398μs 2.03μs 14.1μ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.58μs 12ns 49.3ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.61μs 17.9ns 75.8ns 0 0 0 1.7 KB
master EnrichedLog net472 3.81μs 2.51ns 9.41ns 0.247 0 0 1.64 KB
#7690 EnrichedLog net6.0 2.63μs 12.5ns 51.4ns 0 0 0 1.7 KB
#7690 EnrichedLog netcoreapp3.1 3.62μs 17.8ns 73.6ns 0 0 0 1.7 KB
#7690 EnrichedLog net472 3.9μs 3.14ns 12.2ns 0.253 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 122μs 64.1ns 240ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 128μs 394ns 1.53μs 0 0 0 4.31 KB
master EnrichedLog net472 166μs 16.4ns 56.6ns 0 0 0 4.51 KB
#7690 EnrichedLog net6.0 123μs 105ns 393ns 0 0 0 4.31 KB
#7690 EnrichedLog netcoreapp3.1 128μs 238ns 923ns 0 0 0 4.31 KB
#7690 EnrichedLog net472 165μs 63.3ns 245ns 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.88μs 16.6ns 64.1ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.63μs 18.6ns 69.5ns 0 0 0 2.26 KB
master EnrichedLog net472 7.75μs 7.52ns 29.1ns 0.313 0 0 2.08 KB
#7690 EnrichedLog net6.0 5μs 22.6ns 84.4ns 0 0 0 2.26 KB
#7690 EnrichedLog netcoreapp3.1 6.83μs 23.6ns 91.2ns 0 0 0 2.26 KB
#7690 EnrichedLog net472 7.31μs 6.34ns 24.5ns 0.328 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 2.08μs 10.2ns 43.4ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.61μs 0.898ns 3.48ns 0 0 0 1.2 KB
master SendReceive net472 3.45μs 4.91ns 19ns 0.188 0 0 1.2 KB
#7690 SendReceive net6.0 2.05μs 2.78ns 10.8ns 0 0 0 1.2 KB
#7690 SendReceive netcoreapp3.1 2.71μs 5.37ns 20.8ns 0 0 0 1.2 KB
#7690 SendReceive net472 3.22μs 2.39ns 9.25ns 0.176 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.28μs 15.1ns 58.4ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.67μs 12.2ns 45.5ns 0 0 0 1.63 KB
master EnrichedLog net472 6.67μs 9.05ns 35ns 0.3 0 0 2.03 KB
#7690 EnrichedLog net6.0 4.59μs 4.37ns 16.4ns 0 0 0 1.58 KB
#7690 EnrichedLog netcoreapp3.1 5.75μs 24.1ns 93.4ns 0 0 0 1.63 KB
#7690 EnrichedLog net472 6.74μs 8.54ns 31.9ns 0.302 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 769ns 3.61ns 14.4ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 959ns 4.89ns 23.5ns 0 0 0 576 B
master StartFinishSpan net472 931ns 1.28ns 4.97ns 0.0882 0 0 578 B
master StartFinishScope net6.0 894ns 0.398ns 1.44ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.16μs 3.88ns 15ns 0 0 0 696 B
master StartFinishScope net472 1.13μs 0.666ns 2.58ns 0.101 0 0 658 B
#7690 StartFinishSpan net6.0 776ns 0.226ns 0.876ns 0 0 0 576 B
#7690 StartFinishSpan netcoreapp3.1 957ns 5.23ns 28.6ns 0 0 0 576 B
#7690 StartFinishSpan net472 913ns 0.132ns 0.475ns 0.0915 0 0 578 B
#7690 StartFinishScope net6.0 944ns 4.51ns 18.6ns 0 0 0 696 B
#7690 StartFinishScope netcoreapp3.1 1.2μs 5.79ns 23.2ns 0 0 0 696 B
#7690 StartFinishScope net472 1.08μs 0.593ns 2.3ns 0.104 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.05μs 5.61ns 28ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.41μs 7.35ns 35.2ns 0 0 0 696 B
master RunOnMethodBegin net472 1.42μs 1.09ns 4.24ns 0.0993 0 0 658 B
#7690 RunOnMethodBegin net6.0 1.05μs 0.954ns 3.69ns 0 0 0 696 B
#7690 RunOnMethodBegin netcoreapp3.1 1.41μs 6.6ns 26.4ns 0 0 0 696 B
#7690 RunOnMethodBegin net472 1.46μs 1.08ns 4.19ns 0.102 0 0 658 B

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

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

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

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (74ms)  : 72, 75
     .   : milestone, 74,
    master - mean (74ms)  : 73, 76
     .   : milestone, 74,

    section Baseline
    This PR (7690) - mean (70ms)  : 68, 72
     .   : milestone, 70,
    master - mean (70ms)  : 68, 72
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (1,080ms)  : 1023, 1137
     .   : milestone, 1080,
    master - mean (1,065ms)  : 1005, 1125
     .   : milestone, 1065,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (110ms)  : 108, 112
     .   : milestone, 110,
    master - mean (109ms)  : 108, 111
     .   : milestone, 109,

    section Baseline
    This PR (7690) - mean (109ms)  : 105, 113
     .   : milestone, 109,
    master - mean (109ms)  : 106, 111
     .   : milestone, 109,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (760ms)  : 735, 786
     .   : milestone, 760,
    master - mean (754ms)  : 733, 775
     .   : milestone, 754,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (97ms)  : 95, 98
     .   : milestone, 97,
    master - mean (97ms)  : 95, 100
     .   : milestone, 97,

    section Baseline
    This PR (7690) - mean (97ms)  : 94, 99
     .   : milestone, 97,
    master - mean (97ms)  : 94, 100
     .   : milestone, 97,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (724ms)  : 686, 762
     .   : milestone, 724,
    master - mean (722ms)  : 676, 767
     .   : milestone, 722,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (96ms)  : 94, 98
     .   : milestone, 96,
    master - mean (98ms)  : 95, 100
     .   : milestone, 98,

    section Baseline
    This PR (7690) - mean (95ms)  : 92, 97
     .   : milestone, 95,
    master - mean (98ms)  : 90, 105
     .   : milestone, 98,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (671ms)  : 656, 687
     .   : milestone, 671,
    master - mean (673ms)  : 656, 691
     .   : milestone, 673,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (197ms)  : 194, 199
     .   : milestone, 197,
    master - mean (199ms)  : 193, 205
     .   : milestone, 199,

    section Baseline
    This PR (7690) - mean (194ms)  : 190, 198
     .   : milestone, 194,
    master - mean (195ms)  : 191, 199
     .   : milestone, 195,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (1,193ms)  : 1132, 1254
     .   : milestone, 1193,
    master - mean (1,183ms)  : 1104, 1262
     .   : milestone, 1183,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (282ms)  : 274, 291
     .   : milestone, 282,
    master - mean (279ms)  : 273, 286
     .   : milestone, 279,

    section Baseline
    This PR (7690) - mean (282ms)  : 271, 294
     .   : milestone, 282,
    master - mean (279ms)  : 267, 292
     .   : milestone, 279,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (962ms)  : 911, 1012
     .   : milestone, 962,
    master - mean (948ms)  : 900, 996
     .   : milestone, 948,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (271ms)  : 268, 275
     .   : milestone, 271,
    master - mean (274ms)  : 266, 281
     .   : milestone, 274,

    section Baseline
    This PR (7690) - mean (274ms)  : 265, 283
     .   : milestone, 274,
    master - mean (270ms)  : 267, 274
     .   : milestone, 270,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (960ms)  : 897, 1023
     .   : milestone, 960,
    master - mean (943ms)  : 883, 1003
     .   : milestone, 943,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7690) - mean (273ms)  : 264, 282
     .   : milestone, 273,
    master - mean (271ms)  : 266, 277
     .   : milestone, 271,

    section Baseline
    This PR (7690) - mean (271ms)  : 264, 278
     .   : milestone, 271,
    master - mean (271ms)  : 264, 279
     .   : milestone, 271,

    section CallTarget+Inlining+NGEN
    This PR (7690) - mean (861ms)  : 836, 886
     .   : milestone, 861,
    master - mean (866ms)  : 838, 894
     .   : milestone, 866,

Loading

@anna-git anna-git changed the title Anna/config inversion configuration aliases switch 3 [ConfigRegistry] Aliases handling via source generator Oct 22, 2025
@anna-git anna-git force-pushed the anna/config-inversion-configuration-keys-rework-2 branch from d72f4ac to f242046 Compare October 22, 2025 17:26
@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 closed this Oct 22, 2025
@anna-git anna-git force-pushed the anna/config-inversion-configuration-aliases-switch-3 branch from 9e2a61b to f242046 Compare October 22, 2025 17:52
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.

1 participant