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

Add full null checking to MongoDB and AWS.SDK integrations #4815

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

andrewlock
Copy link
Member

Summary of changes

  • Added missing sourcelink tags to mongodb snapshots (found with a full test run)
  • Add ? to all the mongodb ducktypes to ensure full checking
  • Add ? to all the AWS SDK ducktypes to ensure full checking

Reason for change

We know that the mongo and AWS SDK are generating a lot of errors. Given the try-catch we currently have, these seem like the most likely issues (without further details)

Implementation details

Followed the advice from the documentation on handling nullability.

Test coverage

Ran "full" test runs for both the MongoDb tests and the AWS.SDK.SQS (to test the sdk integration). There were some missing tags on the snapshots from the .NET 8 upgrade, but I added them before making the change and confirmed the full tests passed both before and after my changes

Other details

I wonder if we should add when (ex is not DuckTypeException) to the try catch handlers, so that we disable the integration if a duck typing error happens? 🤔 If a DuckTypeException happens in production, it will likely be an issue on every invocation, so this exception typically triggers us to disable the integration. By using a blanket try{}catch(Exception ex) we are potentially causing more issues than letting them bubble up? I didn't make the change in this PR because we know that's not the source of the errors we're aware of.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This proxy is apparently unused

namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.MongoDb
{
/// <summary>
/// MongoDB.Bson.BsonDocument interface for duck-typing
/// </summary>
internal class BsonDocumentProxy
internal interface IBsonDocumentProxy : IDuckType
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per recommendations - favor interface proxies over classes

Copy link
Contributor

github-actions bot commented Nov 3, 2023

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

19 occurrences of :

+      _dd.git.commit.sha: aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbb,
+      _dd.git.repository_url: https://github.com/DataDog/dd-trace-dotnet,

27 occurrences of :

+      _dd.git.commit.sha: aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbb,
+      _dd.git.repository_url: https://github.com/DataDog/dd-trace-dotnet

{
return default;
}
public BsonElementStruct GetElement(int index);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BsonElement this is ducktyping is a struct, so the return type here must be non-nullable. Currently you get a weird runtime exception if you try to use this:

                     //👇 Can't use this
public BsonElementStruct? GetElement(int index);

as it gives this:

Unable to access IWireProtocol.Command properties. Datadog.Trace.DuckTyping.DuckTypeDuckCopyStructDoesNotContainsAnyField: The [DuckCopy] struct 'System.Nullable`1[[Datadog.Trace.ClrProfiler.AutoInstrumentation.MongoDb.BsonElementStruct, Datadog.Trace, Version=2.41.0.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb]]' does not contains any public field. Remember that DuckCopy proxies must be declared using fields instead of properties.

It's incorrect to use BsonElementStruct? in this case, but the exception we throw is "wrong". I'll follow up separately so that we check for the struct/Nullable<struct> mismatch and throw an appropriate exception

@andrewlock andrewlock changed the title Add full null checking to mongo and AWS integrations Add full null checking to MongoDB and AWS.SDK integrations Nov 3, 2023
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Nov 3, 2023

Datadog Report

Branch report: andrew/add-nulls-to-mongo
Commit report: 97a04a8

dd-trace-dotnet: 0 Failed, 0 New Flaky, 300400 Passed, 950 Skipped, 36m 52.77s Wall Time

@andrewlock
Copy link
Member Author

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 (4815) - mean (70ms)  : 64, 75
     .   : milestone, 70,
    master - mean (71ms)  : 62, 80
     .   : milestone, 71,

    section CallTarget+Inlining+NGEN
    This PR (4815) - mean (1,000ms)  : 976, 1024
     .   : milestone, 1000,
    master - mean (1,004ms)  : 981, 1027
     .   : milestone, 1004,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4815) - mean (106ms)  : 103, 110
     .   : milestone, 106,
    master - mean (106ms)  : 103, 109
     .   : milestone, 106,

    section CallTarget+Inlining+NGEN
    This PR (4815) - mean (689ms)  : 672, 707
     .   : milestone, 689,
    master - mean (687ms)  : 671, 702
     .   : milestone, 687,

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

    section CallTarget+Inlining+NGEN
    This PR (4815) - mean (655ms)  : 631, 678
     .   : milestone, 655,
    master - mean (655ms)  : 635, 674
     .   : milestone, 655,

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

    section CallTarget+Inlining+NGEN
    This PR (4815) - mean (1,133ms)  : 1110, 1156
     .   : milestone, 1133,
    master - mean (1,129ms)  : 1110, 1148
     .   : milestone, 1129,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4815) - mean (270ms)  : 266, 275
     .   : milestone, 270,
    master - mean (271ms)  : 266, 275
     .   : milestone, 271,

    section CallTarget+Inlining+NGEN
    This PR (4815) - mean (1,098ms)  : 1076, 1120
     .   : milestone, 1098,
    master - mean (1,093ms)  : 1068, 1117
     .   : milestone, 1093,

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

    section CallTarget+Inlining+NGEN
    This PR (4815) - mean (1,062ms)  : 1028, 1095
     .   : milestone, 1062,
    master - mean (1,065ms)  : 1037, 1093
     .   : milestone, 1065,

Loading

Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on the AWS SDK integration side!

@andrewlock
Copy link
Member Author

Benchmarks Report 🐌

Benchmarks for #4815 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.147
  • 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.12μs 38.2ns 153ns 0.0159 0.00795 0 7.29 KB
master StartStopWithChild netcoreapp3.1 10.2μs 56.4ns 348ns 0.0308 0.0103 0 7.39 KB
master StartStopWithChild net472 15.5μs 73.4ns 284ns 1.27 0.299 0.0945 7.67 KB
#4815 StartStopWithChild net6.0 8.23μs 47.1ns 362ns 0.0352 0.0117 0 7.29 KB
#4815 StartStopWithChild netcoreapp3.1 10.1μs 55.5ns 342ns 0.0204 0.0102 0 7.38 KB
#4815 StartStopWithChild net472 15.6μs 36.5ns 137ns 1.28 0.332 0.0906 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 468μs 226ns 877ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 619μs 276ns 955ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 805μs 394ns 1.47μs 0.403 0 0 3.3 KB
#4815 WriteAndFlushEnrichedTraces net6.0 477μs 162ns 605ns 0 0 0 2.7 KB
#4815 WriteAndFlushEnrichedTraces netcoreapp3.1 636μs 275ns 1.03μs 0 0 0 2.7 KB
#4815 WriteAndFlushEnrichedTraces net472 798μs 523ns 1.96μs 0.398 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 44μs 33.2ns 128ns 0.0222 0 0 2.03 KB
master AllCycleSimpleBody netcoreapp3.1 45.8μs 77.6ns 310ns 0.0233 0 0 2.01 KB
master AllCycleSimpleBody net472 46.6μs 93.5ns 350ns 0.319 0 0 2.08 KB
master AllCycleMoreComplexBody net6.0 232μs 97.3ns 377ns 0.116 0 0 8.63 KB
master AllCycleMoreComplexBody netcoreapp3.1 235μs 187ns 725ns 0.118 0 0 8.52 KB
master AllCycleMoreComplexBody net472 240μs 125ns 485ns 1.32 0 0 8.7 KB
master ObjectExtractorSimpleBody net6.0 120ns 0.0958ns 0.371ns 0.00397 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 177ns 0.103ns 0.386ns 0.00367 0 0 272 B
master ObjectExtractorSimpleBody net472 145ns 0.144ns 0.559ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.01μs 1.74ns 6.52ns 0.0544 0 0 3.88 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.14μs 1.93ns 7.23ns 0.0499 0 0 3.78 KB
master ObjectExtractorMoreComplexBody net472 4.17μs 2.94ns 11.4ns 0.618 0.00624 0 3.89 KB
#4815 AllCycleSimpleBody net6.0 42.4μs 164ns 635ns 0.0209 0 0 2.03 KB
#4815 AllCycleSimpleBody netcoreapp3.1 45.7μs 43.7ns 163ns 0.0226 0 0 2.01 KB
#4815 AllCycleSimpleBody net472 47.3μs 17.1ns 66.3ns 0.323 0 0 2.08 KB
#4815 AllCycleMoreComplexBody net6.0 230μs 63.8ns 247ns 0 0 0 8.63 KB
#4815 AllCycleMoreComplexBody netcoreapp3.1 236μs 75.7ns 273ns 0.118 0 0 8.52 KB
#4815 AllCycleMoreComplexBody net472 238μs 106ns 409ns 1.32 0 0 8.7 KB
#4815 ObjectExtractorSimpleBody net6.0 120ns 0.041ns 0.142ns 0.00396 0 0 280 B
#4815 ObjectExtractorSimpleBody netcoreapp3.1 179ns 0.0604ns 0.226ns 0.00369 0 0 272 B
#4815 ObjectExtractorSimpleBody net472 146ns 0.0964ns 0.361ns 0.0446 0 0 281 B
#4815 ObjectExtractorMoreComplexBody net6.0 3.09μs 1.72ns 6.42ns 0.0541 0 0 3.88 KB
#4815 ObjectExtractorMoreComplexBody netcoreapp3.1 4.1μs 1.62ns 6.27ns 0.0512 0 0 3.78 KB
#4815 ObjectExtractorMoreComplexBody net472 4.16μs 2.67ns 10.4ns 0.617 0.00623 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.5μs 6.41ns 24ns 0.132 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 19.5μs 6.84ns 25.6ns 0.127 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) net472 28.2μs 14ns 52.6ns 1.5 0 0 9.48 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 75.2μs 33.1ns 120ns 0.226 0 0 15.77 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 85.7μs 232ns 835ns 0.171 0 0 15.72 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 98.4μs 179ns 671ns 2.51 0 0 16.04 KB
master RunWaf(args=NestedMap (100)) net6.0 24.4μs 7.99ns 28.8ns 0.271 0 0 19.66 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 37.9μs 19ns 68.4ns 0.284 0 0 20.42 KB
master RunWaf(args=NestedMap (100)) net472 57.2μs 35.1ns 131ns 3.27 0.0285 0 20.63 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 90.3μs 117ns 453ns 0.365 0 0 26.01 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 109μs 282ns 1.06μs 0.327 0 0 26.72 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 129μs 102ns 394ns 4.3 0.0642 0 27.19 KB
master RunWaf(args=NestedMap (20)) net6.0 23.9μs 7.49ns 27ns 0.273 0 0 19.4 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 37.6μs 48.9ns 183ns 0.263 0 0 19.84 KB
master RunWaf(args=NestedMap (20)) net472 53.5μs 15.1ns 56.7ns 3.17 0.0533 0 20.04 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 92.2μs 33.4ns 129ns 0.325 0 0 25.74 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 109μs 176ns 682ns 0.328 0 0 26.14 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 129μs 115ns 443ns 4.18 0.0644 0 26.6 KB
#4815 RunWaf(args=NestedMap (10)) net6.0 12.7μs 4.14ns 16ns 0.133 0 0 9.42 KB
#4815 RunWaf(args=NestedMap (10)) netcoreapp3.1 19.4μs 9.07ns 32.7ns 0.126 0 0 9.42 KB
#4815 RunWaf(args=NestedMap (10)) net472 28.5μs 23.9ns 92.5ns 1.5 0 0 9.48 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 76μs 36.1ns 135ns 0.227 0 0 15.77 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 86.7μs 124ns 480ns 0.174 0 0 15.72 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [22]) net472 98.8μs 73.4ns 284ns 2.5 0 0 16.04 KB
#4815 RunWaf(args=NestedMap (100)) net6.0 24.3μs 10.7ns 38.6ns 0.269 0 0 19.66 KB
#4815 RunWaf(args=NestedMap (100)) netcoreapp3.1 38.2μs 23ns 88.9ns 0.266 0 0 20.42 KB
#4815 RunWaf(args=NestedMap (100)) net472 54.5μs 21ns 75.8ns 3.27 0.0273 0 20.63 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 92.2μs 40ns 155ns 0.323 0 0 26.01 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 110μs 267ns 926ns 0.327 0 0 26.72 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [23]) net472 132μs 44.9ns 168ns 4.3 0.0652 0 27.19 KB
#4815 RunWaf(args=NestedMap (20)) net6.0 23.9μs 10.2ns 38ns 0.275 0 0 19.4 KB
#4815 RunWaf(args=NestedMap (20)) netcoreapp3.1 38.6μs 21.9ns 84.9ns 0.25 0 0 19.84 KB
#4815 RunWaf(args=NestedMap (20)) net472 56.7μs 14ns 52.3ns 3.17 0.0566 0 20.04 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 91.1μs 42.3ns 147ns 0.365 0 0 25.74 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 111μs 230ns 892ns 0.335 0 0 26.14 KB
#4815 RunWafWithAttack(args=Neste(...)tack) [22]) net472 134μs 70.3ns 272ns 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 169μs 146ns 567ns 0.169 0 0 18.04 KB
master SendRequest netcoreapp3.1 191μs 374ns 1.45μs 0.188 0 0 20.2 KB
master SendRequest net472 0.000828ns 0.000236ns 0.000916ns 0 0 0 0 b
#4815 SendRequest net6.0 166μs 175ns 679ns 0.249 0 0 18.04 KB
#4815 SendRequest netcoreapp3.1 189μs 307ns 1.15μs 0.19 0 0 20.2 KB
#4815 SendRequest net472 0.0011ns 0.000432ns 0.00167ns 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 538μs 1.51μs 5.86μs 0.532 0 0 41.76 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 662μs 1.44μs 5.57μs 0.329 0 0 41.74 KB
master WriteAndFlushEnrichedTraces net472 851μs 4.01μs 15.5μs 8.25 2.6 0.434 53.25 KB
#4815 WriteAndFlushEnrichedTraces net6.0 545μs 1.58μs 6.12μs 0.521 0 0 41.68 KB
#4815 WriteAndFlushEnrichedTraces netcoreapp3.1 645μs 1.08μs 4.05μs 0.326 0 0 41.79 KB
#4815 WriteAndFlushEnrichedTraces net472 816μs 4.03μs 16.6μs 8.45 2.53 0.422 53.24 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.08μs 1.31ns 5.08ns 0.0107 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.39μs 0.453ns 1.7ns 0.0104 0 0 768 B
master ExecuteNonQuery net472 1.65μs 2.29ns 8.85ns 0.115 0 0 730 B
#4815 ExecuteNonQuery net6.0 1μs 0.771ns 2.67ns 0.0107 0 0 768 B
#4815 ExecuteNonQuery netcoreapp3.1 1.39μs 0.489ns 1.76ns 0.0097 0 0 768 B
#4815 ExecuteNonQuery net472 1.61μs 3.09ns 12ns 0.116 0 0 730 B
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4815

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 1.171 1,334.94 1,140.17
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 1.120 1,449.44 1,293.96

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.17μs 0.542ns 2.03ns 0.0133 0 0 936 B
master CallElasticsearch netcoreapp3.1 1.45μs 0.696ns 2.41ns 0.0125 0 0 936 B
master CallElasticsearch net472 2.36μs 0.476ns 1.84ns 0.152 0 0 955 B
master CallElasticsearchAsync net6.0 1.34μs 0.453ns 1.69ns 0.0127 0 0 912 B
master CallElasticsearchAsync netcoreapp3.1 1.42μs 1.81ns 6.79ns 0.0127 0 0 984 B
master CallElasticsearchAsync net472 2.45μs 2.57ns 9.94ns 0.16 0 0 1.01 KB
#4815 CallElasticsearch net6.0 1.24μs 0.705ns 2.64ns 0.013 0 0 936 B
#4815 CallElasticsearch netcoreapp3.1 1.29μs 0.629ns 2.43ns 0.0124 0 0 936 B
#4815 CallElasticsearch net472 2.41μs 0.447ns 1.73ns 0.151 0 0 955 B
#4815 CallElasticsearchAsync net6.0 1.14μs 0.31ns 1.2ns 0.0126 0 0 912 B
#4815 CallElasticsearchAsync netcoreapp3.1 1.49μs 0.854ns 3.19ns 0.0134 0 0 984 B
#4815 CallElasticsearchAsync net472 2.43μs 0.876ns 3.39ns 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.2μs 0.736ns 2.85ns 0.0126 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.55μs 0.45ns 1.68ns 0.0124 0 0 912 B
master ExecuteAsync net472 1.72μs 1.43ns 5.53ns 0.139 0 0 875 B
#4815 ExecuteAsync net6.0 1.19μs 1.96ns 7.58ns 0.0126 0 0 912 B
#4815 ExecuteAsync netcoreapp3.1 1.58μs 0.452ns 1.69ns 0.0118 0 0 912 B
#4815 ExecuteAsync net472 1.64μs 0.897ns 3.35ns 0.139 0.000821 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.7μs 1.27ns 4.74ns 0.026 0 0 1.9 KB
master SendAsync netcoreapp3.1 4.45μs 2.37ns 8.87ns 0.0333 0 0 2.43 KB
master SendAsync net472 7.13μs 3.16ns 12.2ns 0.472 0 0 2.99 KB
#4815 SendAsync net6.0 3.87μs 1.64ns 6.13ns 0.0252 0 0 1.9 KB
#4815 SendAsync netcoreapp3.1 4.54μs 1.64ns 6.12ns 0.0317 0 0 2.43 KB
#4815 SendAsync net472 7.09μs 2.48ns 9.59ns 0.473 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.3μs 0.483ns 1.81ns 0.0218 0 0 1.57 KB
master EnrichedLog netcoreapp3.1 1.97μs 2.68ns 10ns 0.0212 0 0 1.57 KB
master EnrichedLog net472 2.31μs 1.14ns 4.27ns 0.237 0 0 1.49 KB
#4815 EnrichedLog net6.0 1.33μs 0.36ns 1.25ns 0.0222 0 0 1.57 KB
#4815 EnrichedLog netcoreapp3.1 2.1μs 1.14ns 4.27ns 0.0216 0 0 1.57 KB
#4815 EnrichedLog net472 2.4μs 1.74ns 6.28ns 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 113μs 82.3ns 319ns 0.0569 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 117μs 178ns 688ns 0.0582 0 0 4.21 KB
master EnrichedLog net472 146μs 53.6ns 201ns 0.656 0.219 0 4.38 KB
#4815 EnrichedLog net6.0 111μs 82.3ns 319ns 0.0553 0 0 4.21 KB
#4815 EnrichedLog netcoreapp3.1 118μs 175ns 654ns 0 0 0 4.21 KB
#4815 EnrichedLog net472 147μs 237ns 919ns 0.67 0.223 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.92μs 0.773ns 2.89ns 0.0305 0 0 2.13 KB
master EnrichedLog netcoreapp3.1 3.82μs 1.69ns 6.55ns 0.0286 0 0 2.13 KB
master EnrichedLog net472 4.49μs 1.79ns 6.69ns 0.307 0 0 1.93 KB
#4815 EnrichedLog net6.0 2.91μs 1.13ns 4.22ns 0.0291 0 0 2.13 KB
#4815 EnrichedLog netcoreapp3.1 3.88μs 0.812ns 2.93ns 0.0292 0 0 2.13 KB
#4815 EnrichedLog net472 4.58μs 2.4ns 8.64ns 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.36μs 0.644ns 2.41ns 0.0156 0 0 1.1 KB
master SendReceive netcoreapp3.1 1.62μs 0.599ns 2.32ns 0.0147 0 0 1.1 KB
master SendReceive net472 2.05μs 1.99ns 7.18ns 0.177 0 0 1.12 KB
#4815 SendReceive net6.0 1.28μs 0.888ns 3.44ns 0.0152 0 0 1.1 KB
#4815 SendReceive netcoreapp3.1 1.63μs 0.944ns 3.66ns 0.0147 0 0 1.1 KB
#4815 SendReceive net472 1.86μs 1.88ns 7.27ns 0.177 0.000924 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.57μs 1.36ns 5.26ns 0.0206 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.46μs 1.43ns 5.53ns 0.0206 0 0 1.58 KB
master EnrichedLog net472 4.1μs 2.13ns 8.25ns 0.31 0 0 1.96 KB
#4815 EnrichedLog net6.0 2.7μs 1.75ns 6.79ns 0.0203 0 0 1.53 KB
#4815 EnrichedLog netcoreapp3.1 3.57μs 3.54ns 13.2ns 0.0213 0 0 1.58 KB
#4815 EnrichedLog net472 4μs 1.25ns 4.85ns 0.311 0 0 1.96 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4815

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 1.152 733.73 636.94

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 442ns 0.305ns 1.14ns 0.00759 0 0 536 B
master StartFinishSpan netcoreapp3.1 636ns 0.206ns 0.797ns 0.00731 0 0 536 B
master StartFinishSpan net472 734ns 0.149ns 0.558ns 0.0852 0 0 538 B
master StartFinishScope net6.0 507ns 0.112ns 0.435ns 0.00927 0 0 656 B
master StartFinishScope netcoreapp3.1 673ns 0.17ns 0.613ns 0.00874 0 0 656 B
master StartFinishScope net472 804ns 0.71ns 2.75ns 0.098 0 0 618 B
#4815 StartFinishSpan net6.0 460ns 0.226ns 0.875ns 0.00762 0 0 536 B
#4815 StartFinishSpan netcoreapp3.1 591ns 2.66ns 10.3ns 0.00725 0 0 536 B
#4815 StartFinishSpan net472 637ns 0.115ns 0.445ns 0.0853 0 0 538 B
#4815 StartFinishScope net6.0 530ns 0.306ns 1.18ns 0.00926 0 0 656 B
#4815 StartFinishScope netcoreapp3.1 716ns 0.283ns 0.981ns 0.00886 0 0 656 B
#4815 StartFinishScope net472 831ns 0.363ns 1.41ns 0.0979 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 612ns 0.365ns 1.41ns 0.00923 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 849ns 0.239ns 0.925ns 0.00888 0 0 656 B
master RunOnMethodBegin net472 981ns 0.452ns 1.75ns 0.0977 0 0 618 B
#4815 RunOnMethodBegin net6.0 627ns 0.313ns 1.83ns 0.00911 0 0 656 B
#4815 RunOnMethodBegin netcoreapp3.1 789ns 0.267ns 0.998ns 0.00914 0 0 656 B
#4815 RunOnMethodBegin net472 1.02μs 0.358ns 1.34ns 0.0977 0 0 618 B

