dd-trace-dotnet icon indicating copy to clipboard operation
dd-trace-dotnet copied to clipboard

Refactor NLogTests to use combinatorial parameters

Open bouwkast opened this issue 8 months ago • 4 comments

Summary of changes

This refactors the NLogTests to use combinatorial parameters and attempts to clean them up.

Unfortunately I struggled making this concise and ran into a ton of issues / test failures as there are multiple versions of NLog that have different behaviors specifically for logs injection. Some of which I think may be bugs in the actual integration, but I'm not 100% sure.

Maybe a harder split between logs injection and direct log submission is needed here as it is now a mess of various tests.

Reason for change

Original tests seemed pretty convoluted so I attempted to fix that

Implementation details

Test coverage

Other details

bouwkast avatar Apr 17 '25 13:04 bouwkast

Datadog Report

All test runs bc5a2c4 :link:

:x: 2 Total Test Services: 1 Failed, 1 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Test Service View
dd-trace-dotnet 18 0 0 243979 2399 15h 25m 26.69s Link
exploration_tests 0 0 0 22085 3 2m 15.58s Link

:x: Failed Tests (18)

This report shows up to 5 failed tests.

  • InjectsLogsWhenEnabled_V4 - Datadog.Trace.ClrProfiler.IntegrationTests.NLogTests - Details

    Expand for error
    xpected exit code: 0, actual exit code: -10.
    
  • InjectsLogsWhenEnabled_V4 - Datadog.Trace.ClrProfiler.IntegrationTests.NLogTests - Details

    Expand for error
    xpected exit code: 0, actual exit code: -10.
    
  • InjectsLogsWhenEnabled_V4 - Datadog.Trace.ClrProfiler.IntegrationTests.NLogTests - Details

    Expand for error
    xpected exit code: 0, actual exit code: -10.
    
  • InjectsLogsWhenEnabled_V4 - Datadog.Trace.ClrProfiler.IntegrationTests.NLogTests - Details

    Expand for error
    xpected exit code: 0, actual exit code: -10.
    
  • InjectsLogsWhenEnabled_V4 - Datadog.Trace.ClrProfiler.IntegrationTests.NLogTests - Details

    Expand for error
    xpected exit code: 0, actual exit code: 255.
    

Benchmarks Report for tracer :snail:

Benchmarks for #6871 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.136
  • All benchmarks have the same 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 :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.74μs 90.1ns 896ns 0 0 0 5.57 KB
master StartStopWithChild netcoreapp3.1 10.1μs 148ns 1.48μs 0 0 0 5.73 KB
master StartStopWithChild net472 15.3μs 87.8ns 697ns 1.04 0.297 0.0741 6.13 KB
#6871 StartStopWithChild net6.0 8.05μs 94.4ns 944ns 0 0 0 5.58 KB
#6871 StartStopWithChild netcoreapp3.1 10.3μs 115ns 1.15μs 0 0 0 5.75 KB
#6871 StartStopWithChild net472 15.7μs 85.1ns 571ns 1.04 0.37 0.0741 6.16 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 513μs 5.69μs 50.6μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 664μs 854ns 3.19μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 841μs 2.7μs 10.1μs 0 0 0 3.31 KB
#6871 WriteAndFlushEnrichedTraces net6.0 513μs 2.19μs 8.2μs 0 0 0 2.7 KB
#6871 WriteAndFlushEnrichedTraces netcoreapp3.1 671μs 1.47μs 5.5μs 0 0 0 2.7 KB
#6871 WriteAndFlushEnrichedTraces net472 853μs 828ns 2.99μs 0 0 0 3.31 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 127μs 626ns 2.66μs 0 0 0 14.48 KB
master SendRequest netcoreapp3.1 141μs 821ns 7.15μs 0 0 0 17.28 KB
master SendRequest net472 0.00158ns 0.000518ns 0.00201ns 0 0 0 0 b
#6871 SendRequest net6.0 127μs 667ns 5.12μs 0 0 0 14.48 KB
#6871 SendRequest netcoreapp3.1 145μs 771ns 3.93μs 0 0 0 17.28 KB
#6871 SendRequest net472 0.00134ns 0.000693ns 0.00259ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 653μs 7.16μs 70.9μs 0 0 0 41.81 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 745μs 8.26μs 80.5μs 0 0 0 41.86 KB
master WriteAndFlushEnrichedTraces net472 871μs 4.95μs 46.7μs 7.35 3.68 0 53.37 KB
#6871 WriteAndFlushEnrichedTraces net6.0 556μs 3.08μs 20.2μs 0 0 0 41.64 KB
#6871 WriteAndFlushEnrichedTraces netcoreapp3.1 706μs 5.44μs 53.6μs 0 0 0 41.77 KB
#6871 WriteAndFlushEnrichedTraces net472 888μs 5.19μs 47.8μs 8.33 4.17 0 53.39 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.3μs 3.03ns 11.3ns 0.0129 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 1.78μs 3.2ns 11.1ns 0.00901 0 0 1.02 KB
master ExecuteNonQuery net472 2.15μs 1.56ns 5.83ns 0.153 0.0109 0 995 B
#6871 ExecuteNonQuery net6.0 1.27μs 3.03ns 11.3ns 0.0127 0 0 1.03 KB
#6871 ExecuteNonQuery netcoreapp3.1 1.76μs 4.41ns 16.5ns 0.00879 0 0 1.02 KB
#6871 ExecuteNonQuery net472 2.12μs 2.9ns 11.2ns 0.15 0.0107 0 995 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.32μs 1.17ns 4.53ns 0.0133 0 0 984 B
master CallElasticsearch netcoreapp3.1 1.6μs 1.34ns 4.83ns 0.00809 0 0 984 B
master CallElasticsearch net472 2.58μs 1.38ns 4.98ns 0.154 0 0 1 KB
master CallElasticsearchAsync net6.0 1.28μs 1.58ns 6.13ns 0.0126 0 0 960 B
master CallElasticsearchAsync netcoreapp3.1 1.73μs 1.34ns 5.17ns 0.00864 0 0 1.03 KB
master CallElasticsearchAsync net472 2.6μs 1.17ns 4.53ns 0.156 0 0 1.06 KB
#6871 CallElasticsearch net6.0 1.27μs 1.02ns 3.53ns 0.0127 0 0 984 B
#6871 CallElasticsearch netcoreapp3.1 1.53μs 2.56ns 9.59ns 0.00764 0 0 984 B
#6871 CallElasticsearch net472 2.48μs 0.785ns 2.83ns 0.15 0 0 1 KB
#6871 CallElasticsearchAsync net6.0 1.28μs 2.68ns 9.66ns 0.013 0 0 960 B
#6871 CallElasticsearchAsync netcoreapp3.1 1.72μs 3.32ns 12.4ns 0.00867 0 0 1.03 KB
#6871 CallElasticsearchAsync net472 2.66μs 1.57ns 5.86ns 0.16 0 0 1.06 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.35μs 0.862ns 3.23ns 0.0135 0 0 960 B
master ExecuteAsync netcoreapp3.1 1.62μs 1.7ns 6.12ns 0.00819 0 0 960 B
master ExecuteAsync net472 1.81μs 0.999ns 3.74ns 0.145 0 0 923 B
#6871 ExecuteAsync net6.0 1.37μs 1.45ns 5.61ns 0.0136 0 0 960 B
#6871 ExecuteAsync netcoreapp3.1 1.65μs 1.93ns 7.46ns 0.00829 0 0 960 B
#6871 ExecuteAsync net472 1.84μs 0.994ns 3.85ns 0.138 0 0 923 B
Benchmarks.Trace.HttpClientBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.4μs 1.76ns 6.09ns 0.0221 0 0 2.32 KB
master SendAsync netcoreapp3.1 5.29μs 9.69ns 37.5ns 0.0263 0 0 2.86 KB
master SendAsync net472 7.45μs 5.2ns 19.5ns 0.49 0 0 3.13 KB
#6871 SendAsync net6.0 4.3μs 2.21ns 8.56ns 0.0215 0 0 2.32 KB
#6871 SendAsync netcoreapp3.1 5.2μs 2.64ns 9.87ns 0.026 0 0 2.86 KB
#6871 SendAsync net472 7.53μs 3.32ns 12ns 0.489 0 0 3.13 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.68μs 1.82ns 7.07ns 0.0168 0 0 1.71 KB
master EnrichedLog netcoreapp3.1 2.34μs 1.83ns 7.09ns 0.0118 0 0 1.71 KB
master EnrichedLog net472 2.65μs 1.81ns 7.02ns 0.25 0 0 1.64 KB
#6871 EnrichedLog net6.0 1.59μs 1.94ns 7.53ns 0.0236 0 0 1.71 KB
#6871 EnrichedLog netcoreapp3.1 2.26μs 2.54ns 9.85ns 0.0225 0 0 1.71 KB
#6871 EnrichedLog net472 2.52μs 1.84ns 7.12ns 0.25 0 0 1.64 KB
Benchmarks.Trace.Log4netBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 112μs 295ns 1.14μs 0 0 0 4.32 KB
master EnrichedLog netcoreapp3.1 115μs 424ns 1.64μs 0 0 0 4.32 KB
master EnrichedLog net472 149μs 226ns 876ns 0 0 0 4.51 KB
#6871 EnrichedLog net6.0 111μs 151ns 546ns 0 0 0 4.32 KB
#6871 EnrichedLog netcoreapp3.1 117μs 390ns 1.46μs 0 0 0 4.32 KB
#6871 EnrichedLog net472 150μs 187ns 724ns 0 0 0 4.51 KB
Benchmarks.Trace.NLogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.26μs 2.4ns 9.29ns 0.0331 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 4.27μs 5.13ns 19.9ns 0.0214 0 0 2.26 KB
master EnrichedLog net472 4.89μs 3.09ns 12ns 0.318 0 0 2.09 KB
#6871 EnrichedLog net6.0 2.99μs 3.8ns 14.2ns 0.0298 0 0 2.26 KB
#6871 EnrichedLog netcoreapp3.1 4.26μs 2.89ns 10.8ns 0.0213 0 0 2.26 KB
#6871 EnrichedLog net472 5.08μs 2.79ns 10.8ns 0.331 0 0 2.09 KB
Benchmarks.Trace.RedisBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.37μs 1.14ns 4.41ns 0.0138 0 0 1.15 KB
master SendReceive netcoreapp3.1 1.8μs 1.13ns 4.22ns 0.00907 0 0 1.15 KB
master SendReceive net472 2.16μs 1.57ns 6.06ns 0.179 0 0 1.16 KB
#6871 SendReceive net6.0 1.44μs 1.11ns 4.14ns 0.0144 0 0 1.15 KB
#6871 SendReceive netcoreapp3.1 1.83μs 1.89ns 6.82ns 0.00913 0 0 1.15 KB
#6871 SendReceive net472 2.04μs 1.06ns 3.96ns 0.182 0 0 1.16 KB
Benchmarks.Trace.SerilogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.83μs 1.73ns 6.69ns 0.0142 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 3.9μs 2.18ns 7.85ns 0.0194 0 0 1.69 KB
master EnrichedLog net472 4.46μs 2.75ns 10.6ns 0.313 0 0 2.08 KB
#6871 EnrichedLog net6.0 2.83μs 2.74ns 10.6ns 0.014 0 0 1.64 KB
#6871 EnrichedLog netcoreapp3.1 3.95μs 1.52ns 5.48ns 0.0198 0 0 1.69 KB
#6871 EnrichedLog net472 4.41μs 2.26ns 8.44ns 0.309 0 0 2.08 KB
Benchmarks.Trace.SpanBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6871

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 1.144 751.46 657.02

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 412ns 0.354ns 1.32ns 0.00815 0 0 584 B
master StartFinishSpan netcoreapp3.1 582ns 0.765ns 2.96ns 0.00573 0 0 584 B
master StartFinishSpan net472 658ns 0.658ns 2.37ns 0.0922 0 0 586 B
master StartFinishScope net6.0 492ns 0.316ns 1.18ns 0.00975 0 0 704 B
master StartFinishScope netcoreapp3.1 752ns 0.69ns 2.58ns 0.00755 0 0 704 B
master StartFinishScope net472 838ns 0.778ns 3.01ns 0.105 0 0 666 B
#6871 StartFinishSpan net6.0 395ns 0.685ns 2.65ns 0.00789 0 0 584 B
#6871 StartFinishSpan netcoreapp3.1 623ns 1.05ns 3.94ns 0.00633 0 0 584 B
#6871 StartFinishSpan net472 593ns 0.275ns 1.03ns 0.092 0 0 586 B
#6871 StartFinishScope net6.0 485ns 0.214ns 0.801ns 0.00974 0 0 704 B
#6871 StartFinishScope netcoreapp3.1 658ns 0.711ns 2.66ns 0.00657 0 0 704 B
#6871 StartFinishScope net472 829ns 0.695ns 2.6ns 0.106 0 0 666 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6871

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 1.128 1,139.13 1,009.71

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 597ns 0.475ns 1.84ns 0.00901 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 1μs 1.28ns 4.78ns 0.00501 0 0 704 B
master RunOnMethodBegin net472 1.14μs 1.45ns 5.62ns 0.102 0 0 666 B
#6871 RunOnMethodBegin net6.0 626ns 0.38ns 1.47ns 0.00937 0 0 704 B
#6871 RunOnMethodBegin netcoreapp3.1 935ns 1.06ns 4.1ns 0.00945 0 0 704 B
#6871 RunOnMethodBegin net472 1.01μs 0.346ns 1.34ns 0.106 0 0 666 B

andrewlock avatar Apr 17 '25 14:04 andrewlock

Execution-Time Benchmarks Report :stopwatch:

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 Baseline
    This PR (6871) - mean (68ms)  : 65, 72
     .   : milestone, 68,
    master - mean (69ms)  : 63, 74
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6871) - mean (1,009ms)  : 982, 1036
     .   : milestone, 1009,
    master - mean (1,009ms)  : 986, 1033
     .   : milestone, 1009,

gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6871) - mean (102ms)  : 100, 105
     .   : milestone, 102,
    master - mean (103ms)  : 100, 105
     .   : milestone, 103,

    section CallTarget+Inlining+NGEN
    This PR (6871) - mean (693ms)  : 674, 713
     .   : milestone, 693,
    master - mean (698ms)  : 682, 713
     .   : milestone, 698,

gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6871) - mean (89ms)  : 87, 92
     .   : milestone, 89,
    master - mean (89ms)  : 87, 91
     .   : milestone, 89,

    section CallTarget+Inlining+NGEN
    This PR (6871) - mean (651ms)  : 628, 675
     .   : milestone, 651,
    master - mean (656ms)  : 633, 678
     .   : milestone, 656,

gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6871) - mean (190ms)  : 184, 196
     .   : milestone, 190,
    master - mean (190ms)  : 181, 200
     .   : milestone, 190,

    section CallTarget+Inlining+NGEN
    This PR (6871) - mean (1,111ms)  : 1083, 1139
     .   : milestone, 1111,
    master - mean (1,111ms)  : 1079, 1142
     .   : milestone, 1111,

gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6871) - mean (269ms)  : 264, 274
     .   : milestone, 269,
    master - mean (268ms)  : 265, 271
     .   : milestone, 268,

    section CallTarget+Inlining+NGEN
    This PR (6871) - mean (878ms)  : 846, 910
     .   : milestone, 878,
    master - mean (879ms)  : 851, 907
     .   : milestone, 879,

gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6871) - mean (262ms)  : 258, 265
     .   : milestone, 262,
    master - mean (261ms)  : 257, 264
     .   : milestone, 261,

    section CallTarget+Inlining+NGEN
    This PR (6871) - mean (865ms)  : 839, 892
     .   : milestone, 865,
    master - mean (869ms)  : 834, 904
     .   : milestone, 869,

andrewlock avatar Apr 17 '25 14:04 andrewlock

Benchmarks

Benchmarks Report for benchmark platform :snail:

Benchmarks for #6871 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.132
  • 6 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 :heavy_check_mark: Fewer allocations :tada:

Fewer allocations :tada: in #6871

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.2 KB 6.1 KB -100 B -1.61%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.6μs 41.6ns 161ns 0 0 0 5.54 KB
master StartStopWithChild netcoreapp3.1 13.7μs 68.3ns 290ns 0 0 0 5.74 KB
master StartStopWithChild net472 22.4μs 115ns 515ns 0.965 0.214 0 6.2 KB
#6871 StartStopWithChild net6.0 10.5μs 57.4ns 344ns 0 0 0 5.53 KB
#6871 StartStopWithChild netcoreapp3.1 13.5μs 67.7ns 295ns 0 0 0 5.75 KB
#6871 StartStopWithChild net472 22μs 113ns 687ns 1 0.334 0.111 6.1 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 942μs 54.9ns 213ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.05ms 111ns 416ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.24ms 591ns 2.13μs 0 0 0 3.31 KB
#6871 WriteAndFlushEnrichedTraces net6.0 924μs 240ns 929ns 0 0 0 2.7 KB
#6871 WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 116ns 403ns 0 0 0 2.7 KB
#6871 WriteAndFlushEnrichedTraces net472 1.24ms 88.8ns 344ns 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 337μs 1.65μs 7.4μs 0 0 0 197.06 KB
master AllCycleSimpleBody netcoreapp3.1 482μs 298ns 1.16μs 0 0 0 204.77 KB
master AllCycleSimpleBody net472 436μs 116ns 435ns 36.6 2.16 0 236.35 KB
master AllCycleMoreComplexBody net6.0 339μs 1.76μs 8.97μs 0 0 0 200.56 KB
master AllCycleMoreComplexBody netcoreapp3.1 514μs 1.45μs 5.03μs 0 0 0 208.18 KB
master AllCycleMoreComplexBody net472 453μs 423ns 1.64μs 37.9 2.23 0 239.88 KB
master ObjectExtractorSimpleBody net6.0 317ns 1.52ns 6.44ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 396ns 1.94ns 8.24ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 317ns 0.0377ns 0.141ns 0.0435 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.34μs 13ns 50.2ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.83μs 9.78ns 37.9ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.7μs 2.96ns 11.1ns 0.57 0 0 3.8 KB
#6871 AllCycleSimpleBody net6.0 333μs 1.45μs 5.63μs 0 0 0 197.06 KB
#6871 AllCycleSimpleBody netcoreapp3.1 488μs 2.31μs 9.78μs 0 0 0 204.77 KB
#6871 AllCycleSimpleBody net472 442μs 95.2ns 356ns 36.6 2.16 0 236.35 KB
#6871 AllCycleMoreComplexBody net6.0 333μs 1.73μs 8.12μs 0 0 0 200.56 KB
#6871 AllCycleMoreComplexBody netcoreapp3.1 509μs 1.47μs 5.71μs 0 0 0 208.18 KB
#6871 AllCycleMoreComplexBody net472 447μs 171ns 664ns 37.9 2.23 0 239.88 KB
#6871 ObjectExtractorSimpleBody net6.0 311ns 1.77ns 11.3ns 0 0 0 280 B
#6871 ObjectExtractorSimpleBody netcoreapp3.1 403ns 2.21ns 12.9ns 0 0 0 272 B
#6871 ObjectExtractorSimpleBody net472 303ns 0.0657ns 0.255ns 0.0443 0 0 281 B
#6871 ObjectExtractorMoreComplexBody net6.0 6.36μs 1.52ns 5.9ns 0 0 0 3.78 KB
#6871 ObjectExtractorMoreComplexBody netcoreapp3.1 7.66μs 39.4ns 181ns 0 0 0 3.69 KB
#6871 ObjectExtractorMoreComplexBody net472 6.66μs 3.09ns 11.6ns 0.602 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Unknown :shrug: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
master EncodeArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master EncodeArgs net472 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs net472 N/A N/A N/A NaN NaN NaN 0 b
#6871 EncodeArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6871 EncodeArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6871 EncodeArgs net472 N/A N/A N/A NaN NaN NaN 0 b
#6871 EncodeLegacyArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6871 EncodeLegacyArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6871 EncodeLegacyArgs net472 N/A N/A N/A NaN NaN NaN 0 b
Benchmarks.Trace.Asm.AppSecWafBenchmark - Unknown :shrug: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmark netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmark net472 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack net472 N/A N/A N/A NaN NaN NaN 0 b
#6871 RunWafRealisticBenchmark net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6871 RunWafRealisticBenchmark netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6871 RunWafRealisticBenchmark net472 N/A N/A N/A NaN NaN NaN 0 b
#6871 RunWafRealisticBenchmarkWithAttack net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6871 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6871 RunWafRealisticBenchmarkWithAttack net472 N/A N/A N/A NaN NaN NaN 0 b
Benchmarks.Trace.AspNetCoreBenchmark - Same speed :heavy_check_mark: More allocations :warning:

More allocations :warning: in #6871

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AspNetCoreBenchmark.SendRequest‑net6.0 14.53 KB 14.69 KB 164 B 1.13%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 61.3μs 56.1ns 202ns 0 0 0 14.53 KB
master SendRequest netcoreapp3.1 72.8μs 218ns 843ns 0 0 0 17.42 KB
master SendRequest net472 0.00247ns 0.00122ns 0.00471ns 0 0 0 0 b
#6871 SendRequest net6.0 61.1μs 76.3ns 285ns 0 0 0 14.69 KB
#6871 SendRequest netcoreapp3.1 69.9μs 121ns 435ns 0 0 0 17.43 KB
#6871 SendRequest net472 0.0332ns 0.00147ns 0.0057ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower :warning: Fewer allocations :tada:

Slower :warning: in #6871

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.132 630,439.52 713,579.09

Fewer allocations :tada: in #6871

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.39 KB 55.39 KB -998 B -1.77%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 659μs 977ns 3.52μs 0 0 0 41.62 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 630μs 2.64μs 16.7μs 0 0 0 41.94 KB
master WriteAndFlushEnrichedTraces net472 931μs 5.41μs 51.4μs 8.33 0 0 56.39 KB
#6871 WriteAndFlushEnrichedTraces net6.0 649μs 819ns 3.17μs 0 0 0 41.66 KB
#6871 WriteAndFlushEnrichedTraces netcoreapp3.1 708μs 3.7μs 17.3μs 0 0 0 41.97 KB
#6871 WriteAndFlushEnrichedTraces net472 926μs 3.96μs 15.4μs 4.46 0 0 55.39 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.91μs 1.8ns 6.98ns 0 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 2.48μs 8.2ns 31.8ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.66μs 2.64ns 10.2ns 0.147 0.0134 0 995 B
#6871 ExecuteNonQuery net6.0 1.93μs 0.698ns 2.7ns 0 0 0 1.03 KB
#6871 ExecuteNonQuery netcoreapp3.1 2.42μs 9.09ns 34ns 0 0 0 1.02 KB
#6871 ExecuteNonQuery net472 2.74μs 3.25ns 12.6ns 0.149 0.0136 0 995 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.83μs 3.19ns 12.4ns 0 0 0 1.04 KB
master CallElasticsearch netcoreapp3.1 2.3μs 1.21ns 4.18ns 0 0 0 1.04 KB
master CallElasticsearch net472 3.47μs 1.22ns 4.57ns 0.157 0 0 1.05 KB
master CallElasticsearchAsync net6.0 1.8μs 8.7ns 37.9ns 0 0 0 1.02 KB
master CallElasticsearchAsync netcoreapp3.1 2.37μs 7.86ns 30.4ns 0 0 0 1.09 KB
master CallElasticsearchAsync net472 3.75μs 5.59ns 21.6ns 0.171 0 0 1.11 KB
#6871 CallElasticsearch net6.0 1.74μs 6.94ns 24.1ns 0 0 0 1.04 KB
#6871 CallElasticsearch netcoreapp3.1 2.29μs 10.7ns 42.8ns 0 0 0 1.04 KB
#6871 CallElasticsearch net472 3.5μs 3.75ns 14.5ns 0.157 0 0 1.05 KB
#6871 CallElasticsearchAsync net6.0 1.87μs 7.86ns 30.4ns 0 0 0 1.02 KB
#6871 CallElasticsearchAsync netcoreapp3.1 2.4μs 8.67ns 31.3ns 0 0 0 1.09 KB
#6871 CallElasticsearchAsync net472 3.68μs 2.5ns 9.68ns 0.165 0 0 1.11 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.81μs 2.3ns 8.9ns 0 0 0 960 B
master ExecuteAsync netcoreapp3.1 2.34μs 1.34ns 5ns 0 0 0 960 B
master ExecuteAsync net472 2.53μs 1.21ns 4.67ns 0.138 0 0 923 B
#6871 ExecuteAsync net6.0 1.81μs 8.44ns 32.7ns 0 0 0 960 B
#6871 ExecuteAsync netcoreapp3.1 2.25μs 10.3ns 39.8ns 0 0 0 960 B
#6871 ExecuteAsync net472 2.68μs 1.5ns 5.8ns 0.134 0 0 923 B
Benchmarks.Trace.HttpClientBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 6.98μs 4.32ns 16.7ns 0 0 0 2.37 KB
master SendAsync netcoreapp3.1 8.54μs 28.8ns 111ns 0 0 0 2.9 KB
master SendAsync net472 12.1μs 12.3ns 47.6ns 0.484 0 0 3.19 KB
#6871 SendAsync net6.0 6.99μs 15ns 58ns 0 0 0 2.37 KB
#6871 SendAsync netcoreapp3.1 8.13μs 14ns 54.3ns 0 0 0 2.9 KB
#6871 SendAsync net472 12.1μs 12.7ns 49.2ns 0.482 0 0 3.19 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed :heavy_check_mark: Fewer allocations :tada:

Fewer allocations :tada: in #6871

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 274.47 KB 272.51 KB -1.96 KB -0.71%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.78 KB 43.44 KB -336 B -0.77%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 274.01 KB 260.76 KB -13.25 KB -4.83%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 65.54 KB 57.34 KB -8.19 KB -12.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 42.4μs 207ns 830ns 0 0 0 43.78 KB
master StringConcatBenchmark netcoreapp3.1 49.9μs 292ns 2.36μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 57.3μs 153ns 574ns 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 501μs 2.44μs 10.6μs 0 0 0 274.01 KB
master StringConcatAspectBenchmark netcoreapp3.1 514μs 2.31μs 9.8μs 0 0 0 274.47 KB
master StringConcatAspectBenchmark net472 409μs 1.93μs 7.74μs 0 0 0 286.72 KB
#6871 StringConcatBenchmark net6.0 41.3μs 208ns 975ns 0 0 0 43.44 KB
#6871 StringConcatBenchmark netcoreapp3.1 48.1μs 232ns 927ns 0 0 0 42.64 KB
#6871 StringConcatBenchmark net472 57.5μs 228ns 884ns 0 0 0 57.34 KB
#6871 StringConcatAspectBenchmark net6.0 475μs 1.6μs 6μs 0 0 0 260.76 KB
#6871 StringConcatAspectBenchmark netcoreapp3.1 518μs 2.27μs 8.2μs 0 0 0 272.51 KB
#6871 StringConcatAspectBenchmark net472 412μs 2.1μs 9.38μs 0 0 0 286.94 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.6μs 13.3ns 62.3ns 0 0 0 1.76 KB
master EnrichedLog netcoreapp3.1 3.59μs 17.4ns 71.9ns 0 0 0 1.76 KB
master EnrichedLog net472 3.9μs 2.12ns 7.63ns 0.255 0 0 1.69 KB
#6871 EnrichedLog net6.0 2.51μs 11.7ns 48.4ns 0 0 0 1.76 KB
#6871 EnrichedLog netcoreapp3.1 3.6μs 16.2ns 62.6ns 0 0 0 1.76 KB
#6871 EnrichedLog net472 4.07μs 3.93ns 15.2ns 0.262 0 0 1.69 KB
Benchmarks.Trace.Log4netBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 121μs 129ns 484ns 0 0 0 4.37 KB
master EnrichedLog netcoreapp3.1 127μs 509ns 1.76μs 0 0 0 4.37 KB
master EnrichedLog net472 167μs 90.9ns 340ns 0 0 0 4.57 KB
#6871 EnrichedLog net6.0 123μs 84.2ns 304ns 0 0 0 4.37 KB
#6871 EnrichedLog netcoreapp3.1 126μs 140ns 505ns 0 0 0 4.37 KB
#6871 EnrichedLog net472 166μs 34.7ns 134ns 0 0 0 4.57 KB
Benchmarks.Trace.NLogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.97μs 13.6ns 52.8ns 0 0 0 2.32 KB
master EnrichedLog netcoreapp3.1 6.65μs 20ns 77.3ns 0 0 0 2.32 KB
master EnrichedLog net472 7.41μs 8.15ns 31.6ns 0.332 0 0 2.14 KB
#6871 EnrichedLog net6.0 4.9μs 5.08ns 19.7ns 0 0 0 2.32 KB
#6871 EnrichedLog netcoreapp3.1 6.72μs 20ns 77.3ns 0 0 0 2.32 KB
#6871 EnrichedLog net472 7.21μs 4.66ns 17.4ns 0.323 0 0 2.14 KB
Benchmarks.Trace.RedisBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.98μs 8.67ns 33.6ns 0 0 0 1.21 KB
master SendReceive netcoreapp3.1 2.55μs 12.3ns 52.2ns 0 0 0 1.21 KB
master SendReceive net472 3.16μs 5.39ns 20.9ns 0.187 0 0 1.21 KB
#6871 SendReceive net6.0 1.95μs 9.59ns 41.8ns 0 0 0 1.21 KB
#6871 SendReceive netcoreapp3.1 2.49μs 12.2ns 51.7ns 0 0 0 1.21 KB
#6871 SendReceive net472 3.25μs 3.13ns 12.1ns 0.179 0 0 1.21 KB
Benchmarks.Trace.SerilogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.38μs 17.2ns 66.6ns 0 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 5.95μs 18.7ns 72.4ns 0 0 0 1.69 KB
master EnrichedLog net472 6.69μs 7.01ns 27.1ns 0.299 0 0 2.08 KB
#6871 EnrichedLog net6.0 4.09μs 4.24ns 15.3ns 0 0 0 1.64 KB
#6871 EnrichedLog netcoreapp3.1 5.58μs 17.7ns 68.6ns 0 0 0 1.69 KB
#6871 EnrichedLog net472 6.67μs 6.6ns 25.6ns 0.301 0 0 2.08 KB
Benchmarks.Trace.SpanBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 733ns 3.94ns 19.7ns 0 0 0 584 B
master StartFinishSpan netcoreapp3.1 966ns 4.56ns 18.8ns 0 0 0 584 B
master StartFinishSpan net472 944ns 0.0772ns 0.289ns 0.0895 0 0 586 B
master StartFinishScope net6.0 893ns 4.64ns 24.1ns 0 0 0 704 B
master StartFinishScope netcoreapp3.1 1.18μs 6.21ns 31.1ns 0 0 0 704 B
master StartFinishScope net472 1.08μs 0.142ns 0.511ns 0.103 0 0 666 B
#6871 StartFinishSpan net6.0 752ns 3.74ns 15.9ns 0 0 0 584 B
#6871 StartFinishSpan netcoreapp3.1 939ns 4.86ns 23.8ns 0 0 0 584 B
#6871 StartFinishSpan net472 915ns 0.528ns 2.04ns 0.0914 0 0 586 B
#6871 StartFinishScope net6.0 910ns 4.67ns 23.4ns 0 0 0 704 B
#6871 StartFinishScope netcoreapp3.1 1.11μs 5.9ns 30.1ns 0 0 0 704 B
#6871 StartFinishScope net472 1.14μs 1.94ns 7.53ns 0.104 0 0 666 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 1.02μs 5.09ns 21ns 0 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 1.34μs 6.2ns 24ns 0 0 0 704 B
master RunOnMethodBegin net472 1.37μs 0.283ns 1.1ns 0.103 0 0 666 B
#6871 RunOnMethodBegin net6.0 1.04μs 5.67ns 31.6ns 0 0 0 704 B
#6871 RunOnMethodBegin netcoreapp3.1 1.4μs 6.64ns 26.6ns 0 0 0 704 B
#6871 RunOnMethodBegin net472 1.4μs 0.244ns 0.912ns 0.105 0 0 666 B

pr-commenter[bot] avatar Apr 22 '25 16:04 pr-commenter[bot]

While the tests here are an absolute pain, this just seems to make them slower and doesn't improve it in any meaningful way. If we come back to this we should consider splitting this into multiple different sample applications to avoid all of the various different "modes" this uses.

bouwkast avatar Sep 30 '25 17:09 bouwkast