Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle potential NullReferenceException in DSM #4744

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Conversation

andrewlock
Copy link
Member

Summary of changes

Add nullable annotations and fix the warnings

Reason for change

A recent escalation noted an incidental NullReferenceException in the logs:

[ERR] Error creating or populating scope. System.NullReferenceException: Object reference not set to an instance of an object.
at Datadog.Trace.ClrProfiler.AutoInstrumentation.Kafka.KafkaHelper.GetMessageSize[T](T message)
at Datadog.Trace.ClrProfiler.AutoInstrumentation.Kafka.KafkaHelper.CreateConsumerScope(Tracer tracer, DataStreamsManager dataStreamsManager, Object consumer, String topic, Nullable`1 partition, Nullable`1 offset, IMessage message)

The GetMessageSize() method is quite careful about null-checking, so my best guess is that the message object passed in itself is null (which the nullable annotations also suggested).

I think this is partly due to the difference in how duck typing works for duck-typing in instrumentations (where the duck-type object will never be null, as it's implemented as a struct, even if using interfaces) and when using duck-chaining (where the duck-type object can be null if you're using interfaces)

Implementation details

Add #nullable enable, add some null checks

Test coverage

Not easy, just checking there's no regressions

Other details

Maybe we should make it a habit of marking duck-chained interface properties as nullable reference types? 🤔 I think that would help avoid this ambiguity?

@andrewlock
Copy link
Member Author

andrewlock commented Oct 23, 2023

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.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4744) - mean (72ms)  : 64, 81
     .   : milestone, 72,
    master - mean (70ms)  : 63, 78
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (4744) - mean (1,013ms)  : 993, 1034
     .   : milestone, 1013,
    master - mean (1,022ms)  : 1000, 1043
     .   : milestone, 1022,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4744) - mean (107ms)  : 98, 115
     .   : milestone, 107,
    master - mean (107ms)  : 101, 112
     .   : milestone, 107,

    section CallTarget+Inlining+NGEN
    This PR (4744) - mean (716ms)  : 694, 739
     .   : milestone, 716,
    master - mean (718ms)  : 698, 737
     .   : milestone, 718,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4744) - mean (90ms)  : 88, 92
     .   : milestone, 90,
    master - mean (90ms)  : 84, 96
     .   : milestone, 90,

    section CallTarget+Inlining+NGEN
    This PR (4744) - mean (677ms)  : 651, 704
     .   : milestone, 677,
    master - mean (686ms)  : 661, 711
     .   : milestone, 686,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4744) - mean (188ms)  : 185, 192
     .   : milestone, 188,
    master - mean (188ms)  : 186, 190
     .   : milestone, 188,

    section CallTarget+Inlining+NGEN
    This PR (4744) - mean (1,136ms)  : 1109, 1162
     .   : milestone, 1136,
    master - mean (1,127ms)  : 1106, 1149
     .   : milestone, 1127,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4744) - mean (272ms)  : 269, 275
     .   : milestone, 272,
    master - mean (272ms)  : 268, 277
     .   : milestone, 272,

    section CallTarget+Inlining+NGEN
    This PR (4744) - mean (1,089ms)  : 1055, 1124
     .   : milestone, 1089,
    master - mean (1,087ms)  : 1056, 1118
     .   : milestone, 1087,

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

    section CallTarget+Inlining+NGEN
    This PR (4744) - mean (1,060ms)  : 1036, 1084
     .   : milestone, 1060,
    master - mean (1,050ms)  : 1028, 1073
     .   : milestone, 1050,

Loading

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Oct 23, 2023

Datadog Report

Branch report: andrew/fix-dsm
Commit report: 0a6b281

dd-trace-dotnet: 0 Failed, 0 New Flaky, 305532 Passed, 1173 Skipped, 36m 58.11s Wall Time

@andrewlock
Copy link
Member Author

andrewlock commented Oct 23, 2023

Benchmarks Report 🐌

Benchmarks for #4744 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.214
  • 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 ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 8.01μs 34.8ns 125ns 0.031 0.0116 0 7.29 KB
master StartStopWithChild netcoreapp3.1 10μs 46.5ns 228ns 0.0393 0.0196 0 7.39 KB
master StartStopWithChild net472 15.5μs 53.3ns 206ns 1.27 0.298 0.0862 7.67 KB
#4744 StartStopWithChild net6.0 8.11μs 45.9ns 325ns 0.0235 0.00784 0 7.29 KB
#4744 StartStopWithChild netcoreapp3.1 10.3μs 51.7ns 248ns 0.0303 0.0151 0 7.38 KB
#4744 StartStopWithChild net472 15.7μs 63.4ns 245ns 1.29 0.329 0.11 7.66 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 467μs 206ns 798ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 628μs 164ns 635ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 797μs 275ns 1.03μs 0.398 0 0 3.3 KB
#4744 WriteAndFlushEnrichedTraces net6.0 486μs 427ns 1.65μs 0 0 0 2.7 KB
#4744 WriteAndFlushEnrichedTraces netcoreapp3.1 626μs 209ns 780ns 0 0 0 2.7 KB
#4744 WriteAndFlushEnrichedTraces net472 791μs 285ns 1.07μs 0.393 0 0 3.3 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 43.1μs 51.7ns 200ns 0.0216 0 0 2.03 KB
master AllCycleSimpleBody netcoreapp3.1 44.8μs 65.2ns 244ns 0.0226 0 0 2.01 KB
master AllCycleSimpleBody net472 47.3μs 20.4ns 76.3ns 0.325 0 0 2.08 KB
master AllCycleMoreComplexBody net6.0 229μs 268ns 1.04μs 0.113 0 0 8.63 KB
master AllCycleMoreComplexBody netcoreapp3.1 235μs 553ns 2.14μs 0 0 0 8.52 KB
master AllCycleMoreComplexBody net472 238μs 137ns 529ns 1.3 0 0 8.7 KB
master ObjectExtractorSimpleBody net6.0 125ns 0.12ns 0.465ns 0.00397 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 172ns 0.322ns 1.25ns 0.00381 0 0 272 B
master ObjectExtractorSimpleBody net472 144ns 0.0892ns 0.345ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.02μs 1.12ns 4.21ns 0.0537 0 0 3.88 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.12μs 1.08ns 3.9ns 0.0514 0 0 3.78 KB
master ObjectExtractorMoreComplexBody net472 4.09μs 2.45ns 9.47ns 0.618 0.00614 0 3.89 KB
#4744 AllCycleSimpleBody net6.0 43.5μs 16.9ns 65.5ns 0.0216 0 0 2.03 KB
#4744 AllCycleSimpleBody netcoreapp3.1 45.1μs 32.6ns 122ns 0.0226 0 0 2.01 KB
#4744 AllCycleSimpleBody net472 48.3μs 29.6ns 115ns 0.321 0 0 2.08 KB
#4744 AllCycleMoreComplexBody net6.0 228μs 97.7ns 366ns 0.114 0 0 8.63 KB
#4744 AllCycleMoreComplexBody netcoreapp3.1 233μs 199ns 746ns 0.117 0 0 8.52 KB
#4744 AllCycleMoreComplexBody net472 239μs 114ns 425ns 1.3 0 0 8.7 KB
#4744 ObjectExtractorSimpleBody net6.0 121ns 0.0751ns 0.281ns 0.00392 0 0 280 B
#4744 ObjectExtractorSimpleBody netcoreapp3.1 180ns 0.0782ns 0.293ns 0.00373 0 0 272 B
#4744 ObjectExtractorSimpleBody net472 145ns 0.138ns 0.533ns 0.0446 0 0 281 B
#4744 ObjectExtractorMoreComplexBody net6.0 3.05μs 1.19ns 4.62ns 0.055 0 0 3.88 KB
#4744 ObjectExtractorMoreComplexBody netcoreapp3.1 4.17μs 1.6ns 6.21ns 0.052 0 0 3.78 KB
#4744 ObjectExtractorMoreComplexBody net472 4.11μs 3.08ns 11.5ns 0.618 0.00614 0 3.89 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWaf(args=NestedMap (10)) net6.0 12.8μs 2.81ns 10.5ns 0.128 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 19.5μs 4.04ns 15.1ns 0.126 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) net472 28.4μs 6.49ns 25.2ns 1.5 0 0 9.48 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 76.8μs 37.4ns 140ns 0.191 0 0 15.77 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 86.8μs 174ns 676ns 0.215 0 0 15.72 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 100μs 184ns 713ns 2.52 0 0 16.04 KB
master RunWaf(args=NestedMap (100)) net6.0 24.9μs 8.32ns 30ns 0.273 0 0 19.66 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 38.3μs 16.1ns 62.3ns 0.268 0 0 20.42 KB
master RunWaf(args=NestedMap (100)) net472 54.7μs 27.2ns 105ns 3.27 0.0545 0 20.63 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 90.6μs 211ns 816ns 0.359 0 0 26.01 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 110μs 60.6ns 227ns 0.33 0 0 26.72 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 135μs 185ns 716ns 4.27 0.0667 0 27.19 KB
master RunWaf(args=NestedMap (20)) net6.0 24.1μs 4.97ns 19.3ns 0.266 0 0 19.4 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 37.6μs 15.7ns 60.9ns 0.263 0 0 19.84 KB
master RunWaf(args=NestedMap (20)) net472 55.7μs 16.4ns 63.4ns 3.17 0.0546 0 20.04 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 90.1μs 52.3ns 202ns 0.315 0 0 25.74 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 108μs 111ns 430ns 0.325 0 0 26.14 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 132μs 109ns 423ns 4.21 0.0657 0 26.6 KB
#4744 RunWaf(args=NestedMap (10)) net6.0 12.9μs 3.77ns 14.1ns 0.134 0 0 9.42 KB
#4744 RunWaf(args=NestedMap (10)) netcoreapp3.1 19.4μs 3.25ns 11.3ns 0.126 0 0 9.42 KB
#4744 RunWaf(args=NestedMap (10)) net472 28.3μs 7.16ns 26.8ns 1.5 0 0 9.48 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 75.9μs 28.8ns 112ns 0.228 0 0 15.77 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 85.8μs 169ns 653ns 0.173 0 0 15.72 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [22]) net472 99.7μs 86.4ns 335ns 2.53 0 0 16.04 KB
#4744 RunWaf(args=NestedMap (100)) net6.0 24.3μs 10ns 37.4ns 0.279 0 0 19.66 KB
#4744 RunWaf(args=NestedMap (100)) netcoreapp3.1 38.4μs 10.7ns 41.6ns 0.268 0 0 20.42 KB
#4744 RunWaf(args=NestedMap (100)) net472 54.2μs 15.1ns 58.4ns 3.28 0.0271 0 20.63 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 92.2μs 50.5ns 220ns 0.345 0 0 26.01 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 110μs 218ns 844ns 0.326 0 0 26.72 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [23]) net472 133μs 103ns 399ns 4.29 0.066 0 27.19 KB
#4744 RunWaf(args=NestedMap (20)) net6.0 24.5μs 14.8ns 57.3ns 0.268 0 0 19.4 KB
#4744 RunWaf(args=NestedMap (20)) netcoreapp3.1 37.2μs 19.9ns 76.9ns 0.261 0 0 19.84 KB
#4744 RunWaf(args=NestedMap (20)) net472 54.4μs 17.8ns 68.8ns 3.16 0.0545 0 20.04 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 91.6μs 67.4ns 261ns 0.368 0 0 25.74 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 112μs 215ns 774ns 0.333 0 0 26.14 KB
#4744 RunWafWithAttack(args=Neste(...)tack) [22]) net472 135μs 108ns 420ns 4.21 0.0668 0 26.6 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 166μs 99.3ns 372ns 0.25 0 0 18.04 KB
master SendRequest netcoreapp3.1 190μs 240ns 931ns 0.19 0 0 20.2 KB
master SendRequest net472 0.00012ns 0.00012ns 0.000431ns 0 0 0 0 b
#4744 SendRequest net6.0 171μs 121ns 470ns 0.17 0 0 18.04 KB
#4744 SendRequest netcoreapp3.1 193μs 213ns 824ns 0.194 0 0 20.2 KB
#4744 SendRequest net472 0.0005ns 0.000225ns 0.000872ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 557μs 423ns 1.64μs 0.556 0 0 41.76 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 655μs 1.19μs 4.44μs 0.332 0 0 41.64 KB
master WriteAndFlushEnrichedTraces net472 841μs 4.08μs 16.8μs 8.33 2.5 0.417 53.26 KB
#4744 WriteAndFlushEnrichedTraces net6.0 554μs 218ns 846ns 0.551 0 0 41.59 KB
#4744 WriteAndFlushEnrichedTraces netcoreapp3.1 647μs 1.01μs 3.93μs 0.327 0 0 41.75 KB
#4744 WriteAndFlushEnrichedTraces net472 874μs 3.8μs 14.7μs 8.13 2.57 0.428 53.21 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.13μs 0.872ns 3.38ns 0.0107 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.32μs 1.38ns 5.33ns 0.00989 0 0 768 B
master ExecuteNonQuery net472 1.55μs 0.392ns 1.41ns 0.116 0 0 730 B
#4744 ExecuteNonQuery net6.0 1.05μs 0.576ns 2.23ns 0.0109 0 0 768 B
#4744 ExecuteNonQuery netcoreapp3.1 1.27μs 1.1ns 4.25ns 0.01 0 0 768 B
#4744 ExecuteNonQuery net472 1.62μs 0.867ns 3.36ns 0.116 0 0 730 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.23μs 0.752ns 2.91ns 0.0133 0 0 936 B
master CallElasticsearch netcoreapp3.1 1.47μs 0.643ns 2.4ns 0.0124 0 0 936 B
master CallElasticsearch net472 2.4μs 1.13ns 4.24ns 0.152 0 0 955 B
master CallElasticsearchAsync net6.0 1.2μs 0.445ns 1.67ns 0.0126 0 0 912 B
master CallElasticsearchAsync netcoreapp3.1 1.51μs 0.453ns 1.7ns 0.013 0 0 984 B
master CallElasticsearchAsync net472 2.59μs 0.429ns 1.6ns 0.161 0 0 1.01 KB
#4744 CallElasticsearch net6.0 1.29μs 0.414ns 1.6ns 0.0129 0 0 936 B
#4744 CallElasticsearch netcoreapp3.1 1.52μs 2.38ns 8.58ns 0.0126 0 0 936 B
#4744 CallElasticsearch net472 2.32μs 0.864ns 3.35ns 0.151 0 0 955 B
#4744 CallElasticsearchAsync net6.0 1.29μs 0.531ns 2.06ns 0.0123 0 0 912 B
#4744 CallElasticsearchAsync netcoreapp3.1 1.52μs 1.4ns 5.41ns 0.0129 0 0 984 B
#4744 CallElasticsearchAsync net472 2.54μs 0.927ns 3.59ns 0.16 0 0 1.01 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.17μs 0.748ns 2.9ns 0.0125 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.44μs 0.693ns 2.68ns 0.0122 0 0 912 B
master ExecuteAsync net472 1.62μs 0.807ns 3.13ns 0.139 0.000812 0 875 B
#4744 ExecuteAsync net6.0 1.13μs 0.615ns 2.3ns 0.0129 0 0 912 B
#4744 ExecuteAsync netcoreapp3.1 1.42μs 0.718ns 2.69ns 0.012 0 0 912 B
#4744 ExecuteAsync net472 1.62μs 0.48ns 1.73ns 0.138 0 0 875 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 3.83μs 2.71ns 10.1ns 0.0269 0 0 1.9 KB
master SendAsync netcoreapp3.1 4.35μs 1.85ns 7.15ns 0.033 0 0 2.43 KB
master SendAsync net472 7.15μs 4.12ns 16ns 0.475 0 0 2.99 KB
#4744 SendAsync net6.0 3.78μs 1.15ns 4.13ns 0.0265 0 0 1.9 KB
#4744 SendAsync netcoreapp3.1 4.32μs 2.17ns 8.13ns 0.0325 0 0 2.43 KB
#4744 SendAsync net472 7.07μs 2.13ns 8.27ns 0.474 0 0 2.99 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 1.42μs 0.586ns 2.19ns 0.0221 0 0 1.57 KB
master EnrichedLog netcoreapp3.1 1.93μs 0.649ns 2.34ns 0.0214 0 0 1.57 KB
master EnrichedLog net472 2.28μs 2.67ns 10ns 0.236 0 0 1.49 KB
#4744 EnrichedLog net6.0 1.46μs 0.506ns 1.96ns 0.0225 0 0 1.57 KB
#4744 EnrichedLog netcoreapp3.1 1.99μs 1.44ns 5.59ns 0.0209 0 0 1.57 KB
#4744 EnrichedLog net472 2.33μs 2.13ns 7.99ns 0.236 0 0 1.49 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 111μs 93.5ns 350ns 0.0553 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 119μs 103ns 386ns 0 0 0 4.21 KB
master EnrichedLog net472 147μs 102ns 395ns 0.664 0.221 0 4.38 KB
#4744 EnrichedLog net6.0 112μs 86.8ns 336ns 0.0559 0 0 4.21 KB
#4744 EnrichedLog netcoreapp3.1 116μs 167ns 646ns 0.0577 0 0 4.21 KB
#4744 EnrichedLog net472 147μs 188ns 728ns 0.657 0.219 0 4.38 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 2.89μs 1.16ns 4.35ns 0.0302 0 0 2.13 KB
master EnrichedLog netcoreapp3.1 3.84μs 1.14ns 4.12ns 0.0289 0 0 2.13 KB
master EnrichedLog net472 4.56μs 1.12ns 4.32ns 0.306 0 0 1.93 KB
#4744 EnrichedLog net6.0 2.94μs 0.988ns 3.82ns 0.0293 0 0 2.13 KB
#4744 EnrichedLog netcoreapp3.1 3.92μs 1.18ns 4.59ns 0.0293 0 0 2.13 KB
#4744 EnrichedLog net472 4.54μs 0.906ns 3.51ns 0.306 0 0 1.93 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.34μs 0.353ns 1.37ns 0.0156 0 0 1.1 KB
master SendReceive netcoreapp3.1 1.67μs 0.953ns 3.43ns 0.015 0 0 1.1 KB
master SendReceive net472 2.01μs 1.85ns 6.68ns 0.177 0 0 1.12 KB
#4744 SendReceive net6.0 1.27μs 3.6ns 13.5ns 0.0157 0 0 1.1 KB
#4744 SendReceive netcoreapp3.1 1.64μs 0.533ns 1.99ns 0.0147 0 0 1.1 KB
#4744 SendReceive net472 1.98μs 0.914ns 3.3ns 0.177 0 0 1.12 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 2.66μs 1.01ns 3.77ns 0.0213 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.68μs 1.13ns 4.24ns 0.0202 0 0 1.58 KB
master EnrichedLog net472 3.99μs 1.91ns 7.39ns 0.311 0 0 1.96 KB
#4744 EnrichedLog net6.0 2.56μs 0.967ns 3.62ns 0.0216 0 0 1.53 KB
#4744 EnrichedLog netcoreapp3.1 3.55μs 0.824ns 3.19ns 0.0212 0 0 1.58 KB
#4744 EnrichedLog net472 4.04μs 1.11ns 4.02ns 0.311 0 0 1.96 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4744

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.305 596.68 457.22

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 452ns 0.275ns 1.03ns 0.00739 0 0 536 B
master StartFinishSpan netcoreapp3.1 568ns 0.506ns 1.89ns 0.00712 0 0 536 B
master StartFinishSpan net472 710ns 0.156ns 0.606ns 0.0854 0 0 538 B
master StartFinishScope net6.0 596ns 0.163ns 0.633ns 0.00922 0 0 656 B
master StartFinishScope netcoreapp3.1 730ns 0.168ns 0.605ns 0.00874 0 0 656 B
master StartFinishScope net472 846ns 0.401ns 1.55ns 0.0981 0 0 618 B
#4744 StartFinishSpan net6.0 464ns 0.147ns 0.57ns 0.00741 0 0 536 B
#4744 StartFinishSpan netcoreapp3.1 599ns 0.162ns 0.584ns 0.00724 0 0 536 B
#4744 StartFinishSpan net472 643ns 0.163ns 0.629ns 0.0852 0 0 538 B
#4744 StartFinishScope net6.0 457ns 0.166ns 0.642ns 0.00919 0 0 656 B
#4744 StartFinishScope netcoreapp3.1 692ns 0.35ns 1.31ns 0.00896 0 0 656 B
#4744 StartFinishScope net472 866ns 0.948ns 3.67ns 0.0978 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4744

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.130 668.02 591.03

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 668ns 0.326ns 1.26ns 0.00929 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 802ns 2.33ns 8.7ns 0.00882 0 0 656 B
master RunOnMethodBegin net472 1.05μs 0.164ns 0.637ns 0.0982 0 0 618 B
#4744 RunOnMethodBegin net6.0 591ns 0.201ns 0.779ns 0.00925 0 0 656 B
#4744 RunOnMethodBegin netcoreapp3.1 763ns 1.54ns 5.98ns 0.00873 0 0 656 B
#4744 RunOnMethodBegin net472 1.01μs 0.187ns 0.7ns 0.0981 0 0 618 B

@andrewlock andrewlock merged commit 9f5022c into master Oct 25, 2023
@andrewlock andrewlock deleted the andrew/fix-dsm branch October 25, 2023 09:33
@github-actions github-actions bot added this to the vNext milestone Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants