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

Validate data before EnumNgenModuleMethodsInliningThisMethod call #6410

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

tonyredondo
Copy link
Member

@tonyredondo tonyredondo commented Dec 9, 2024

Summary of changes

Add some checks to the native side before using a module info

Ticket: SDTEST-1308

@tonyredondo tonyredondo self-assigned this Dec 9, 2024
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Dec 9, 2024

Datadog Report

Branch report: tony/enumngenmodulemethods-validation
Commit report: 3740177
Test service: dd-trace-dotnet

✅ 0 Failed, 470128 Passed, 3702 Skipped, 33h 2m 12.18s Total Time
❄️ 1 New Flaky

New Flaky Tests (1)

  • NoExceptions - Datadog.Trace.ClrProfiler.IntegrationTests.SmokeTests.AssemblyResolveMscorlibResourcesInfiniteRecursionCrashSmokeTest - Last Failure

    Expand for error
     Expected no errors in smoke test: [createdump] ptrace(ATTACH, 24979) FAILED Operation not permitted
     
     Expected: True
     Actual:   False
    

@andrewlock
Copy link
Member

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 (6410) - mean (70ms)  : 66, 73
     .   : milestone, 70,
    master - mean (70ms)  : 67, 72
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6410) - mean (974ms)  : 953, 995
     .   : milestone, 974,
    master - mean (988ms)  : 963, 1014
     .   : milestone, 988,

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

    section CallTarget+Inlining+NGEN
    This PR (6410) - mean (676ms)  : 658, 694
     .   : milestone, 676,
    master - mean (687ms)  : 669, 704
     .   : milestone, 687,

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

    section CallTarget+Inlining+NGEN
    This PR (6410) - mean (632ms)  : 616, 648
     .   : milestone, 632,
    master - mean (643ms)  : 626, 660
     .   : milestone, 643,

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

    section CallTarget+Inlining+NGEN
    This PR (6410) - mean (1,093ms)  : 1068, 1118
     .   : milestone, 1093,
    master - mean (1,091ms)  : 1063, 1119
     .   : milestone, 1091,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6410) - mean (276ms)  : 272, 280
     .   : milestone, 276,
    master - mean (276ms)  : 272, 280
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (6410) - mean (869ms)  : 833, 904
     .   : milestone, 869,
    master - mean (869ms)  : 839, 900
     .   : milestone, 869,

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

    section CallTarget+Inlining+NGEN
    This PR (6410) - mean (848ms)  : 812, 884
     .   : milestone, 848,
    master - mean (850ms)  : 818, 882
     .   : milestone, 850,

Loading

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6410 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.151
  • 2 benchmarks are slower, with geometric mean 1.151
  • 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 7.93μs 39.7ns 186ns 0.0159 0.00797 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.2μs 56.5ns 339ns 0.0148 0.00493 0 5.8 KB
