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

Protect against more `NullReferenceExceptions` in `Kafka`

Open bouwkast opened this issue 8 months ago • 5 comments

Summary of changes

This adds more null checking in to the the Kafka integrations that I spotted popping up in Error Tracking recently:

  • KafkaProduceAsyncIntegration
  • KafkaProducerConstructorIntegration

There weren't many of these exceptions being thrown by us, but when I looked at the integration code I noticed that it didn't have as much null-checking as I think we should.

The first was easy to reproduce, I couldn't reproduce the second one.

Most likely the rest of the integration code should get a once over, but only address these as these are what we know are getting hit.

Reason for change

Integration code was throwing NullReferenceExceptions

Implementation details

More protections against null

Test coverage

Added two calls that reproduced the null reference in KafkaProduceAsyncIntegration I couldn't reproduce the ctor one though.

Other details

bouwkast avatar Apr 09 '25 19:04 bouwkast

Datadog Report

All test runs 1053a64 :link:

:white_check_mark: 2 Total Test Services: 0 Failed, 2 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Test Service View
dd-trace-dotnet 0 0 0 551424 4408 26h 53m 6.55s Link
exploration_tests 0 0 0 22085 3 2m 23.54s Link

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 Bailout
    This PR (6834) - mean (73ms)  : 72, 75
     .   : milestone, 73,
    master - mean (73ms)  : 72, 75
     .   : milestone, 73,

    section Baseline
    This PR (6834) - mean (70ms)  : 65, 75
     .   : milestone, 70,
    master - mean (70ms)  : 65, 76
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (999ms)  : 972, 1027
     .   : milestone, 999,
    master - mean (998ms)  : 976, 1021
     .   : milestone, 998,

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

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

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (706ms)  : 682, 730
     .   : milestone, 706,
    master - mean (708ms)  : 689, 726
     .   : milestone, 708,

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

    section Baseline
    This PR (6834) - mean (96ms)  : 94, 98
     .   : milestone, 96,
    master - mean (95ms)  : 93, 98
     .   : milestone, 95,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (662ms)  : 636, 688
     .   : milestone, 662,
    master - mean (662ms)  : 642, 683
     .   : milestone, 662,

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

    section Baseline
    This PR (6834) - mean (94ms)  : 92, 96
     .   : milestone, 94,
    master - mean (95ms)  : 93, 97
     .   : milestone, 95,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (594ms)  : 580, 608
     .   : milestone, 594,
    master - mean (604ms)  : 592, 615
     .   : milestone, 604,

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

    section Baseline
    This PR (6834) - mean (193ms)  : 189, 198
     .   : milestone, 193,
    master - mean (197ms)  : 189, 205
     .   : milestone, 197,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (1,110ms)  : 1081, 1140
     .   : milestone, 1110,
    master - mean (1,122ms)  : 1086, 1158
     .   : milestone, 1122,

gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (6834) - mean (281ms)  : 276, 286
     .   : milestone, 281,
    master - mean (284ms)  : 277, 291
     .   : milestone, 284,

    section Baseline
    This PR (6834) - mean (280ms)  : 274, 285
     .   : milestone, 280,
    master - mean (282ms)  : 275, 289
     .   : milestone, 282,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (902ms)  : 863, 941
     .   : milestone, 902,
    master - mean (913ms)  : 876, 950
     .   : milestone, 913,

gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (6834) - mean (271ms)  : 267, 275
     .   : milestone, 271,
    master - mean (275ms)  : 268, 283
     .   : milestone, 275,

    section Baseline
    This PR (6834) - mean (272ms)  : 266, 277
     .   : milestone, 272,
    master - mean (274ms)  : 269, 279
     .   : milestone, 274,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (877ms)  : 845, 908
     .   : milestone, 877,
    master - mean (900ms)  : 861, 939
     .   : milestone, 900,

gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (6834) - mean (272ms)  : 266, 277
     .   : milestone, 272,
    master - mean (276ms)  : 268, 283
     .   : milestone, 276,

    section Baseline
    This PR (6834) - mean (272ms)  : 266, 277
     .   : milestone, 272,
    master - mean (274ms)  : 268, 280
     .   : milestone, 274,

    section CallTarget+Inlining+NGEN
    This PR (6834) - mean (792ms)  : 763, 821
     .   : milestone, 792,
    master - mean (812ms)  : 781, 844
     .   : milestone, 812,

andrewlock avatar Apr 09 '25 20:04 andrewlock

Datadog Report

Branch report: steven/kafka-null-ref Commit report: 4f9c9d4 Test service: dd-trace-dotnet

:white_check_mark: 0 Failed, 12 Passed, 0 Skipped, 0s Total Time

datadog-ddstaging[bot] avatar Apr 09 '25 20:04 datadog-ddstaging[bot]

Benchmarks Report for tracer :snail:

Benchmarks for #6834 compared to master:

  • 13 benchmarks are faster, with geometric mean 1.290
  • 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 - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net6.0 1.269 9,914.12 7,810.07
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 1.256 20,228.79 16,111.10
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 1.229 12,706.58 10,339.95

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 9.84μs 55ns 344ns 0.0243 0.00973 0 5.56 KB
master StartStopWithChild netcoreapp3.1 12.7μs 71.8ns 482ns 0.0248 0.0124 0 5.75 KB
master StartStopWithChild net472 20.2μs 104ns 488ns 1.04 0.317 0.0991 6.14 KB
#6834 StartStopWithChild net6.0 7.82μs 43.3ns 281ns 0.0159 0.00796 0 5.56 KB
#6834 StartStopWithChild netcoreapp3.1 10.4μs 57.4ns 335ns 0.0204 0.0102 0 5.76 KB
#6834 StartStopWithChild net472 16.1μs 48.6ns 188ns 1.05 0.331 0.102 6.14 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 269ns 1.01μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 657μs 514ns 1.99μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 872μs 662ns 2.48μs 0.434 0 0 3.3 KB
#6834 WriteAndFlushEnrichedTraces net6.0 497μs 534ns 2μs 0 0 0 2.7 KB
#6834 WriteAndFlushEnrichedTraces netcoreapp3.1 653μs 541ns 2.1μs 0 0 0 2.7 KB
#6834 WriteAndFlushEnrichedTraces net472 867μs 1.09μs 4.21μs 0.434 0 0 3.3 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 133μs 391ns 1.51μs 0.191 0 0 14.48 KB
master SendRequest netcoreapp3.1 147μs 364ns 1.41μs 0.217 0 0 17.28 KB
master SendRequest net472 0.0194ns 0.0109ns 0.0521ns 0 0 0 0 b
#6834 SendRequest net6.0 131μs 417ns 1.62μs 0.199 0 0 14.48 KB
#6834 SendRequest netcoreapp3.1 150μs 196ns 758ns 0.15 0 0 17.28 KB
#6834 SendRequest net472 0.000227ns 0.000144ns 0.000559ns 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 678μs 5.46μs 54.3μs 0.357 0 0 41.6 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 753μs 5.27μs 51.9μs 0.353 0 0 41.73 KB
master WriteAndFlushEnrichedTraces net472 861μs 3.99μs 14.9μs 8.45 2.53 0.422 53.3 KB
#6834 WriteAndFlushEnrichedTraces net6.0 622μs 4.09μs 40.5μs 0.607 0 0 41.64 KB
#6834 WriteAndFlushEnrichedTraces netcoreapp3.1 690μs 3.44μs 14.6μs 0.355 0 0 41.7 KB
#6834 WriteAndFlushEnrichedTraces net472 857μs 3.89μs 14.6μs 8.45 2.53 0.422 53.32 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.25μs 1.67ns 6.46ns 0.0143 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 1.84μs 2.45ns 9.5ns 0.0137 0 0 1.02 KB
master ExecuteNonQuery net472 2.22μs 2.1ns 8.15ns 0.157 0.0011 0 995 B
#6834 ExecuteNonQuery net6.0 1.39μs 1.55ns 6.02ns 0.0146 0 0 1.03 KB
#6834 ExecuteNonQuery netcoreapp3.1 1.78μs 5.43ns 21ns 0.0141 0 0 1.02 KB
#6834 ExecuteNonQuery net472 2.08μs 3.25ns 12.2ns 0.158 0.00103 0 995 B
Benchmarks.Trace.ElasticsearchBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 1.370 1,821.33 1,329.25 several?
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 1.295 1,704.84 1,316.12

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.72μs 15.7ns 157ns 0.0136 0 0 984 B
master CallElasticsearch netcoreapp3.1 1.96μs 20.1ns 198ns 0.0125 0 0 984 B
master CallElasticsearch net472 2.56μs 2.93ns 11ns 0.159 0 0 1 KB
master CallElasticsearchAsync net6.0 1.83μs 15.6ns 155ns 0.0129 0 0 960 B
master CallElasticsearchAsync netcoreapp3.1 1.65μs 0.577ns 2.23ns 0.014 0 0 1.03 KB
master CallElasticsearchAsync net472 2.84μs 1.06ns 3.95ns 0.168 0 0 1.06 KB
#6834 CallElasticsearch net6.0 1.32μs 0.494ns 1.78ns 0.0139 0 0 984 B
#6834 CallElasticsearch netcoreapp3.1 1.69μs 1.53ns 5.94ns 0.0128 0 0 984 B
#6834 CallElasticsearch net472 2.51μs 1.59ns 6.14ns 0.159 0 0 1 KB
#6834 CallElasticsearchAsync net6.0 1.33μs 0.817ns 3.06ns 0.0134 0 0 960 B
#6834 CallElasticsearchAsync netcoreapp3.1 1.62μs 1.96ns 7.61ns 0.0138 0 0 1.03 KB
#6834 CallElasticsearchAsync net472 2.63μs 1.36ns 5.08ns 0.168 0 0 1.06 KB
Benchmarks.Trace.GraphQLBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 1.350 1,825.47 1,351.94
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1 1.192 2,035.55 1,707.75

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.85μs 13.2ns 132ns 0.0136 0 0 960 B
master ExecuteAsync netcoreapp3.1 2.04μs 17.7ns 177ns 0.0122 0 0 960 B
master ExecuteAsync net472 2.05μs 11.7ns 95.9ns 0.146 0 0 923 B
#6834 ExecuteAsync net6.0 1.35μs 1.06ns 3.96ns 0.0135 0 0 960 B
#6834 ExecuteAsync netcoreapp3.1 1.71μs 1.18ns 4.25ns 0.0127 0 0 960 B
#6834 ExecuteAsync net472 1.8μs 0.429ns 1.66ns 0.146 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 5.2μs 62.4ns 624ns 0.0318 0 0 2.32 KB
master SendAsync netcoreapp3.1 5.38μs 3.63ns 14.1ns 0.0375 0 0 2.86 KB
master SendAsync net472 7.32μs 1.27ns 4.9ns 0.494 0 0 3.13 KB
#6834 SendAsync net6.0 4.48μs 1.05ns 3.64ns 0.0312 0 0 2.32 KB
#6834 SendAsync netcoreapp3.1 5.49μs 1.65ns 6.19ns 0.0388 0 0 2.86 KB
#6834 SendAsync net472 7.41μs 1.73ns 6.71ns 0.496 0 0 3.13 KB
Benchmarks.Trace.ILoggerBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑netcoreapp3.1 1.409 3,015.08 2,139.27 several?
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.332 2,198.12 1,650.70
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net472 1.131 3,065.09 2,709.33

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.19μs 26ns 259ns 0.0237 0 0 1.71 KB
master EnrichedLog netcoreapp3.1 3.01μs 32.8ns 328ns 0.0234 0 0 1.71 KB
master EnrichedLog net472 3.07μs 17.2ns 118ns 0.261 0 0 1.64 KB
#6834 EnrichedLog net6.0 1.65μs 0.782ns 2.93ns 0.0241 0 0 1.71 KB
#6834 EnrichedLog netcoreapp3.1 2.14μs 3.58ns 13.9ns 0.0233 0 0 1.71 KB
#6834 EnrichedLog net472 2.71μs 1.11ns 4.3ns 0.26 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 126μs 706ns 4.99μs 0.0623 0 0 4.32 KB
master EnrichedLog netcoreapp3.1 129μs 722ns 4.73μs 0 0 0 4.32 KB
master EnrichedLog net472 153μs 795ns 6.41μs 0.677 0.226 0 4.51 KB
#6834 EnrichedLog net6.0 113μs 103ns 398ns 0.0568 0 0 4.32 KB
#6834 EnrichedLog netcoreapp3.1 117μs 165ns 618ns 0 0 0 4.32 KB
#6834 EnrichedLog net472 152μs 158ns 612ns 0.683 0.228 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.1μs 0.939ns 3.64ns 0.031 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 4.12μs 1.31ns 4.71ns 0.029 0 0 2.26 KB
master EnrichedLog net472 4.8μs 0.886ns 3.31ns 0.332 0 0 2.09 KB
#6834 EnrichedLog net6.0 3.15μs 3.08ns 11.9ns 0.0315 0 0 2.26 KB
#6834 EnrichedLog netcoreapp3.1 4.34μs 0.828ns 3.1ns 0.0302 0 0 2.26 KB
#6834 EnrichedLog net472 4.73μs 2.39ns 9.26ns 0.332 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.43μs 0.608ns 2.35ns 0.0164 0 0 1.15 KB
master SendReceive netcoreapp3.1 1.74μs 1.07ns 4.14ns 0.0157 0 0 1.15 KB
master SendReceive net472 2.06μs 1.55ns 6ns 0.184 0 0 1.16 KB
#6834 SendReceive net6.0 1.37μs 0.943ns 3.65ns 0.0165 0 0 1.15 KB
#6834 SendReceive netcoreapp3.1 1.72μs 1.33ns 4.8ns 0.0154 0 0 1.15 KB
#6834 SendReceive net472 2.09μs 1.45ns 5.63ns 0.184 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.82μs 0.667ns 2.59ns 0.0226 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 4μs 1.22ns 4.57ns 0.0221 0 0 1.69 KB
master EnrichedLog net472 4.63μs 3.38ns 13.1ns 0.331 0 0 2.08 KB
#6834 EnrichedLog net6.0 2.94μs 1.16ns 4.49ns 0.0235 0 0 1.64 KB
#6834 EnrichedLog netcoreapp3.1 4.05μs 3.71ns 13.4ns 0.0219 0 0 1.69 KB
#6834 EnrichedLog net472 4.6μs 3.54ns 13.7ns 0.329 0 0 2.08 KB
Benchmarks.Trace.SpanBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.451 703.15 484.74 bimodal
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.369 551.77 403.07 bimodal

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 556ns 5.3ns 53ns 0.00816 0 0 584 B
master StartFinishSpan netcoreapp3.1 608ns 0.778ns 3.01ns 0.00772 0 0 584 B
master StartFinishSpan net472 618ns 0.288ns 1.11ns 0.0929 0 0 586 B
master StartFinishScope net6.0 703ns 5.11ns 50.6ns 0.00976 0 0 704 B
master StartFinishScope netcoreapp3.1 710ns 0.212ns 0.82ns 0.00946 0 0 704 B
master StartFinishScope net472 866ns 0.546ns 2.11ns 0.106 0 0 666 B
#6834 StartFinishSpan net6.0 403ns 0.195ns 0.757ns 0.00829 0 0 584 B
#6834 StartFinishSpan netcoreapp3.1 576ns 0.617ns 2.39ns 0.00798 0 0 584 B
#6834 StartFinishSpan net472 597ns 0.219ns 0.848ns 0.093 0 0 586 B
#6834 StartFinishScope net6.0 485ns 0.132ns 0.456ns 0.00993 0 0 704 B
#6834 StartFinishScope netcoreapp3.1 730ns 0.347ns 1.25ns 0.00953 0 0 704 B
#6834 StartFinishScope net472 825ns 0.383ns 1.48ns 0.106 0 0 666 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 1.160 1,152.31 993.70

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 749ns 0.249ns 0.963ns 0.00974 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 943ns 0.368ns 1.42ns 0.00945 0 0 704 B
master RunOnMethodBegin net472 1.15μs 0.137ns 0.529ns 0.105 0 0 666 B
#6834 RunOnMethodBegin net6.0 678ns 0.588ns 2.28ns 0.00989 0 0 704 B
#6834 RunOnMethodBegin netcoreapp3.1 975ns 0.31ns 1.16ns 0.00964 0 0 704 B
#6834 RunOnMethodBegin net472 994ns 0.484ns 1.87ns 0.106 0 0 666 B

