Skip to content

Conversation

@anna-git
Copy link
Contributor

@anna-git anna-git commented Sep 25, 2025

As part of Config inversion third step, this is part of stack:
Add gitlab step and json configuration file > #7548
Cleanup config keys constants, check them against local json file > #7556
Aliases handling > #7565
Analyzers to guard platform and configurationbuilder > #7575

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

Example alias resolution:

// User sets: DD_PROPAGATION_STYLE_INJECT=datadog
// 1. Try DD_TRACE_PROPAGATION_STYLE_INJECT (primary key) → not found
// 2. Try DD_PROPAGATION_STYLE_INJECT (alias 1) → found! Use this value
// 3. Try DD_TRACE_PROPAGATION_STYLE (alias 2) → not checked, already found

Future improvements:

  • Could extend source generator to validate alias consistency
  • Could generate documentation from aliases
  • Could add analyzer to warn about hardcoded alias strings

This PR builds on #7556 (validation) and simplifies the configuration system by automating alias handling through source generation.

@anna-git anna-git changed the base branch from anna/config-inversion-supported-config-file to anna/config-inversion-check-configurationkeys-are-in-json September 25, 2025 15:45
@datadog-datadog-prod-us1

This comment has been minimized.

@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from b4f49db to aa859f2 Compare September 26, 2025 11:15
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Sep 26, 2025

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 (7565) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7565) - mean (68ms)  : 67, 69
     .   : milestone, 68,
    master - mean (68ms)  : 66, 71
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (1,060ms)  : 1016, 1105
     .   : milestone, 1060,
    master - mean (1,053ms)  : 1004, 1101
     .   : milestone, 1053,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7565) - mean (106ms)  : 105, 108
     .   : milestone, 106,
    master - mean (106ms)  : 105, 108
     .   : milestone, 106,

    section Baseline
    This PR (7565) - mean (106ms)  : 103, 109
     .   : milestone, 106,
    master - mean (106ms)  : 103, 108
     .   : milestone, 106,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (747ms)  : 726, 768
     .   : milestone, 747,
    master - mean (743ms)  : 718, 768
     .   : milestone, 743,

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

    section Baseline
    This PR (7565) - mean (100ms)  : 97, 102
     .   : milestone, 100,
    master - mean (100ms)  : 97, 102
     .   : milestone, 100,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (784ms)  : 749, 819
     .   : milestone, 784,
    master - mean (774ms)  : 721, 828
     .   : milestone, 774,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7565) - mean (93ms)  : 91, 94
     .   : milestone, 93,
    master - mean (92ms)  : 91, 94
     .   : milestone, 92,

    section Baseline
    This PR (7565) - mean (92ms)  : 90, 93
     .   : milestone, 92,
    master - mean (92ms)  : 90, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (662ms)  : 647, 677
     .   : milestone, 662,
    master - mean (662ms)  : 648, 676
     .   : milestone, 662,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7565) - mean (210ms)  : crit, 202, 217
     .   : crit, milestone, 210,
    master - mean (196ms)  : 193, 199
     .   : milestone, 196,

    section Baseline
    This PR (7565) - mean (205ms)  : 198, 213
     .   : milestone, 205,
    master - mean (192ms)  : 189, 195
     .   : milestone, 192,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (1,220ms)  : 1148, 1292
     .   : milestone, 1220,
    master - mean (1,163ms)  : 1106, 1221
     .   : milestone, 1163,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7565) - mean (292ms)  : 285, 300
     .   : milestone, 292,
    master - mean (278ms)  : 273, 283
     .   : milestone, 278,

    section Baseline
    This PR (7565) - mean (288ms)  : 283, 293
     .   : milestone, 288,
    master - mean (277ms)  : 271, 282
     .   : milestone, 277,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (968ms)  : 921, 1015
     .   : milestone, 968,
    master - mean (935ms)  : 888, 981
     .   : milestone, 935,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7565) - mean (294ms)  : 286, 303
     .   : milestone, 294,
    master - mean (281ms)  : 276, 285
     .   : milestone, 281,

    section Baseline
    This PR (7565) - mean (293ms)  : 287, 300
     .   : milestone, 293,
    master - mean (280ms)  : 274, 286
     .   : milestone, 280,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (1,038ms)  : 994, 1082
     .   : milestone, 1038,
    master - mean (987ms)  : 941, 1034
     .   : milestone, 987,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7565) - mean (284ms)  : crit, 277, 290
     .   : crit, milestone, 284,
    master - mean (268ms)  : 265, 272
     .   : milestone, 268,

    section Baseline
    This PR (7565) - mean (283ms)  : 277, 289
     .   : milestone, 283,
    master - mean (268ms)  : 265, 272
     .   : milestone, 268,

    section CallTarget+Inlining+NGEN
    This PR (7565) - mean (888ms)  : 858, 919
     .   : milestone, 888,
    master - mean (850ms)  : 832, 869
     .   : milestone, 850,