master StartStopWithChild net472 16.3μs 61.9ns 240ns 1.04 0.307 0.105 6.23 KB
#6410 StartStopWithChild net6.0 7.88μs 38.8ns 223ns 0.0157 0.00783 0 5.61 KB
#6410 StartStopWithChild netcoreapp3.1 10μs 56.5ns 366ns 0.0199 0.00997 0 5.8 KB
#6410 StartStopWithChild net472 16.4μs 49ns 190ns 1.03 0.299 0.0914 6.22 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 477μs 2.24μs 8.67μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 665μs 436ns 1.63μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 841μs 349ns 1.3μs 0.422 0 0 3.3 KB
#6410 WriteAndFlushEnrichedTraces net6.0 513μs 259ns 967ns 0 0 0 2.7 KB
#6410 WriteAndFlushEnrichedTraces netcoreapp3.1 637μs 301ns 1.09μs 0 0 0 2.7 KB
#6410 WriteAndFlushEnrichedTraces net472 842μs 503ns 1.95μ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 150μs 877ns 7.8μs 0.138 0 0 14.47 KB
master SendRequest netcoreapp3.1 172μs 998ns 8.41μs 0.158 0 0 17.27 KB
master SendRequest net472 0.00094ns 0.00047ns 0.00169ns 0 0 0 0 b
#6410 SendRequest net6.0 155μs 1.04μs 10.3μs 0.155 0 0 14.47 KB
#6410 SendRequest netcoreapp3.1 168μs 967ns 7.85μs 0.161 0 0 17.27 KB
#6410 SendRequest net472 0.00072ns 0.000415ns 0.00155ns 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 559μs 2.78μs 13.6μs 0.601 0 0 41.65 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 667μs 3.6μs 20.1μs 0.319 0 0 41.79 KB
master WriteAndFlushEnrichedTraces net472 838μs 3.19μs 12.3μs 8.87 2.82 0.403 53.33 KB
#6410 WriteAndFlushEnrichedTraces net6.0 572μs 1.77μs 7.29μs 0.571 0 0 41.63 KB
#6410 WriteAndFlushEnrichedTraces netcoreapp3.1 675μs 3.56μs 17.4μs 0.332 0 0 41.86 KB
#6410 WriteAndFlushEnrichedTraces net472 845μs 3.04μs 11μs 8.25 2.6 0.434 53.3 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.4μs 1.05ns 4.07ns 0.014 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.77μs 2.31ns 8.93ns 0.0142 0 0 1.02 KB
master ExecuteNonQuery net472 1.99μs 1.6ns 6.21ns 0.156 0.000999 0 987 B
#6410 ExecuteNonQuery net6.0 1.36μs 1.39ns 5.4ns 0.0143 0 0 1.02 KB
#6410 ExecuteNonQuery netcoreapp3.1 1.76μs 1.41ns 5.44ns 0.0132 0 0 1.02 KB
#6410 ExecuteNonQuery net472 2.11μs 2.67ns 10.3ns 0.157 0.00105 0 987 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.17μs 0.913ns 3.42ns 0.0135 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.52μs 0.919ns 3.56ns 0.013 0 0 976 B
master CallElasticsearch net472 2.53μs 1.08ns 4.06ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.25μs 0.451ns 1.69ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.61μs 0.657ns 2.46ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.57μs 0.822ns 3.07ns 0.167 0 0 1.05 KB
#6410 CallElasticsearch net6.0 1.2μs 0.486ns 1.75ns 0.0139 0 0 976 B
#6410 CallElasticsearch netcoreapp3.1 1.68μs 0.365ns 1.36ns 0.0126 0 0 976 B
#6410 CallElasticsearch net472 2.56μs 2.2ns 8.53ns 0.158 0 0 995 B
#6410 CallElasticsearchAsync net6.0 1.35μs 0.35ns 1.26ns 0.0135 0 0 952 B
#6410 CallElasticsearchAsync netcoreapp3.1 1.66μs 0.761ns 2.85ns 0.0136 0 0 1.02 KB
#6410 CallElasticsearchAsync net472 2.57μs 1.91ns 7.39ns 0.166 0 0 1.05 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.27μs 0.882ns 3.42ns 0.0133 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.62μs 1.41ns 5.26ns 0.0123 0 0 952 B
master ExecuteAsync net472 1.85μs 0.582ns 2.26ns 0.145 0 0 915 B
#6410 ExecuteAsync net6.0 1.33μs 0.703ns 2.72ns 0.0132 0 0 952 B
#6410 ExecuteAsync netcoreapp3.1 1.66μs 0.767ns 2.87ns 0.0132 0 0 952 B
#6410 ExecuteAsync net472 1.8μs 0.945ns 3.66ns 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.41μs 2.2ns 8.22ns 0.0329 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.33μs 4.73ns 18.3ns 0.0378 0 0 2.85 KB
master SendAsync net472 7.28μs 1.79ns 6.71ns 0.495 0 0 3.12 KB
#6410 SendAsync net6.0 4.53μs 8.57ns 33.2ns 0.0317 0 0 2.31 KB
#6410 SendAsync netcoreapp3.1 5.4μs 3.08ns 11.9ns 0.0381 0 0 2.85 KB
#6410 SendAsync net472 7.47μs 2.9ns 11.2ns 0.494 0 0 3.12 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.56μs 0.648ns 2.43ns 0.0227 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.33μs 1.04ns 4.04ns 0.0224 0 0 1.64 KB
master EnrichedLog net472 2.66μs 0.633ns 2.37ns 0.249 0 0 1.57 KB
#6410 EnrichedLog net6.0 1.51μs 3.83ns 14.3ns 0.0232 0 0 1.64 KB
#6410 EnrichedLog netcoreapp3.1 2.17μs 7.89ns 30.6ns 0.0217 0 0 1.64 KB
#6410 EnrichedLog net472 2.58μs 1.55ns 5.6ns 0.249 0 0 1.57 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 120μs 108ns 419ns 0.0598 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 122μs 78ns 270ns 0 0 0 4.28 KB
master EnrichedLog net472 153μs 86.2ns 334ns 0.689 0.23 0 4.46 KB
#6410 EnrichedLog net6.0 120μs 126ns 487ns 0 0 0 4.28 KB
#6410 EnrichedLog netcoreapp3.1 123μs 236ns 915ns 0.0624 0 0 4.28 KB
#6410 EnrichedLog net472 154μs 137ns 530ns 0.69 0.23 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.18μs 1.5ns 5.42ns 0.0303 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.29μs 2.02ns 7.83ns 0.0299 0 0 2.2 KB
master EnrichedLog net472 5μs 1.43ns 5.53ns 0.319 0 0 2.02 KB
#6410 EnrichedLog net6.0 3.02μs 0.681ns 2.64ns 0.0301 0 0 2.2 KB
#6410 EnrichedLog netcoreapp3.1 4.43μs 3.16ns 12.2ns 0.0287 0 0 2.2 KB
#6410 EnrichedLog net472 4.96μs 1.75ns 6.77ns 0.32 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6410

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1 1.142 1,643.81 1,876.66

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.36μs 0.419ns 1.57ns 0.0163 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.64μs 0.723ns 2.71ns 0.0148 0 0 1.14 KB
master SendReceive net472 2.09μs 1.14ns 4.42ns 0.183 0 0 1.16 KB
#6410 SendReceive net6.0 1.26μs 1.39ns 5.39ns 0.0157 0 0 1.14 KB
#6410 SendReceive netcoreapp3.1 1.88μs 1.12ns 4.35ns 0.015 0 0 1.14 KB
#6410 SendReceive net472 2.09μs 3.31ns 12.8ns 0.183 0 0 1.16 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.79μs 1.08ns 4.17ns 0.0223 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.88μs 1.36ns 5.1ns 0.0217 0 0 1.65 KB
master EnrichedLog net472 4.41μs 1.34ns 5ns 0.322 0 0 2.04 KB
#6410 EnrichedLog net6.0 2.85μs 0.99ns 3.7ns 0.0229 0 0 1.6 KB
#6410 EnrichedLog netcoreapp3.1 4.05μs 1.42ns 5.3ns 0.0223 0 0 1.65 KB
#6410 EnrichedLog net472 4.53μs 2.96ns 11.4ns 0.322 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6410

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.168 465.57 398.72
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 1.136 711.23 626.31

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 465ns 0.701ns 2.72ns 0.00818 0 0 576 B
master StartFinishSpan netcoreapp3.1 554ns 0.866ns 3.35ns 0.00776 0 0 576 B
master StartFinishSpan net472 710ns 1.07ns 4.13ns 0.0915 0 0 578 B
master StartFinishScope net6.0 481ns 0.636ns 2.46ns 0.00985 0 0 696 B
master StartFinishScope netcoreapp3.1 776ns 0.843ns 3.26ns 0.00927 0 0 696 B
master StartFinishScope net472 823ns 2.35ns 9.09ns 0.104 0 0 658 B
#6410 StartFinishSpan net6.0 399ns 0.376ns 1.46ns 0.00806 0 0 576 B
#6410 StartFinishSpan netcoreapp3.1 601ns 1.13ns 4.37ns 0.00789 0 0 576 B
#6410 StartFinishSpan net472 626ns 1.11ns 4.32ns 0.0918 0 0 578 B
#6410 StartFinishScope net6.0 486ns 0.515ns 1.99ns 0.00977 0 0 696 B
#6410 StartFinishScope netcoreapp3.1 752ns 1.01ns 3.89ns 0.00945 0 0 696 B
#6410 StartFinishScope net472 880ns 1.48ns 5.75ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6410

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.161 602.96 700.13

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 602ns 0.69ns 2.67ns 0.0097 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 956ns 1.25ns 4.86ns 0.00942 0 0 696 B
master RunOnMethodBegin net472 1.16μs 1.96ns 7.58ns 0.104 0 0 658 B
#6410 RunOnMethodBegin net6.0 701ns 1.1ns 4.27ns 0.00983 0 0 696 B
#6410 RunOnMethodBegin netcoreapp3.1 900ns 1.29ns 5.01ns 0.00909 0 0 696 B
#6410 RunOnMethodBegin net472 1.1μs 1.87ns 7.25ns 0.104 0 0 658 B

@tonyredondo tonyredondo marked this pull request as ready for review December 9, 2024 16:23
@tonyredondo tonyredondo requested review from a team as code owners December 9, 2024 16:23
@andrewlock andrewlock added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) identified-by:crashtracking labels Dec 9, 2024
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 👍

@tonyredondo tonyredondo merged commit 2efe155 into master Dec 9, 2024
65 of 70 checks passed
@tonyredondo tonyredondo deleted the tony/enumngenmodulemethods-validation branch December 9, 2024 20:52
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) identified-by:crashtracking type:reliability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants