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

Refactor LifetimeManager callbacks for UnhandledException #5557

Merged
merged 5 commits into from
May 15, 2024

Conversation

andrewlock
Copy link
Member

Summary of changes

  • Change the callbacks from Action/Func<Task> to Action<Exception?>/Func<Exception?, Task

Reason for change

In #5549 we needed to track when the application was shutting down from an UnhandledException, and use this information in the shutdown callbacks. That PR added a public static property for simplicity. This PR refactors that slightly, so that there's no static state to check, and instead we pass the Exception directly to the callbacks.

Implementation details

Mostly just changed the definition of the callbacks to accept an Exception?.

I considered creating a "context" object something like this:

public class ShutdownContext
{
    public Exception UnhandledException { get; }
}

which would be future-proof, but it seems a bit overkill at this stage, especially as it's an easy refactoring to make.

Test coverage

Covered by existing tests

Other details

@andrewlock andrewlock added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:refactor labels May 13, 2024
@andrewlock andrewlock requested review from a team as code owners May 13, 2024 10:59
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented May 13, 2024

Datadog Report

Branch report: andrew/refactor-lifetime-manager
Commit report: 324d922
Test service: dd-trace-dotnet

✅ 0 Failed, 332441 Passed, 2033 Skipped, 22h 25m 14.75s Total Time

Copy link
Member

@tonyredondo tonyredondo left a comment

Choose a reason for hiding this comment

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

LGTM

tracer/src/Datadog.Trace/Ci/CIVisibility.cs Outdated Show resolved Hide resolved
tracer/src/Datadog.Trace/Ci/CIVisibility.cs Outdated Show resolved Hide resolved
tracer/src/Datadog.Trace/Ci/CIVisibility.cs Outdated Show resolved Hide resolved
tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs Outdated Show resolved Hide resolved
tracer/src/Datadog.Trace/TraceClock.cs Outdated Show resolved Hide resolved
@andrewlock andrewlock force-pushed the andrew/refactor-lifetime-manager branch from b037dcb to f186113 Compare May 13, 2024 14:16
Co-authored-by: Kevin Gosse <kevin.gosse@datadoghq.com>
@andrewlock andrewlock force-pushed the andrew/refactor-lifetime-manager branch from f186113 to 324d922 Compare May 13, 2024 14:34
@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 (5557) - mean (75ms)  : 65, 85
     .   : milestone, 75,
    master - mean (75ms)  : 66, 83
     .   : milestone, 75,

    section CallTarget+Inlining+NGEN
    This PR (5557) - mean (1,002ms)  : 978, 1026
     .   : milestone, 1002,
    master - mean (1,005ms)  : 981, 1029
     .   : milestone, 1005,

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

    section CallTarget+Inlining+NGEN
    This PR (5557) - mean (720ms)  : 692, 747
     .   : milestone, 720,
    master - mean (724ms)  : 698, 749
     .   : milestone, 724,

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

    section CallTarget+Inlining+NGEN
    This PR (5557) - mean (675ms)  : 654, 697
     .   : milestone, 675,
    master - mean (678ms)  : 658, 699
     .   : milestone, 678,

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

    section CallTarget+Inlining+NGEN
    This PR (5557) - mean (1,094ms)  : 1058, 1129
     .   : milestone, 1094,
    master - mean (1,075ms)  : 1052, 1098
     .   : milestone, 1075,

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

    section CallTarget+Inlining+NGEN
    This PR (5557) - mean (875ms)  : 841, 909
     .   : milestone, 875,
    master - mean (860ms)  : 837, 882
     .   : milestone, 860,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5557) - mean (266ms)  : 262, 271
     .   : milestone, 266,
    master - mean (264ms)  : 260, 268
     .   : milestone, 264,

    section CallTarget+Inlining+NGEN
    This PR (5557) - mean (852ms)  : 826, 878
     .   : milestone, 852,
    master - mean (850ms)  : 820, 881
     .   : milestone, 850,

Loading

@andrewlock
Copy link
Member Author

Benchmarks Report for tracer 🐌