Copy link
Collaborator

@pierotibou pierotibou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small questions on snapshots

@@ -15,6 +15,8 @@
runtime-id: Guid_2,
span.kind: internal,
version: 1.0.0,
_dd.git.commit.sha: aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbb,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why the snapshots are changed with those changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are due to the .NET 8 update. The .NET 8 SDK adds sourcelink by default to all apps. Which means we then extract them and add them to the tags (for source code integration support).

They're added here, because this snapshot doesn't run by "default", only when you do the comprehensive testing. And due to space issues we can't run comprehensive testing on more than one integration at a time. So I couldn't necessarily update all the snapshots in the original .NET 8 PR.

@andrewlock
Copy link
Member Author

Throughput/Crank Report:zap:

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4815) (10.876M)   : 0, 10876186
    master (11.190M)   : 0, 11189506
    benchmarks/2.38.0 (11.867M)   : 0, 11866956
    benchmarks/2.9.0 (11.214M)   : 0, 11213739

    section Automatic
    This PR (4815) (7.455M)   : 0, 7455085
    master (7.662M)   : 0, 7661933
    benchmarks/2.38.0 (8.176M)   : 0, 8175636
    benchmarks/2.9.0 (8.133M)   : 0, 8132928

    section Trace stats
    This PR (4815) (7.876M)   : 0, 7875914
    master (7.979M)   : 0, 7978675
    benchmarks/2.38.0 (8.450M)   : 0, 8450370

    section Manual
    This PR (4815) (9.615M)   : 0, 9614994
    master (9.992M)   : 0, 9991660
    benchmarks/2.38.0 (10.334M)   : 0, 10334368

    section Manual + Automatic
    This PR (4815) (7.263M)   : 0, 7262933
    master (7.444M)   : 0, 7444109
    benchmarks/2.38.0 (7.750M)   : 0, 7750484

    section Version Conflict
    This PR (4815) (6.516M)   : crit ,0, 6515615
    master (6.943M)   : 0, 6943141
    benchmarks/2.38.0 (7.137M)   : 0, 7136691

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4815) (9.648M)   : 0, 9647691
    master (9.472M)   : 0, 9471773
    benchmarks/2.38.0 (9.548M)   : 0, 9548121
    benchmarks/2.9.0 (9.641M)   : 0, 9640617

    section Automatic
    This PR (4815) (6.863M)   : 0, 6862528
    master (6.761M)   : 0, 6760928
    benchmarks/2.38.0 (6.747M)   : 0, 6747227

    section Trace stats
    This PR (4815) (6.932M)   : 0, 6931535
    master (6.896M)   : 0, 6895808
    benchmarks/2.38.0 (6.815M)   : 0, 6814846

    section Manual
    This PR (4815) (8.487M)   : 0, 8487160
    master (8.385M)   : 0, 8385337
    benchmarks/2.38.0 (8.263M)   : 0, 8263131

    section Manual + Automatic
    This PR (4815) (6.303M)   : 0, 6303256
    master (6.241M)   : 0, 6241427
    benchmarks/2.38.0 (6.275M)   : 0, 6275411

    section Version Conflict
    This PR (4815) (5.820M)   : 0, 5820040
    master (5.795M)   : 0, 5794842
    benchmarks/2.38.0 (5.670M)   : 0, 5669744

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4815) (9.579M)   : 0, 9579403
    master (9.519M)   : 0, 9519293
    benchmarks/2.38.0 (9.007M)   : 0, 9007066
    benchmarks/2.9.0 (9.513M)   : 0, 9513070

    section Automatic
    This PR (4815) (6.797M)   : 0, 6797111
    master (6.777M)   : 0, 6777138
    benchmarks/2.38.0 (6.423M)   : 0, 6422756
    benchmarks/2.9.0 (7.072M)   : 0, 7072421

    section Trace stats
    This PR (4815) (6.975M)   : 0, 6975297
    master (7.084M)   : 0, 7084302
    benchmarks/2.38.0 (6.721M)   : 0, 6720838

    section Manual
    This PR (4815) (8.629M)   : 0, 8628730
    master (8.397M)   : 0, 8397251
    benchmarks/2.38.0 (7.977M)   : 0, 7977494

    section Manual + Automatic
    This PR (4815) (6.528M)   : 0, 6527612
    master (6.486M)   : 0, 6485815
    benchmarks/2.38.0 (6.349M)   : 0, 6349066

    section Version Conflict
    This PR (4815) (6.030M)   : 0, 6029608
    master (5.962M)   : 0, 5961832
    benchmarks/2.38.0 (5.682M)   : 0, 5681654

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    master (7.504M)   : 0, 7503869
    benchmarks/2.38.0 (7.578M)   : 0, 7577544
    benchmarks/2.9.0 (7.918M)   : 0, 7917536

    section No attack
    master (2.135M)   : 0, 2134909
    benchmarks/2.38.0 (2.184M)   : 0, 2184279
    benchmarks/2.9.0 (3.233M)   : 0, 3233469

    section Attack
    master (1.725M)   : 0, 1724804
    benchmarks/2.38.0 (1.711M)   : 0, 1710542
    benchmarks/2.9.0 (2.584M)   : 0, 2583750

    section Blocking
    master (3.406M)   : 0, 3406408
    benchmarks/2.38.0 (3.486M)   : 0, 3486124

    section IAST default
    master (6.764M)   : 0, 6763534

    section IAST full
    master (6.158M)   : 0, 6158423

    section Base vuln
    master (0.943M)   : 0, 943414

    section IAST vuln
    master (0.917M)   : 0, 917290

Loading

@andrewlock andrewlock merged commit d135982 into master Nov 6, 2023
56 checks passed
@andrewlock andrewlock deleted the andrew/add-nulls-to-mongo branch November 6, 2023 12:59
@github-actions github-actions bot added this to the vNext milestone Nov 6, 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