andrewlock avatar Apr 09 '25 20:04 andrewlock

Benchmarks

Benchmarks Report for benchmark platform :snail:

Benchmarks for #6834 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.686
  • 1 benchmarks are slower, with geometric mean 2.040
  • 7 benchmarks have fewer allocations
  • 6 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: More allocations :warning:

More allocations :warning: in #6834

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.65 KB 5.71 KB 57 B 1.01%

Fewer allocations :tada: in #6834

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.08 KB 6.04 KB -38 B -0.63%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.3μs 57.3ns 358ns 0 0 0 5.49 KB
master StartStopWithChild netcoreapp3.1 13.3μs 70.3ns 372ns 0 0 0 5.65 KB
master StartStopWithChild net472 21.4μs 102ns 395ns 0.876 0.219 0 6.08 KB
#6834 StartStopWithChild net6.0 10.5μs 57.3ns 314ns 0 0 0 5.51 KB
#6834 StartStopWithChild netcoreapp3.1 13.4μs 70.4ns 338ns 0 0 0 5.71 KB
#6834 StartStopWithChild net472 22μs 115ns 598ns 1.03 0.343 0.114 6.04 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 919μs 148ns 554ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 267ns 1E+03ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.2ms 1.31μs 5.06μs 0 0 0 3.31 KB
#6834 WriteAndFlushEnrichedTraces net6.0 928μs 85.6ns 320ns 0 0 0 2.71 KB
#6834 WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 371ns 1.44μs 0 0 0 2.7 KB
#6834 WriteAndFlushEnrichedTraces net472 1.19ms 66.7ns 240ns 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 322μs 1.42μs 5.49μs 0 0 0 172.07 KB
master AllCycleSimpleBody netcoreapp3.1 495μs 558ns 1.93μs 0 0 0 174.18 KB
master AllCycleSimpleBody net472 427μs 177ns 684ns 29.2 0 0 194.24 KB
master AllCycleMoreComplexBody net6.0 326μs 208ns 778ns 0 0 0 175.58 KB
master AllCycleMoreComplexBody netcoreapp3.1 462μs 1.07μs 4.13μs 0 0 0 177.6 KB
master AllCycleMoreComplexBody net472 432μs 150ns 580ns 30.2 0 0 197.76 KB
master ObjectExtractorSimpleBody net6.0 319ns 1.52ns 6.47ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 403ns 2.09ns 10.7ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 304ns 0.0937ns 0.338ns 0.0444 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.34μs 22.8ns 88.1ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.81μs 37ns 143ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.71μs 2.81ns 10.9ns 0.57 0 0 3.8 KB
#6834 AllCycleSimpleBody net6.0 321μs 185ns 667ns 0 0 0 172.08 KB
#6834 AllCycleSimpleBody netcoreapp3.1 489μs 1.63μs 6.33μs 0 0 0 174.18 KB
#6834 AllCycleSimpleBody net472 427μs 132ns 510ns 29.2 0 0 194.24 KB
#6834 AllCycleMoreComplexBody net6.0 328μs 199ns 771ns 0 0 0 175.58 KB
#6834 AllCycleMoreComplexBody netcoreapp3.1 485μs 2.17μs 8.42μs 0 0 0 177.6 KB
#6834 AllCycleMoreComplexBody net472 436μs 80.9ns 303ns 30.2 0 0 197.76 KB
#6834 ObjectExtractorSimpleBody net6.0 313ns 1.59ns 7.27ns 0 0 0 280 B
#6834 ObjectExtractorSimpleBody netcoreapp3.1 405ns 2.05ns 9.84ns 0 0 0 272 B
#6834 ObjectExtractorSimpleBody net472 299ns 0.0444ns 0.166ns 0.0436 0 0 281 B
#6834 ObjectExtractorMoreComplexBody net6.0 6.24μs 33.2ns 176ns 0 0 0 3.78 KB
#6834 ObjectExtractorMoreComplexBody netcoreapp3.1 7.79μs 31.9ns 123ns 0 0 0 3.69 KB
#6834 ObjectExtractorMoreComplexBody net472 6.75μs 2.05ns 7.68ns 0.573 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - 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 EncodeArgs net6.0 77.7μs 214ns 828ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 96.6μs 26.3ns 98.4ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 7.94ns 29.7ns 4.93 0 0 32.51 KB
master EncodeLegacyArgs net6.0 145μs 25.9ns 97.1ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 195μs 107ns 416ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 158ns 611ns 0 0 0 2.16 KB
#6834 EncodeArgs net6.0 76.7μs 20.2ns 78.3ns 0 0 0 32.4 KB
#6834 EncodeArgs netcoreapp3.1 95.9μs 299ns 1.16μs 0 0 0 32.4 KB
#6834 EncodeArgs net472 109μs 22.1ns 85.7ns 4.92 0 0 32.5 KB
#6834 EncodeLegacyArgs net6.0 144μs 18.8ns 72.8ns 0 0 0 2.15 KB
#6834 EncodeLegacyArgs netcoreapp3.1 199μs 191ns 714ns 0 0 0 2.14 KB
#6834 EncodeLegacyArgs net472 264μs 52.3ns 189ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower :warning: Same allocations :heavy_check_mark:

Slower :warning: in #6834

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.040 416,967.67 850,673.44

Faster :tada: in #6834

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 1.686 515,440.40 305,791.39

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 394μs 46.2ns 179ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 417μs 142ns 550ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 435μs 84.1ns 315ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 290μs 64.5ns 250ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 490μs 6.85μs 68.5μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 315μs 44.7ns 167ns 0 0 0 2.29 KB
#6834 RunWafRealisticBenchmark net6.0 399μs 77.7ns 280ns 0 0 0 4.56 KB
#6834 RunWafRealisticBenchmark netcoreapp3.1 808μs 9.76μs 96.6μs 0 0 0 4.48 KB
#6834 RunWafRealisticBenchmark net472 436μs 61.8ns 231ns 0 0 0 4.66 KB
#6834 RunWafRealisticBenchmarkWithAttack net6.0 290μs 51.4ns 199ns 0 0 0 2.24 KB
#6834 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 306μs 646ns 2.5μs 0 0 0 2.22 KB
#6834 RunWafRealisticBenchmarkWithAttack net472 314μs 24.3ns 90.7ns 0 0 0 2.29 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 60.7μs 62.9ns 227ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 70μs 159ns 573ns 0 0 0 17.42 KB
master SendRequest net472 0.00903ns 0.00245ns 0.00949ns 0 0 0 0 b
#6834 SendRequest net6.0 60μs 66.2ns 239ns 0 0 0 14.52 KB
#6834 SendRequest netcoreapp3.1 71.9μs 359ns 1.64μs 0 0 0 17.42 KB
#6834 SendRequest net472 0.0135ns 0.00335ns 0.013ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed :heavy_check_mark: Fewer allocations :tada:

Fewer allocations :tada: in #6834

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 4 B 3 B -1 B -25.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 7 B 5 B -2 B -28.57%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 73 B 0 b -73 B -100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 47 B 0 b -47 B -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.93ms 4.3μs 15.5μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.1ms 5.17μs 20μs 0 0 0 640 KB
master OriginalCharSlice net472 2.69ms 679ns 2.54μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.37ms 368ns 1.42μs 0 0 0 7 B
master OptimizedCharSlice netcoreapp3.1 1.67ms 1.95μs 7.56μs 0 0 0 1 B
master OptimizedCharSlice net472 1.95ms 250ns 936ns 0 0 0 73 B
master OptimizedCharSliceWithPool net6.0 799μs 31ns 116ns 0 0 0 4 B
master OptimizedCharSliceWithPool netcoreapp3.1 936μs 4.37μs 16.9μs 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.15ms 109ns 424ns 0 0 0 47 B
#6834 OriginalCharSlice net6.0 1.97ms 4.69μs 17.6μs 0 0 0 640.01 KB
#6834 OriginalCharSlice netcoreapp3.1 2.17ms 5.77μs 20μs 0 0 0 640 KB
#6834 OriginalCharSlice net472 2.65ms 308ns 1.19μs 100 0 0 641.95 KB
#6834 OptimizedCharSlice net6.0 1.46ms 247ns 955ns 0 0 0 5 B
#6834 OptimizedCharSlice netcoreapp3.1 1.76ms 494ns 1.91μs 0 0 0 1 B
#6834 OptimizedCharSlice net472 2.01ms 642ns 2.49μs 0 0 0 0 b
#6834 OptimizedCharSliceWithPool net6.0 865μs 32.4ns 121ns 0 0 0 3 B
#6834 OptimizedCharSliceWithPool netcoreapp3.1 827μs 72.8ns 273ns 0 0 0 0 b
#6834 OptimizedCharSliceWithPool net472 1.14ms 78.5ns 283ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: More allocations :warning:

More allocations :warning: in #6834

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.76 KB 42.42 KB 662 B 1.59%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.01 KB 56.46 KB 444 B 0.79%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 748μs 4.13μs 27.1μs 0 0 0 41.76 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 676μs 3.52μs 17.2μs 0 0 0 41.98 KB
master WriteAndFlushEnrichedTraces net472 907μs 1.63μs 5.87μs 4.46 0 0 56.01 KB
#6834 WriteAndFlushEnrichedTraces net6.0 700μs 4.04μs 31.3μs 0 0 0 42.42 KB
#6834 WriteAndFlushEnrichedTraces netcoreapp3.1 660μs 2.64μs 11.8μs 0 0 0 41.88 KB
#6834 WriteAndFlushEnrichedTraces net472 906μs 4.62μs 21.2μs 8.33 0 0 56.46 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.81μs 2.28ns 8.21ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.52μs 7.27ns 28.1ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.8μs 3.72ns 14.4ns 0.152 0.0138 0 987 B
#6834 ExecuteNonQuery net6.0 1.87μs 5.62ns 21ns 0 0 0 1.02 KB
#6834 ExecuteNonQuery netcoreapp3.1 2.44μs 10.8ns 41.7ns 0 0 0 1.02 KB
#6834 ExecuteNonQuery net472 2.79μs 3.52ns 13.7ns 0.153 0.0139 0 987 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.71μs 6.35ns 24.6ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.29μs 6.52ns 25.2ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.58μs 2.87ns 11.1ns 0.161 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.86μs 2.13ns 8.25ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.34μs 7.52ns 29.1ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.71μs 0.559ns 2.16ns 0.168 0 0 1.1 KB
#6834 CallElasticsearch net6.0 1.68μs 8.11ns 35.3ns 0 0 0 1.03 KB
#6834 CallElasticsearch netcoreapp3.1 2.24μs 8.75ns 33.9ns 0 0 0 1.03 KB
#6834 CallElasticsearch net472 3.72μs 6.67ns 25.8ns 0.166 0 0 1.04 KB
#6834 CallElasticsearchAsync net6.0 1.83μs 9.07ns 37.4ns 0 0 0 1.01 KB
#6834 CallElasticsearchAsync netcoreapp3.1 2.44μs 6.33ns 24.5ns 0 0 0 1.08 KB
#6834 CallElasticsearchAsync net472 3.82μs 3.95ns 15.3ns 0.173 0 0 1.1 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.84μs 3.33ns 12.9ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.48μs 7.11ns 26.6ns 0 0 0 952 B
master ExecuteAsync net472 2.57μs 2.99ns 11.6ns 0.141 0 0 915 B
#6834 ExecuteAsync net6.0 1.95μs 10ns 48.2ns 0 0 0 953 B
#6834 ExecuteAsync netcoreapp3.1 2.29μs 10.1ns 39ns 0 0 0 952 B
#6834 ExecuteAsync net472 2.5μs 1.89ns 7.33ns 0.137 0 0 915 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 12ns 46.4ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.31μs 14.6ns 56.6ns 0 0 0 2.9 KB
master SendAsync net472 12.5μs 7.26ns 28.1ns 0.497 0 0 3.18 KB
#6834 SendAsync net6.0 7.1μs 10.3ns 38.5ns 0 0 0 2.36 KB
#6834 SendAsync netcoreapp3.1 8.32μs 18.4ns 71.1ns 0 0 0 2.9 KB
#6834 SendAsync net472 12.3μs 15.8ns 61.3ns 0.489 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed :heavy_check_mark: More allocations :warning:

More allocations :warning: in #6834

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 254.89 KB 274.62 KB 19.73 KB 7.74%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 44.2 KB 45.53 KB 1.33 KB 3.00%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.1 KB 43.82 KB 720 B 1.67%

Fewer allocations :tada: in #6834

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 286.72 KB 278.53 KB -8.19 KB -2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 277.83 KB 258.66 KB -19.17 KB -6.90%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 48μs 237ns 1.4μs 0 0 0 43.1 KB
master StringConcatBenchmark netcoreapp3.1 53.3μs 654ns 6.44μs 0 0 0 44.2 KB
master StringConcatBenchmark net472 57.1μs 217ns 783ns 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 475μs 1.67μs 7.29μs 0 0 0 277.83 KB
master StringConcatAspectBenchmark netcoreapp3.1 497μs 2.46μs 10.1μs 0 0 0 254.89 KB
master StringConcatAspectBenchmark net472 406μs 2.11μs 10.1μs 0 0 0 286.72 KB
#6834 StringConcatBenchmark net6.0 48.4μs 776ns 7.72μs 0 0 0 43.82 KB
#6834 StringConcatBenchmark netcoreapp3.1 55.2μs 769ns 7.65μs 0 0 0 45.53 KB
#6834 StringConcatBenchmark net472 57.8μs 244ns 914ns 0 0 0 65.54 KB
#6834 StringConcatAspectBenchmark net6.0 468μs 1.6μs 5.54μs 0 0 0 258.66 KB
#6834 StringConcatAspectBenchmark netcoreapp3.1 543μs 2.65μs 10.9μs 0 0 0 274.62 KB
#6834 StringConcatAspectBenchmark net472 414μs 2.24μs 15.7μs 0 0 0 278.53 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.58μs 4.21ns 16.3ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.4μs 2.85ns 11ns 0 0 0 1.7 KB
master EnrichedLog net472 4.03μs 4.03ns 15.6ns 0.242 0 0 1.64 KB
#6834 EnrichedLog net6.0 2.52μs 1.29ns 4.47ns 0 0 0 1.7 KB
#6834 EnrichedLog netcoreapp3.1 3.37μs 17.1ns 76.7ns 0 0 0 1.7 KB
#6834 EnrichedLog net472 4.09μs 4.32ns 16.7ns 0.245 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 123μs 247ns 955ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 128μs 125ns 433ns 0 0 0 4.31 KB
master EnrichedLog net472 166μs 19.9ns 71.9ns 0 0 0 4.51 KB
#6834 EnrichedLog net6.0 122μs 95.5ns 358ns 0 0 0 4.31 KB
#6834 EnrichedLog netcoreapp3.1 126μs 50.2ns 181ns 0 0 0 4.31 KB
#6834 EnrichedLog net472 167μs 207ns 801ns 0 0 0 4.52 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.94μs 7.32ns 28.3ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.53μs 19.5ns 75.4ns 0 0 0 2.26 KB
master EnrichedLog net472 7.44μs 7.63ns 29.5ns 0.297 0 0 2.08 KB
#6834 EnrichedLog net6.0 5.02μs 20.9ns 81.1ns 0 0 0 2.26 KB
#6834 EnrichedLog netcoreapp3.1 6.69μs 19.3ns 74.9ns 0 0 0 2.26 KB
#6834 EnrichedLog net472 7.34μs 4.53ns 17ns 0.329 0 0 2.08 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.94μs 9.33ns 36.1ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.62μs 1.13ns 4.22ns 0 0 0 1.2 KB
master SendReceive net472 3.11μs 3.84ns 14.9ns 0.186 0 0 1.2 KB
#6834 SendReceive net6.0 1.93μs 10.2ns 51.1ns 0 0 0 1.2 KB
#6834 SendReceive netcoreapp3.1 2.65μs 9.65ns 36.1ns 0 0 0 1.2 KB
#6834 SendReceive net472 3.12μs 4.02ns 15.1ns 0.186 0 0 1.2 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.17μs 6.27ns 24.3ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.74μs 10.7ns 40.1ns 0 0 0 1.63 KB
master EnrichedLog net472 6.64μs 8.61ns 33.3ns 0.299 0 0 2.03 KB
#6834 EnrichedLog net6.0 4.38μs 12.5ns 48.3ns 0 0 0 1.58 KB
#6834 EnrichedLog netcoreapp3.1 5.32μs 17.8ns 69.1ns 0 0 0 1.63 KB
#6834 EnrichedLog net472 6.45μs 7.7ns 29.8ns 0.292 0 0 2.03 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 748ns 3.5ns 13.1ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 961ns 5.06ns 24.3ns 0 0 0 576 B
master StartFinishSpan net472 897ns 0.0789ns 0.295ns 0.0898 0 0 578 B
master StartFinishScope net6.0 883ns 0.372ns 1.44ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.1μs 5.28ns 26.9ns 0 0 0 697 B
master StartFinishScope net472 1.09μs 0.401ns 1.55ns 0.103 0 0 658 B
#6834 StartFinishSpan net6.0 760ns 2.13ns 8.26ns 0 0 0 576 B
#6834 StartFinishSpan netcoreapp3.1 934ns 4.86ns 23.8ns 0 0 0 576 B
#6834 StartFinishSpan net472 901ns 0.197ns 0.737ns 0.0912 0 0 578 B
#6834 StartFinishScope net6.0 883ns 4.48ns 19.5ns 0 0 0 696 B
#6834 StartFinishScope netcoreapp3.1 1.12μs 5.9ns 30.1ns 0 0 0 697 B
#6834 StartFinishScope net472 1.16μs 1.48ns 5.75ns 0.103 0 0 658 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.03μs 0.912ns 3.53ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.37μs 3.62ns 14ns 0 0 0 696 B
master RunOnMethodBegin net472 1.35μs 0.648ns 2.51ns 0.101 0 0 658 B
#6834 RunOnMethodBegin net6.0 1.02μs 1.15ns 4.45ns 0 0 0 696 B
#6834 RunOnMethodBegin netcoreapp3.1 1.36μs 4.35ns 15.7ns 0 0 0 696 B
#6834 RunOnMethodBegin net472 1.43μs 2.1ns 8.15ns 0.0987 0 0 658 B

pr-commenter[bot] avatar May 30 '25 18:05 pr-commenter[bot]

⚠️ Tests

⚠️ Warnings

🧪 1 Test failed

DetectContinuousProfilerState from Datadog.Trace.Tools.dd_dotnet.IntegrationTests.Checks.ProcessBasicChecksTests (Datadog)
The target process unexpectedly exited

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: de0ad6f | Docs | Was this helpful? Give us feedback!

Superseded, for the most part, by https://github.com/DataDog/dd-trace-dotnet/pull/7448 as it added protections to the methods that were being called with the null IDuckTypes

I will keep an eye out on these though to see if I see other instances of the error pop up which may require future investigation.

I'll extract out the documentation change that was in this PR though.

bouwkast avatar Sep 30 '25 22:09 bouwkast