Benchmarks for #5557 compared to master:

  • All benchmarks have the same speed
  • 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.91μs 50.6ns 347ns 0.0208 0.00834 0 7.55 KB
master StartStopWithChild netcoreapp3.1 10.8μs 52.9ns 237ns 0.0217 0.0109 0 7.65 KB
master StartStopWithChild net472 17.3μs 49.9ns 193ns 1.39 0.408 0.119 8.1 KB
#5557 StartStopWithChild net6.0 8.77μs 48.2ns 273ns 0.0215 0.00859 0 7.56 KB
#5557 StartStopWithChild netcoreapp3.1 10.8μs 55.1ns 247ns 0.0381 0.0163 0 7.65 KB
#5557 StartStopWithChild net472 17.1μs 50.9ns 197ns 1.38 0.379 0.112 8.11 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 471μs 182ns 706ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 625μs 104ns 389ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 827μs 314ns 1.22μs 0.414 0 0 3.3 KB
#5557 WriteAndFlushEnrichedTraces net6.0 475μs 251ns 972ns 0 0 0 2.7 KB
#5557 WriteAndFlushEnrichedTraces netcoreapp3.1 647μs 285ns 1.07μs 0 0 0 2.7 KB
#5557 WriteAndFlushEnrichedTraces net472 834μs 378ns 1.47μs 0.417 0 0 3.3 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 167μs 113ns 424ns 0.25 0 0 18.49 KB
master SendRequest netcoreapp3.1 189μs 294ns 1.14μs 0.187 0 0 20.65 KB
master SendRequest net472 0.000232ns 0.000157ns 0.000565ns 0 0 0 0 b
#5557 SendRequest net6.0 169μs 148ns 575ns 0.253 0 0 18.49 KB
#5557 SendRequest netcoreapp3.1 190μs 430ns 1.66μs 0.19 0 0 20.65 KB
#5557 SendRequest net472 0.000435ns 0.000251ns 0.000938ns 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 549μs 787ns 3.05μs 0.551 0 0 41.77 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 661μs 966ns 3.61μs 0.334 0 0 41.72 KB
master WriteAndFlushEnrichedTraces net472 840μs 3.69μs 14.3μs 8.28 2.48 0.414 53.25 KB
#5557 WriteAndFlushEnrichedTraces net6.0 560μs 587ns 2.27μs 0.553 0 0 41.63 KB
#5557 WriteAndFlushEnrichedTraces netcoreapp3.1 661μs 1.43μs 5.55μs 0.329 0 0 41.57 KB
#5557 WriteAndFlushEnrichedTraces net472 850μs 2.88μs 11.1μs 8.25 2.6 0.434 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.2μs 0.633ns 2.45ns 0.0114 0 0 808 B
master ExecuteNonQuery netcoreapp3.1 1.51μs 0.618ns 2.4ns 0.0106 0 0 808 B
master ExecuteNonQuery net472 1.85μs 1.09ns 4.21ns 0.122 0 0 770 B
#5557 ExecuteNonQuery net6.0 1.18μs 0.358ns 1.29ns 0.0111 0 0 808 B
#5557 ExecuteNonQuery netcoreapp3.1 1.56μs 0.781ns 3.02ns 0.0104 0 0 808 B
#5557 ExecuteNonQuery net472 1.82μs 1.41ns 5.09ns 0.122 0 0 770 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.31μs 0.761ns 2.95ns 0.0144 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 1.64μs 2.08ns 8.05ns 0.0139 0 0 1.03 KB
master CallElasticsearch net472 2.45μs 2.02ns 7.83ns 0.165 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.34μs 0.613ns 2.29ns 0.014 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 1.81μs 1ns 3.89ns 0.0144 0 0 1.08 KB
master CallElasticsearchAsync net472 2.62μs 2.85ns 11ns 0.174 0 0 1.1 KB
#5557 CallElasticsearch net6.0 1.36μs 0.915ns 3.42ns 0.0144 0 0 1.03 KB
#5557 CallElasticsearch netcoreapp3.1 1.61μs 1.34ns 5.03ns 0.0139 0 0 1.03 KB
#5557 CallElasticsearch net472 2.58μs 2.09ns 8.11ns 0.165 0 0 1.04 KB
#5557 CallElasticsearchAsync net6.0 1.28μs 0.683ns 2.65ns 0.0142 0 0 1.01 KB
#5557 CallElasticsearchAsync netcoreapp3.1 1.7μs 1.25ns 4.84ns 0.0145 0 0 1.08 KB
#5557 CallElasticsearchAsync net472 2.68μs 1.75ns 6.54ns 0.174 0.00135 0 1.1 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.3μs 1.19ns 4.45ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.73μs 0.83ns 3.11ns 0.013 0 0 952 B
master ExecuteAsync net472 1.78μs 0.939ns 3.64ns 0.145 0 0 915 B
#5557 ExecuteAsync net6.0 1.3μs 0.504ns 1.88ns 0.013 0 0 952 B
#5557 ExecuteAsync netcoreapp3.1 1.66μs 4.4ns 17ns 0.0125 0 0 952 B
#5557 ExecuteAsync net472 1.86μs 0.569ns 2.21ns 0.145 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.29μs 2.85ns 11ns 0.032 0 0 2.27 KB
master SendAsync netcoreapp3.1 5.21μs 2.18ns 8.17ns 0.0364 0 0 2.81 KB
master SendAsync net472 7.86μs 2.39ns 9.24ns 0.504 0 0 3.18 KB
#5557 SendAsync net6.0 4.14μs 0.787ns 2.73ns 0.0312 0 0 2.27 KB
#5557 SendAsync netcoreapp3.1 5.22μs 1.72ns 6.43ns 0.0365 0 0 2.81 KB
#5557 SendAsync net472 7.95μs 3.15ns 12.2ns 0.503 0 0 3.18 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.53μs 0.659ns 2.55ns 0.0237 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 2.21μs 1.59ns 5.93ns 0.0223 0 0 1.7 KB
master EnrichedLog net472 2.7μs 1.6ns 6.2ns 0.257 0 0 1.62 KB
#5557 EnrichedLog net6.0 1.48μs 0.685ns 2.47ns 0.0235 0 0 1.7 KB
#5557 EnrichedLog netcoreapp3.1 2.25μs 3.54ns 13.7ns 0.0226 0 0 1.7 KB
#5557 EnrichedLog net472 2.71μs 1.28ns 4.95ns 0.257 0 0 1.62 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 114μs 162ns 628ns 0.0564 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 121μs 207ns 802ns 0 0 0 4.28 KB
master EnrichedLog net472 151μs 100ns 389ns 0.681 0.227 0 4.46 KB
#5557 EnrichedLog net6.0 114μs 129ns 501ns 0.0566 0 0 4.28 KB
#5557 EnrichedLog netcoreapp3.1 120μs 204ns 792ns 0.0602 0 0 4.28 KB
#5557 EnrichedLog net472 150μs 117ns 454ns 0.678 0.226 0 4.46 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 3.14μs 1ns 3.74ns 0.0315 0 0 2.25 KB
master EnrichedLog netcoreapp3.1 4.18μs 1.4ns 5.24ns 0.0313 0 0 2.25 KB
master EnrichedLog net472 4.97μs 0.932ns 3.36ns 0.327 0 0 2.07 KB
#5557 EnrichedLog net6.0 3.13μs 0.764ns 2.86ns 0.0314 0 0 2.25 KB
#5557 EnrichedLog netcoreapp3.1 4.21μs 1.88ns 7.28ns 0.0294 0 0 2.25 KB
#5557 EnrichedLog net472 4.76μs 1.96ns 7.61ns 0.327 0 0 2.07 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.47μs 0.619ns 2.23ns 0.0169 0 0 1.2 KB
master SendReceive netcoreapp3.1 1.84μs 0.673ns 2.61ns 0.0166 0 0 1.2 KB
master SendReceive net472 2.3μs 1.06ns 3.84ns 0.191 0 0 1.2 KB
#5557 SendReceive net6.0 1.38μs 0.856ns 3.31ns 0.0167 0 0 1.2 KB
#5557 SendReceive netcoreapp3.1 1.79μs 2.55ns 9.86ns 0.0161 0 0 1.2 KB
#5557 SendReceive net472 2.2μs 2.79ns 10.8ns 0.191 0 0 1.2 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.84μs 1.46ns 5.47ns 0.0226 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 4.02μs 5.71ns 22.1ns 0.0221 0 0 1.65 KB
master EnrichedLog net472 4.39μs 3.16ns 11.8ns 0.322 0 0 2.04 KB
#5557 EnrichedLog net6.0 2.78μs 0.892ns 3.34ns 0.022 0 0 1.6 KB
#5557 EnrichedLog netcoreapp3.1 3.99μs 5.41ns 20.9ns 0.0218 0 0 1.65 KB
#5557 EnrichedLog net472 4.42μs 2.26ns 8.45ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 538ns 0.213ns 0.825ns 0.00814 0 0 576 B
master StartFinishSpan netcoreapp3.1 756ns 0.324ns 1.21ns 0.00777 0 0 576 B
master StartFinishSpan net472 827ns 0.451ns 1.75ns 0.0915 0 0 578 B
master StartFinishScope net6.0 655ns 0.174ns 0.652ns 0.00959 0 0 696 B
master StartFinishScope netcoreapp3.1 919ns 0.291ns 1.09ns 0.00918 0 0 696 B
master StartFinishScope net472 989ns 1.09ns 3.93ns 0.104 0 0 658 B
#5557 StartFinishSpan net6.0 554ns 0.222ns 0.829ns 0.0081 0 0 576 B
#5557 StartFinishSpan netcoreapp3.1 765ns 0.892ns 3.34ns 0.00765 0 0 576 B
#5557 StartFinishSpan net472 824ns 0.807ns 3.12ns 0.0915 0 0 578 B
#5557 StartFinishScope net6.0 600ns 0.304ns 1.14ns 0.00964 0 0 696 B
#5557 StartFinishScope netcoreapp3.1 864ns 0.704ns 2.63ns 0.00927 0 0 696 B
#5557 StartFinishScope net472 950ns 0.491ns 1.84ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 673ns 0.243ns 0.94ns 0.00978 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 968ns 1.05ns 4.08ns 0.00914 0 0 696 B
master RunOnMethodBegin net472 1.2μs 0.462ns 1.73ns 0.104 0 0 658 B
#5557 RunOnMethodBegin net6.0 636ns 1.62ns 6.27ns 0.00991 0 0 696 B
#5557 RunOnMethodBegin netcoreapp3.1 966ns 0.399ns 1.55ns 0.00913 0 0 696 B
#5557 RunOnMethodBegin net472 1.16μs 0.312ns 1.21ns 0.104 0 0 658 B