Loading

@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch 2 times, most recently from 74191d8 to d273ab2 Compare September 29, 2025 11:52
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch 2 times, most recently from e4fb133 to bc2ad02 Compare September 29, 2025 12:27
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from d273ab2 to 69d1378 Compare September 29, 2025 12:27
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from bc2ad02 to 5a9a712 Compare September 29, 2025 14:09
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from 69d1378 to 0ac2639 Compare September 29, 2025 14:09
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from 5a9a712 to 6d51e76 Compare September 29, 2025 14:12
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch 2 times, most recently from fa3c30d to 554b7d0 Compare September 29, 2025 15:07
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from 6d51e76 to f9bb5ba Compare September 29, 2025 15:37
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch 2 times, most recently from dcd0751 to a70649e Compare September 29, 2025 15:52
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from f9bb5ba to 1bc1b38 Compare September 29, 2025 17:34
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from a70649e to c69d700 Compare September 29, 2025 17:34
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from 1bc1b38 to d72acce Compare October 2, 2025 09:49
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch 4 times, most recently from e83c851 to a24c630 Compare October 2, 2025 20:07
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from 3ab9889 to e31264e Compare October 3, 2025 10:33
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch 2 times, most recently from f82f250 to a00c6e5 Compare October 6, 2025 14:12
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from e31264e to 416672b Compare October 6, 2025 14:23
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from a00c6e5 to 5cb5bd4 Compare October 6, 2025 14:23
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from 416672b to be5f635 Compare October 7, 2025 09:53
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from d0ce1b1 to 11dc398 Compare October 8, 2025 13:06
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from 23eace3 to a5f0971 Compare October 8, 2025 13:32
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch 3 times, most recently from 2241d06 to d7423a7 Compare October 8, 2025 14:24
@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from a5f0971 to b202c12 Compare October 8, 2025 17:52
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from d7423a7 to fb0cab6 Compare October 8, 2025 17:52
@pr-commenter
Copy link

pr-commenter bot commented Oct 8, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7565 compared to master:

  • 4 benchmarks are faster, with geometric mean 1.210
  • 7 benchmarks are slower, with geometric mean 1.339
  • 3 benchmarks have fewer allocations
  • 15 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 ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7565

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.11 KB 6.03 KB -77 B -1.26%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.5μs 58.5ns 361ns 0 0 0 5.51 KB
master StartStopWithChild netcoreapp3.1 14μs 70.9ns 333ns 0 0 0 5.69 KB
master StartStopWithChild net472 22.1μs 119ns 676ns 0.952 0.212 0 6.11 KB
#7565 StartStopWithChild net6.0 10.4μs 58.6ns 397ns 0 0 0 5.52 KB
#7565 StartStopWithChild netcoreapp3.1 13.8μs 65.6ns 278ns 0 0 0 5.68 KB
#7565 StartStopWithChild net472 21.6μs 114ns 614ns 0.871 0.218 0 6.03 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7565

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

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 927μs 173ns 624ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.05ms 599ns 2.32μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.18ms 71.7ns 268ns 0 0 0 3.31 KB
#7565 WriteAndFlushEnrichedTraces net6.0 918μs 193ns 722ns 0 0 0 2.71 KB
#7565 WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 72ns 249ns 0 0 0 2.7 KB
#7565 WriteAndFlushEnrichedTraces net472 1.24ms 186ns 718ns 0 0 0 3.35 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7565

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 1.243 353,006.25 438,702.31
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 1.238 346,702.55 429,329.02
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 1.237 506,944.43 627,228.93
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 1.201 462,276.12 555,174.18
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 1.196 471,800.69 564,246.74
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 1.168 504,606.52 589,575.72

More allocations ⚠️ in #7565

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 178.25 KB 295.07 KB 116.82 KB 65.53%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 181.77 KB 298.59 KB 116.81 KB 64.26%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 184.01 KB 300.82 KB 116.82 KB 63.48%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 187.44 KB 304.26 KB 116.82 KB 62.32%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 203.96 KB 322.21 KB 118.25 KB 57.98%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 207.5 KB 325.73 KB 118.23 KB 56.98%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 345μs 1.64μs 6.75μs 0 0 0 178.25 KB
master AllCycleSimpleBody netcoreapp3.1 505μs 1.46μs 5.66μs 0 0 0 184.01 KB
master AllCycleSimpleBody net472 462μs 84ns 314ns 31.2 0 0 203.96 KB
master AllCycleMoreComplexBody net6.0 353μs 1.01μs 3.76μs 0 0 0 181.77 KB
master AllCycleMoreComplexBody netcoreapp3.1 502μs 1.71μs 6.61μs 0 0 0 187.44 KB
master AllCycleMoreComplexBody net472 472μs 97.3ns 351ns 32.4 0 0 207.5 KB
master ObjectExtractorSimpleBody net6.0 325ns 0.203ns 0.784ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 388ns 2.21ns 15.2ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 308ns 0.0144ns 0.05ns 0.0445 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.39μs 31.1ns 136ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.77μs 35.6ns 138ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.75μs 1.81ns 6.79ns 0.573 0 0 3.8 KB
#7565 AllCycleSimpleBody net6.0 426μs 2.26μs 11.3μs 0 0 0 295.07 KB
#7565 AllCycleSimpleBody netcoreapp3.1 624μs 2.95μs 11.4μs 0 0 0 300.82 KB
#7565 AllCycleSimpleBody net472 555μs 123ns 462ns 48.9 2.72 0 322.21 KB
#7565 AllCycleMoreComplexBody net6.0 434μs 2.36μs 12.9μs 0 0 0 298.59 KB
#7565 AllCycleMoreComplexBody netcoreapp3.1 584μs 2.78μs 11.5μs 0 0 0 304.26 KB
#7565 AllCycleMoreComplexBody net472 565μs 282ns 1.06μs 51.6 2.72 0 325.73 KB
#7565 ObjectExtractorSimpleBody net6.0 313ns 1.79ns 12.4ns 0 0 0 280 B
#7565 ObjectExtractorSimpleBody netcoreapp3.1 397ns 2.17ns 12.8ns 0 0 0 272 B
#7565 ObjectExtractorSimpleBody net472 300ns 0.065ns 0.234ns 0.0438 0 0 281 B
#7565 ObjectExtractorMoreComplexBody net6.0 6.34μs 29.5ns 122ns 0 0 0 3.78 KB
#7565 ObjectExtractorMoreComplexBody netcoreapp3.1 7.69μs 33.9ns 131ns 0 0 0 3.69 KB
#7565 ObjectExtractorMoreComplexBody net472 6.7μs 4.27ns 16.5ns 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 78.7μs 87.4ns 327ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 98.3μs 231ns 896ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 13.2ns 49.4ns 4.9 0 0 32.51 KB
master EncodeLegacyArgs net6.0 147μs 193ns 749ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 198μs 183ns 709ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 265μs 109ns 423ns 0 0 0 2.16 KB
#7565 EncodeArgs net6.0 76.4μs 372ns 1.39μs 0 0 0 32.4 KB
#7565 EncodeArgs netcoreapp3.1 97.5μs 235ns 910ns 0 0 0 32.4 KB
#7565 EncodeArgs net472 109μs 12.1ns 46.7ns 4.91 0 0 32.51 KB
#7565 EncodeLegacyArgs net6.0 148μs 11.1ns 40ns 0 0 0 2.15 KB
#7565 EncodeLegacyArgs netcoreapp3.1 202μs 340ns 1.32μs 0 0 0 2.14 KB
#7565 EncodeLegacyArgs net472 263μs 20.8ns 80.6ns 0 0 0 2.17 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #7565

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.414 297,810.98 718,955.96

Faster 🎉 in #7565

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 1.404 874,284.38 622,717.34

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 409μs 147ns 510ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 819μs 11.4μs 113μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 434μs 80.3ns 311ns 0 0 0 4.68 KB
master RunWafRealisticBenchmarkWithAttack net6.0 296μs 62.9ns 244ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 298μs 224ns 866ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 312μs 56.3ns 218ns 0 0 0 2.29 KB
#7565 RunWafRealisticBenchmark net6.0 397μs 283ns 1.1μs 0 0 0 4.55 KB
#7565 RunWafRealisticBenchmark netcoreapp3.1 592μs 8.19μs 73.7μs 0 0 0 4.48 KB
#7565 RunWafRealisticBenchmark net472 429μs 44.1ns 165ns 0 0 0 4.66 KB
#7565 RunWafRealisticBenchmarkWithAttack net6.0 287μs 45.1ns 175ns 0 0 0 2.24 KB
#7565 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 677μs 12.7μs 124μs 0 0 0 2.22 KB
#7565 RunWafRealisticBenchmarkWithAttack net472 309μs 33.3ns 129ns 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μs 56.9ns 220ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 72.8μs 106ns 381ns 0 0 0 17.42 KB
master SendRequest net472 0.00389ns 0.0018ns 0.00698ns 0 0 0 0 b
#7565 SendRequest net6.0 61.9μs 49.3ns 184ns 0 0 0 14.52 KB
#7565 SendRequest netcoreapp3.1 71.3μs 167ns 627ns 0 0 0 17.42 KB
#7565 SendRequest net472 0.00256ns 0.00107ns 0.00402ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7565

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 1.139 1,512,556.25 1,327,905.21

More allocations ⚠️ in #7565

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 0 b 73 B 73 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 0 b 1 B 1 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 0 b 47 B 47 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 1 B 3 B 2 B 200.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 4 B 7 B 3 B 75.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.95ms 609ns 2.28μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.06ms 4.72μs 17.7μs 0 0 0 640 KB
master OriginalCharSlice net472 2.71ms 1.73μs 6.7μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.51ms 210ns 814ns 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.67ms 365ns 1.42μs 0 0 0 1 B
master OptimizedCharSlice net472 1.94ms 249ns 965ns 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 807μs 59.1ns 229ns 0 0 0 1 B
master OptimizedCharSliceWithPool netcoreapp3.1 835μs 151ns 586ns 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.2ms 197ns 738ns 0 0 0 0 b
#7565 OriginalCharSlice net6.0 1.9ms 5.9μs 22.1μs 0 0 0 640.01 KB
#7565 OriginalCharSlice netcoreapp3.1 2.16ms 3.9μs 15.1μs 0 0 0 640 KB
#7565 OriginalCharSlice net472 2.74ms 394ns 1.47μs 100 0 0 641.95 KB
#7565 OptimizedCharSlice net6.0 1.33ms 70.9ns 275ns 0 0 0 7 B
#7565 OptimizedCharSlice netcoreapp3.1 1.78ms 635ns 2.46μs 0 0 0 1 B
#7565 OptimizedCharSlice net472 1.97ms 248ns 961ns 0 0 0 73 B
#7565 OptimizedCharSliceWithPool net6.0 877μs 40.7ns 158ns 0 0 0 3 B
#7565 OptimizedCharSliceWithPool netcoreapp3.1 902μs 112ns 435ns 0 0 0 1 B
#7565 OptimizedCharSliceWithPool net472 1.16ms 108ns 418ns 0 0 0 47 B
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7565

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 1.123 984,761.30 877,257.50

More allocations ⚠️ in #7565

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.82 KB 42.72 KB 905 B 2.16%

Fewer allocations 🎉 in #7565

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 42.29 KB 41.81 KB -482 B -1.14%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 695μs 4.01μs 33.8μs 0 0 0 41.82 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 759μs 4.01μs 20.4μs 0 0 0 42.29 KB
master WriteAndFlushEnrichedTraces net472 987μs 3.03μs 11.3μs 4.81 0 0 55.97 KB
#7565 WriteAndFlushEnrichedTraces net6.0 738μs 2.59μs 10μs 0 0 0 42.72 KB
#7565 WriteAndFlushEnrichedTraces netcoreapp3.1 688μs 423ns 1.46μs 0 0 0 41.81 KB
#7565 WriteAndFlushEnrichedTraces net472 875μs 1.72μs 6.22μs 8.33 0 0 56.12 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.92μs 9.49ns 39.1ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.57μs 11.6ns 44.8ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.77μs 5.69ns 21.3ns 0.15 0.0136 0 987 B
#7565 ExecuteNonQuery net6.0 1.94μs 7.24ns 28.1ns 0 0 0 1.02 KB
#7565 ExecuteNonQuery netcoreapp3.1 2.66μs 8.97ns 34.7ns 0 0 0 1.02 KB
#7565 ExecuteNonQuery net472 2.97μs 4.98ns 19.3ns 0.147 0.0147 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.75μs 7.58ns 36.4ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.32μs 11.3ns 46.7ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.5μs 4ns 15.5ns 0.158 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.84μs 6.28ns 24.3ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.43μs 8.84ns 34.2ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.88μs 3.58ns 13.4ns 0.173 0 0 1.1 KB
#7565 CallElasticsearch net6.0 1.77μs 4.78ns 18.5ns 0 0 0 1.03 KB
#7565 CallElasticsearch netcoreapp3.1 2.29μs 10.8ns 44.7ns 0 0 0 1.03 KB
#7565 CallElasticsearch net472 3.62μs 5.14ns 19.9ns 0.164 0 0 1.04 KB
#7565 CallElasticsearchAsync net6.0 1.84μs 2.88ns 11.2ns 0 0 0 1.01 KB
#7565 CallElasticsearchAsync netcoreapp3.1 2.45μs 11.9ns 49.1ns 0 0 0 1.08 KB
#7565 CallElasticsearchAsync net472 3.9μs 5.24ns 20.3ns 0.156 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 2.01μs 8.69ns 33.6ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.33μs 9.79ns 35.3ns 0 0 0 952 B
master ExecuteAsync net472 2.52μs 7.62ns 29.5ns 0.141 0 0 915 B
#7565 ExecuteAsync net6.0 1.91μs 7.37ns 27.6ns 0 0 0 952 B
#7565 ExecuteAsync netcoreapp3.1 2.34μs 6.9ns 25.8ns 0 0 0 952 B
#7565 ExecuteAsync net472 2.61μs 2.4ns 9.28ns 0.144 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.98μs 5.84ns 20.2ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.65μs 24.5ns 91.5ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 12.9ns 50.1ns 0.493 0 0 3.18 KB
#7565 SendAsync net6.0 6.92μs 13ns 50.4ns 0 0 0 2.36 KB
#7565 SendAsync netcoreapp3.1 8.26μs 27.4ns 102ns 0 0 0 2.9 KB
#7565 SendAsync net472 11.8μs 10.3ns 39.7ns 0.468 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7565

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 1.194 553,600.00 463,500.00

More allocations ⚠️ in #7565

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.StringConcatAspectBenchmark‑netcoreapp3.1 248.67 KB 258.63 KB 9.96 KB 4.01%

Fewer allocations 🎉 in #7565

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 44.9 KB 44.04 KB -856 B -1.91%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 51.7μs 809ns 8μs 0 0 0 44.9 KB
master StringConcatBenchmark netcoreapp3.1 50.4μs 444ns 4.28μs 0 0 0 42.78 KB
master StringConcatBenchmark net472 57.4μs 281ns 1.16μs 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 555μs 2.58μs 9.65μs 0 0 0 277.88 KB
master StringConcatAspectBenchmark netcoreapp3.1 523μs 2.44μs 9.11μs 0 0 0 248.67 KB
master StringConcatAspectBenchmark net472 404μs 2.29μs 16.8μs 0 0 0 278.53 KB
#7565 StringConcatBenchmark net6.0 41.3μs 189ns 732ns 0 0 0 44.04 KB
#7565 StringConcatBenchmark netcoreapp3.1 49.6μs 256ns 1.17μs 0 0 0 42.64 KB
#7565 StringConcatBenchmark net472 56.5μs 181ns 678ns 0 0 0 65.54 KB
#7565 StringConcatAspectBenchmark net6.0 467μs 2.25μs 8.72μs 0 0 0 277.26 KB
#7565 StringConcatAspectBenchmark netcoreapp3.1 515μs 1.86μs 7.22μs 0 0 0 258.63 KB
#7565 StringConcatAspectBenchmark net472 396μs 2.06μs 14.9μ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.48μs 8.94ns 34.6ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.58μs 12.9ns 50.1ns 0 0 0 1.7 KB
master EnrichedLog net472 3.78μs 6.93ns 26.9ns 0.246 0 0 1.64 KB
#7565 EnrichedLog net6.0 2.59μs 0.73ns 2.63ns 0 0 0 1.7 KB
#7565 EnrichedLog netcoreapp3.1 3.52μs 12.3ns 47.6ns 0 0 0 1.7 KB
#7565 EnrichedLog net472 3.72μs 2.15ns 8.34ns 0.243 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 125μs 546ns 2.5μs 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 133ns 498ns 0 0 0 4.31 KB
master EnrichedLog net472 167μs 105ns 405ns 0 0 0 4.52 KB
#7565 EnrichedLog net6.0 122μs 123ns 476ns 0 0 0 4.31 KB
#7565 EnrichedLog netcoreapp3.1 127μs 101ns 351ns 0 0 0 4.31 KB
#7565 EnrichedLog net472 168μs 63.8ns 247ns 0 0 0 4.52 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.98μs 10.8ns 41.6ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.8μs 13.1ns 50.6ns 0 0 0 2.26 KB
master EnrichedLog net472 7.26μs 5.4ns 20.9ns 0.325 0 0 2.08 KB
#7565 EnrichedLog net6.0 5.04μs 8.93ns 34.6ns 0 0 0 2.26 KB
#7565 EnrichedLog netcoreapp3.1 6.64μs 18.5ns 71.7ns 0 0 0 2.26 KB
#7565 EnrichedLog net472 7.36μs 6.7ns 26ns 0.329 0 0 2.08 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.94μs 10.1ns 50.5ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.86μs 7.7ns 29.8ns 0 0 0 1.2 KB
master SendReceive net472 3.05μs 4.77ns 18.5ns 0.186 0 0 1.2 KB
#7565 SendReceive net6.0 2.04μs 10.7ns 53.6ns 0 0 0 1.2 KB
#7565 SendReceive netcoreapp3.1 2.66μs 13.1ns 55.5ns 0 0 0 1.2 KB
#7565 SendReceive net472 3.13μs 5.53ns 21.4ns 0.189 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.16μs 17.2ns 61.9ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.47μs 12.8ns 49.6ns 0 0 0 1.63 KB
master EnrichedLog net472 6.43μs 4.53ns 16.3ns 0.322 0 0 2.03 KB
#7565 EnrichedLog net6.0 4.25μs 12ns 46.6ns 0 0 0 1.58 KB
#7565 EnrichedLog netcoreapp3.1 5.4μs 8.99ns 34.8ns 0 0 0 1.63 KB
#7565 EnrichedLog net472 6.39μs 5.08ns 19.7ns 0.319 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 742ns 3.39ns 13.6ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 919ns 0.601ns 2.33ns 0 0 0 576 B
master StartFinishSpan net472 891ns 0.563ns 2.18ns 0.0895 0 0 578 B
master StartFinishScope net6.0 878ns 4.86ns 24.8ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.14μs 6.1ns 32.3ns 0 0 0 696 B
master StartFinishScope net472 1.11μs 1.53ns 5.92ns 0.0995 0 0 658 B
#7565 StartFinishSpan net6.0 746ns 3.66ns 15.1ns 0 0 0 576 B
#7565 StartFinishSpan netcoreapp3.1 932ns 4.62ns 20.1ns 0 0 0 576 B
#7565 StartFinishSpan net472 911ns 0.289ns 1.08ns 0.0878 0 0 578 B
#7565 StartFinishScope net6.0 875ns 4.64ns 25ns 0 0 0 696 B
#7565 StartFinishScope netcoreapp3.1 1.1μs 5.78ns 27.7ns 0 0 0 696 B
#7565 StartFinishScope net472 1.11μs 0.502ns 1.81ns 0.0998 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.03μs 5.57ns 31ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.45μs 6.05ns 23.4ns 0 0 0 696 B
master RunOnMethodBegin net472 1.44μs 0.394ns 1.42ns 0.101 0 0 658 B
#7565 RunOnMethodBegin net6.0 1.04μs 1.61ns 6.24ns 0 0 0 696 B
#7565 RunOnMethodBegin netcoreapp3.1 1.35μs 6.71ns 29.2ns 0 0 0 696 B
#7565 RunOnMethodBegin net472 1.43μs 0.654ns 2.53ns 0.1 0 0 658 B

@anna-git anna-git force-pushed the anna/config-inversion-check-configurationkeys-are-in-json branch from b202c12 to 1f81c8c Compare October 10, 2025 11:32
@anna-git anna-git force-pushed the anna/config-inversion-aliases-handling branch from fb0cab6 to f138ce6 Compare October 10, 2025 11:32
@anna-git anna-git changed the title [Config inversion] aliases handling [Config registry] aliases handling Oct 10, 2025
@anna-git anna-git marked this pull request as ready for review October 10, 2025 14:03
@anna-git anna-git requested review from a team as code owners October 10, 2025 14:03
@anna-git anna-git requested review from zacharycmontoya and removed request for a team October 10, 2025 14:03
@anna-git anna-git marked this pull request as draft October 13, 2025 22:37
@anna-git anna-git closed this Oct 22, 2025
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.

2 participants