@andrewlock
Copy link
Member Author

Benchmarks Report for appsec 🐌

Benchmarks for #5557 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.350
  • 1 benchmarks have fewer 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.Asm.AppSecBodyBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #5557

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑net6.0 1.350 185.84 137.61

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 72.6μs 88ns 341ns 0.0728 0 0 6 KB
master AllCycleSimpleBody netcoreapp3.1 62.5μs 84ns 314ns 0.0928 0 0 6.94 KB
master AllCycleSimpleBody net472 47.9μs 50.1ns 187ns 1.3 0 0 8.33 KB
master AllCycleMoreComplexBody net6.0 78μs 168ns 628ns 0.117 0 0 9.5 KB
master AllCycleMoreComplexBody netcoreapp3.1 70.5μs 90.9ns 352ns 0.106 0 0 10.36 KB
master AllCycleMoreComplexBody net472 55.6μs 93.8ns 363ns 1.88 0.0277 0 11.84 KB
master ObjectExtractorSimpleBody net6.0 186ns 0.0823ns 0.308ns 0.00395 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 207ns 0.273ns 1.06ns 0.00372 0 0 272 B
master ObjectExtractorSimpleBody net472 168ns 0.19ns 0.658ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.99μs 2.17ns 8.13ns 0.0537 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.87μs 1.43ns 5.53ns 0.0504 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.96μs 4.3ns 16.7ns 0.603 0.00601 0 3.8 KB
#5557 AllCycleSimpleBody net6.0 71.7μs 132ns 510ns 0.0708 0 0 6 KB
#5557 AllCycleSimpleBody netcoreapp3.1 62.3μs 88.3ns 342ns 0.0633 0 0 6.94 KB
#5557 AllCycleSimpleBody net472 48.5μs 69.5ns 269ns 1.32 0 0 8.33 KB
#5557 AllCycleMoreComplexBody net6.0 76.8μs 348ns 1.3μs 0.115 0 0 9.5 KB
#5557 AllCycleMoreComplexBody netcoreapp3.1 68.9μs 69.9ns 252ns 0.138 0 0 10.36 KB
#5557 AllCycleMoreComplexBody net472 55.1μs 49ns 183ns 1.88 0.0277 0 11.84 KB
#5557 ObjectExtractorSimpleBody net6.0 138ns 0.0624ns 0.233ns 0.00394 0 0 280 B
#5557 ObjectExtractorSimpleBody netcoreapp3.1 203ns 0.101ns 0.379ns 0.00368 0 0 272 B
#5557 ObjectExtractorSimpleBody net472 169ns 0.207ns 0.803ns 0.0446 0 0 281 B
#5557 ObjectExtractorMoreComplexBody net6.0 2.95μs 1.02ns 3.66ns 0.0532 0 0 3.78 KB
#5557 ObjectExtractorMoreComplexBody netcoreapp3.1 3.9μs 2.04ns 7.91ns 0.0505 0 0 3.69 KB
#5557 ObjectExtractorMoreComplexBody net472 4.37μs 2.34ns 9.05ns 0.602 0.00657 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 39.2μs 23.5ns 91.1ns 0.451 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 56.1μs 26ns 101ns 0.446 0 0 32.4 KB
master EncodeArgs net472 69μs 69.6ns 269ns 5.14 0.0689 0 32.5 KB
master EncodeLegacyArgs net6.0 73.9μs 28.1ns 105ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 106μs 424ns 1.64μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 151μs 117ns 455ns 0.303 0 0 2.15 KB
#5557 EncodeArgs net6.0 39.5μs 16.7ns 62.6ns 0.457 0 0 32.4 KB
#5557 EncodeArgs netcoreapp3.1 55.3μs 38.6ns 150ns 0.437 0 0 32.4 KB
#5557 EncodeArgs net472 68.6μs 48.1ns 186ns 5.14 0.0685 0 32.5 KB
#5557 EncodeLegacyArgs net6.0 81.8μs 39.4ns 147ns 0 0 0 2.14 KB
#5557 EncodeLegacyArgs netcoreapp3.1 104μs 107ns 416ns 0 0 0 2.14 KB
#5557 EncodeLegacyArgs net472 154μs 146ns 546ns 0.309 0 0 2.15 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 RunWafRealisticBenchmark net6.0 184μs 171ns 662ns 0 0 0 2.34 KB
master RunWafRealisticBenchmark netcoreapp3.1 195μs 81.1ns 303ns 0 0 0 2.3 KB
master RunWafRealisticBenchmark net472 214μs 109ns 422ns 0.321 0 0 2.36 KB
master RunWafRealisticBenchmarkWithAttack net6.0 122μs 212ns 820ns 0 0 0 1.44 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 132μs 193ns 748ns 0 0 0 1.42 KB
master RunWafRealisticBenchmarkWithAttack net472 142μs 41.7ns 156ns 0.213 0 0 1.45 KB
#5557 RunWafRealisticBenchmark net6.0 183μs 294ns 1.14μs 0 0 0 2.34 KB
#5557 RunWafRealisticBenchmark netcoreapp3.1 199μs 189ns 731ns 0 0 0 2.3 KB
#5557 RunWafRealisticBenchmark net472 214μs 140ns 541ns 0.319 0 0 2.36 KB
#5557 RunWafRealisticBenchmarkWithAttack net6.0 122μs 60.8ns 219ns 0 0 0 1.44 KB
#5557 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 131μs 307ns 1.19μs 0 0 0 1.42 KB
#5557 RunWafRealisticBenchmarkWithAttack net472 141μs 39.2ns 152ns 0.211 0 0 1.45 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5557

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 60.49 KB 57.85 KB -2.64 KB -4.36%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 61.4μs 756ns 7.56μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 59.9μs 899ns 8.99μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 38.2μs 117ns 440ns 0 0 0 60.49 KB
master StringConcatAspectBenchmark net6.0 287μs 1.34μs 8.86μs 0 0 0 203.79 KB
master StringConcatAspectBenchmark netcoreapp3.1 298μs 1.57μs 8.46μs 0 0 0 201.01 KB
master StringConcatAspectBenchmark net472 269μs 6.34μs 60.8μs 0 0 0 221.18 KB
#5557 StringConcatBenchmark net6.0 54.3μs 540ns 5.35μs 0 0 0 43.44 KB
#5557 StringConcatBenchmark netcoreapp3.1 53μs 167ns 603ns 0 0 0 42.64 KB
#5557 StringConcatBenchmark net472 37.9μs 88.7ns 320ns 0 0 0 57.85 KB
#5557 StringConcatAspectBenchmark net6.0 280μs 1.02μs 3.52μs 0 0 0 203.38 KB
#5557 StringConcatAspectBenchmark netcoreapp3.1 298μs 1.56μs 8.09μs 0 0 0 201.45 KB
#5557 StringConcatAspectBenchmark net472 250μs 3.57μs 34μs 0 0 0 221.18 KB

@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 (5557) (11.710M)   : 0, 11710108
    master (11.846M)   : 0, 11845958
    benchmarks/2.9.0 (11.694M)   : 0, 11694440

    section Automatic
    This PR (5557) (8.104M)   : 0, 8103530
    master (7.996M)   : 0, 7995636
    benchmarks/2.9.0 (8.460M)   : 0, 8459793

    section Trace stats
    master (8.343M)   : 0, 8342594

    section Manual
    This PR (5557) (10.155M)   : 0, 10154554
    master (10.189M)   : 0, 10189379

    section Manual + Automatic
    This PR (5557) (7.630M)   : 0, 7629936
    master (7.524M)   : 0, 7523977

    section Version Conflict
    master (6.816M)   : 0, 6816189

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5557) (9.605M)   : 0, 9605126
    master (9.733M)   : 0, 9732698
    benchmarks/2.9.0 (9.570M)   : 0, 9570467

    section Automatic
    This PR (5557) (6.613M)   : 0, 6613258
    master (6.314M)   : 0, 6314355

    section Trace stats
    master (6.840M)   : 0, 6839753

    section Manual
    This PR (5557) (8.174M)   : 0, 8173834
    master (8.247M)   : 0, 8247298

    section Manual + Automatic
    This PR (5557) (6.157M)   : 0, 6156748
    master (6.114M)   : 0, 6114235

    section Version Conflict
    master (5.631M)   : 0, 5631182

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5557) (10.131M)   : 0, 10131074
    master (10.093M)   : 0, 10093458
    benchmarks/2.9.0 (9.961M)   : 0, 9960539

    section Automatic
    This PR (5557) (7.108M)   : 0, 7107986
    master (7.072M)   : 0, 7072071
    benchmarks/2.9.0 (7.528M)   : 0, 7527964

    section Trace stats
    master (7.332M)   : 0, 7332341

    section Manual
    This PR (5557) (8.859M)   : 0, 8859016
    master (8.698M)   : 0, 8697956

    section Manual + Automatic
    This PR (5557) (6.801M)   : 0, 6801159
    master (6.833M)   : 0, 6833078

    section Version Conflict
    master (6.094M)   : 0, 6094229

Loading

Copy link
Contributor

@NachoEchevarria NachoEchevarria left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@GreenMatan GreenMatan left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewlock andrewlock merged commit bc01f2b into master May 15, 2024
62 of 63 checks passed
@andrewlock andrewlock deleted the andrew/refactor-lifetime-manager branch May 15, 2024 12:04
@github-actions github-actions bot added this to the vNext-v2 milestone May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants