Skip to content

[APM] Exclude windows only definitions from non windows dlls#6270

Merged
dromanol merged 4 commits into
masterfrom
dani/apm/SkipNetFxDefsInLinux
Nov 28, 2024
Merged

[APM] Exclude windows only definitions from non windows dlls#6270
dromanol merged 4 commits into
masterfrom
dani/apm/SkipNetFxDefsInLinux

Conversation

@dromanol

@dromanol dromanol commented Nov 11, 2024

Copy link
Copy Markdown
Contributor

Summary of changes

Remove windows only definitions from non windows dlls

Reason for change

Defs take up space. Removing non needed ones will help keep package size as low as possible

Implementation details

Surround windows only defs in #if _WIN32 clauses

Test coverage

Other details

@dromanol
dromanol changed the base branch from master to dani/apm/NativeCallTargets November 11, 2024 16:59

dromanol commented Nov 11, 2024

Copy link
Copy Markdown
Contributor Author

@dromanol dromanol 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) area:asm-iast area:builds project files, build scripts, pipelines, versioning, releases, packages labels Nov 11, 2024
@dromanol
dromanol marked this pull request as ready for review November 11, 2024 17:06
@dromanol
dromanol requested review from a team as code owners November 11, 2024 17:06
@datadog-ddstaging

datadog-ddstaging Bot commented Nov 11, 2024

Copy link
Copy Markdown

Datadog Report

Branch report: dani/apm/SkipNetFxDefsInLinux
Commit report: dc3139d
Test service: dd-trace-dotnet

✅ 0 Failed, 10936 Passed, 10 Skipped, 36.72s Total Time

@andrewlock

andrewlock commented Nov 11, 2024

Copy link
Copy Markdown
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 (6270) - mean (69ms)  : 66, 72
     .   : milestone, 69,
    master - mean (70ms)  : 67, 74
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6270) - mean (980ms)  : 955, 1005
     .   : milestone, 980,
    master - mean (1,001ms)  : 933, 1069
     .   : milestone, 1001,

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

    section CallTarget+Inlining+NGEN
    This PR (6270) - mean (675ms)  : 659, 692
     .   : milestone, 675,
    master - mean (727ms)  : 638, 816
     .   : milestone, 727,

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

    section CallTarget+Inlining+NGEN
    This PR (6270) - mean (626ms)  : 613, 639
     .   : milestone, 626,
    master - mean (696ms)  : 646, 745
     .   : milestone, 696,

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

    section CallTarget+Inlining+NGEN
    This PR (6270) - mean (1,088ms)  : 1057, 1120
     .   : milestone, 1088,
    master - mean (1,092ms)  : 1062, 1122
     .   : milestone, 1092,

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

    section CallTarget+Inlining+NGEN
    This PR (6270) - mean (866ms)  : 837, 894
     .   : milestone, 866,
    master - mean (869ms)  : 843, 896
     .   : milestone, 869,

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

    section CallTarget+Inlining+NGEN
    This PR (6270) - mean (843ms)  : 813, 873
     .   : milestone, 843,
    master - mean (850ms)  : 816, 884
     .   : milestone, 850,

Loading

@andrewlock

andrewlock commented Nov 11, 2024

Copy link
Copy Markdown
Member

Benchmarks Report for appsec 🐌

Benchmarks for #6270 compared to master:

  • All benchmarks have the same speed
  • 2 benchmarks have fewer allocations
  • 2 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.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 72.3μs 67.8ns 263ns 0.0716 0 0 6 KB
master AllCycleSimpleBody netcoreapp3.1 62.5μs 58.7ns 220ns 0.0938 0 0 6.95 KB
master AllCycleSimpleBody net472 49.1μs 72ns 279ns 1.31 0 0 8.33 KB
master AllCycleMoreComplexBody net6.0 78.4μs 55ns 213ns 0.117 0 0 9.51 KB
master AllCycleMoreComplexBody netcoreapp3.1 69.4μs 56.4ns 211ns 0.139 0 0 10.36 KB
master AllCycleMoreComplexBody net472 56.5μs 85.2ns 330ns 1.87 0.0283 0 11.85 KB
master ObjectExtractorSimpleBody net6.0 145ns 0.12ns 0.448ns 0.00395 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 209ns 0.137ns 0.494ns 0.00369 0 0 272 B
master ObjectExtractorSimpleBody net472 171ns 0.0861ns 0.334ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.04μs 2.64ns 9.86ns 0.0533 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.91μs 3.08ns 11.9ns 0.0507 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 4.36μs 1.92ns 7.44ns 0.601 0.00656 0 3.8 KB
#6270 AllCycleSimpleBody net6.0 73.2μs 125ns 484ns 0.0747 0 0 6.01 KB
#6270 AllCycleSimpleBody netcoreapp3.1 63.1μs 65.6ns 245ns 0.0939 0 0 6.95 KB
#6270 AllCycleSimpleBody net472 49.2μs 44.1ns 165ns 1.32 0 0 8.34 KB
#6270 AllCycleMoreComplexBody net6.0 79.5μs 58.9ns 228ns 0.119 0 0 9.51 KB
#6270 AllCycleMoreComplexBody netcoreapp3.1 71.1μs 74.4ns 288ns 0.107 0 0 10.37 KB
#6270 AllCycleMoreComplexBody net472 55.6μs 42.8ns 160ns 1.86 0.0278 0 11.85 KB
#6270 ObjectExtractorSimpleBody net6.0 150ns 0.132ns 0.512ns 0.00392 0 0 280 B
#6270 ObjectExtractorSimpleBody netcoreapp3.1 209ns 0.267ns 0.999ns 0.00377 0 0 272 B
#6270 ObjectExtractorSimpleBody net472 165ns 0.099ns 0.383ns 0.0446 0 0 281 B
#6270 ObjectExtractorMoreComplexBody net6.0 3.12μs 2.03ns 7.6ns 0.0531 0 0 3.78 KB
#6270 ObjectExtractorMoreComplexBody netcoreapp3.1 3.87μs 2.76ns 9.96ns 0.0506 0 0 3.69 KB
#6270 ObjectExtractorMoreComplexBody net472 4.46μs 3.52ns 13.6ns 0.602 0.00666 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 38.2μs 26.2ns 102ns 0.454 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 54.3μs 36.7ns 142ns 0.432 0 0 32.4 KB
master EncodeArgs net472 66.4μs 27.9ns 104ns 5.15 0.0661 0 32.5 KB
master EncodeLegacyArgs net6.0 76.2μs 407ns 2.11μs 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 109μs 254ns 983ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 154μs 97.1ns 376ns 0.31 0 0 2.15 KB
#6270 EncodeArgs net6.0 37.4μs 23.7ns 88.7ns 0.45 0 0 32.4 KB
#6270 EncodeArgs netcoreapp3.1 54μs 44.6ns 167ns 0.44 0 0 32.4 KB
#6270 EncodeArgs net472 67.6μs 19ns 65.8ns 5.16 0.0675 0 32.5 KB
#6270 EncodeLegacyArgs net6.0 73μs 123ns 478ns 0 0 0 2.14 KB
#6270 EncodeLegacyArgs netcoreapp3.1 105μs 174ns 674ns 0 0 0 2.14 KB
#6270 EncodeLegacyArgs net472 154μs 154ns 597ns 0.308 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 185μs 60.9ns 236ns 0 0 0 2.44 KB
master RunWafRealisticBenchmark netcoreapp3.1 198μs 238ns 921ns 0 0 0 2.39 KB
master RunWafRealisticBenchmark net472 210μs 141ns 545ns 0.315 0 0 2.46 KB
master RunWafRealisticBenchmarkWithAttack net6.0 122μs 106ns 381ns 0 0 0 1.47 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 130μs 155ns 598ns 0 0 0 1.46 KB
master RunWafRealisticBenchmarkWithAttack net472 138μs 42.5ns 153ns 0.208 0 0 1.49 KB
#6270 RunWafRealisticBenchmark net6.0 185μs 242ns 938ns 0 0 0 2.44 KB
#6270 RunWafRealisticBenchmark netcoreapp3.1 198μs 208ns 805ns 0 0 0 2.39 KB
#6270 RunWafRealisticBenchmark net472 211μs 221ns 856ns 0.314 0 0 2.46 KB
#6270 RunWafRealisticBenchmarkWithAttack net6.0 122μs 53.6ns 201ns 0 0 0 1.47 KB
#6270 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 131μs 323ns 1.25μs 0 0 0 1.46 KB
#6270 RunWafRealisticBenchmarkWithAttack net472 139μs 108ns 418ns 0.207 0 0 1.49 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #6270

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 253.95 KB 265.42 KB 11.47 KB 4.52%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 272.91 KB 278.53 KB 5.62 KB 2.06%

Fewer allocations 🎉 in #6270

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 255.27 KB 252.41 KB -2.86 KB -1.12%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 60.49 KB 59.07 KB -1.42 KB -2.34%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 52.9μs 209ns 782ns 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 54.2μs 287ns 1.38μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 38μs 165ns 616ns 0 0 0 60.49 KB
master StringConcatAspectBenchmark net6.0 295μs 4.71μs 43.7μs 0 0 0 253.95 KB
master StringConcatAspectBenchmark netcoreapp3.1 354μs 1.97μs 12.1μs 0 0 0 255.27 KB
master StringConcatAspectBenchmark net472 278μs 6.14μs 58.9μs 0 0 0 272.91 KB
#6270 StringConcatBenchmark net6.0 52.7μs 275ns 1.29μs 0 0 0 43.44 KB
#6270 StringConcatBenchmark netcoreapp3.1 62.4μs 777ns 7.65μs 0 0 0 42.64 KB
#6270 StringConcatBenchmark net472 37.3μs 80.7ns 291ns 0 0 0 59.07 KB
#6270 StringConcatAspectBenchmark net6.0 325μs 1.84μs 12.2μs 0 0 0 265.42 KB
#6270 StringConcatAspectBenchmark netcoreapp3.1 333μs 1.72μs 9.75μs 0 0 0 252.41 KB
#6270 StringConcatAspectBenchmark net472 243μs 1.19μs 5.03μs 0 0 0 278.53 KB

@andrewlock

andrewlock commented Nov 11, 2024

Copy link
Copy Markdown
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6270 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.219
  • 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.92μs 44.1ns 279ns 0.012 0.00399 0 5.61 KB
master StartStopWithChild netcoreapp3.1 9.93μs 47.6ns 202ns 0.0196 0.00978 0 5.8 KB
master StartStopWithChild net472 16.3μs 37.8ns 146ns 1.05 0.322 0.099 6.22 KB
#6270 StartStopWithChild net6.0 8.22μs 45.3ns 275ns 0.0161 0.00403 0 5.61 KB
#6270 StartStopWithChild netcoreapp3.1 9.96μs 54.9ns 334ns 0.0205 0.0103 0 5.8 KB
#6270 StartStopWithChild net472 16.4μs 47.2ns 177ns 1.04 0.301 0.0978 6.21 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 328ns 1.23μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 658μs 472ns 1.83μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 835μs 515ns 1.86μs 0.417 0 0 3.3 KB
#6270 WriteAndFlushEnrichedTraces net6.0 482μs 265ns 1.03μs 0 0 0 2.7 KB
#6270 WriteAndFlushEnrichedTraces netcoreapp3.1 661μs 2.4μs 9.3μs 0 0 0 2.7 KB
#6270 WriteAndFlushEnrichedTraces net472 851μs 353ns 1.32μs 0.425 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 152μs 928ns 9.28μs 0.224 0 0 14.47 KB
master SendRequest netcoreapp3.1 172μs 1.01μs 9.23μs 0.159 0 0 17.27 KB
master SendRequest net472 0.00056ns 0.00032ns 0.0012ns 0 0 0 0 b
#6270 SendRequest net6.0 153μs 870ns 6.96μs 0.147 0 0 14.47 KB
#6270 SendRequest netcoreapp3.1 170μs 976ns 8.05μs 0.171 0 0 17.27 KB
#6270 SendRequest net472 0.000846ns 0.000368ns 0.00142ns 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 2.61μs 10.4μs 0.551 0 0 41.66 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 698μs 3.54μs 15.4μs 0.334 0 0 41.82 KB
master WriteAndFlushEnrichedTraces net472 909μs 3.73μs 14.4μs 8.3 2.62 0.437 53.31 KB
#6270 WriteAndFlushEnrichedTraces net6.0 588μs 3.17μs 18.2μs 0.59 0 0 41.85 KB
#6270 WriteAndFlushEnrichedTraces netcoreapp3.1 690μs 3.59μs 20.9μs 0.345 0 0 41.84 KB
#6270 WriteAndFlushEnrichedTraces net472 881μs 4.14μs 16.6μs 8.19 2.59 0.431 53.25 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.28μs 1.31ns 5.09ns 0.0141 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.78μs 1.75ns 6.07ns 0.0135 0 0 1.02 KB
master ExecuteNonQuery net472 2.05μs 1.99ns 7.72ns 0.156 0.00103 0 987 B
#6270 ExecuteNonQuery net6.0 1.35μs 0.991ns 3.71ns 0.0143 0 0 1.02 KB
#6270 ExecuteNonQuery netcoreapp3.1 1.84μs 3.03ns 11.7ns 0.0138 0 0 1.02 KB
#6270 ExecuteNonQuery net472 2.14μs 2.46ns 9.51ns 0.156 0.00106 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.25μs 1.55ns 5.81ns 0.0138 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.58μs 0.53ns 1.91ns 0.0128 0 0 976 B
master CallElasticsearch net472 2.52μs 1.25ns 4.83ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.34μs 0.399ns 1.49ns 0.0133 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.76μs 0.578ns 2.24ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.69μs 1.46ns 5.66ns 0.167 0 0 1.05 KB
#6270 CallElasticsearch net6.0 1.29μs 1.14ns 4.42ns 0.0135 0 0 976 B
#6270 CallElasticsearch netcoreapp3.1 1.55μs 1.05ns 4.07ns 0.0131 0 0 976 B
#6270 CallElasticsearch net472 2.57μs 5.23ns 20.3ns 0.157 0 0 995 B
#6270 CallElasticsearchAsync net6.0 1.42μs 0.883ns 3.42ns 0.0135 0 0 952 B
#6270 CallElasticsearchAsync netcoreapp3.1 1.61μs 2.75ns 10.6ns 0.014 0 0 1.02 KB
#6270 CallElasticsearchAsync net472 2.64μs 0.705ns 2.73ns 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.24μs 0.792ns 3.07ns 0.0131 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.64μs 1.05ns 3.93ns 0.0123 0 0 952 B
master ExecuteAsync net472 1.81μs 0.825ns 3.19ns 0.145 0 0 915 B
#6270 ExecuteAsync net6.0 1.28μs 1.61ns 5.57ns 0.0135 0 0 952 B
#6270 ExecuteAsync netcoreapp3.1 1.74μs 1.19ns 4.13ns 0.0131 0 0 952 B
#6270 ExecuteAsync net472 1.85μs 0.911ns 3.41ns 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.46μs 2.73ns 10.2ns 0.0333 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.36μs 3.47ns 13.4ns 0.0374 0 0 2.85 KB
master SendAsync net472 7.27μs 1.96ns 7.58ns 0.494 0 0 3.12 KB
#6270 SendAsync net6.0 4.32μs 1.82ns 6.8ns 0.0324 0 0 2.31 KB
#6270 SendAsync netcoreapp3.1 5.41μs 1.85ns 7.15ns 0.0378 0 0 2.85 KB
#6270 SendAsync net472 7.34μs 2.14ns 8.28ns 0.493 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.59μs 0.655ns 2.45ns 0.0231 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.19μs 0.74ns 2.77ns 0.0218 0 0 1.64 KB
master EnrichedLog net472 2.6μs 1.13ns 4.36ns 0.248 0 0 1.57 KB
#6270 EnrichedLog net6.0 1.49μs 0.917ns 3.55ns 0.0232 0 0 1.64 KB
#6270 EnrichedLog netcoreapp3.1 2.18μs 0.48ns 1.8ns 0.0221 0 0 1.64 KB
#6270 EnrichedLog net472 2.62μs 2.5ns 9.7ns 0.25 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 119μs 151ns 583ns 0.0604 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 125μs 124ns 481ns 0 0 0 4.28 KB
master EnrichedLog net472 151μs 173ns 671ns 0.681 0.227 0 4.46 KB
#6270 EnrichedLog net6.0 120μs 231ns 894ns 0.0599 0 0 4.28 KB
#6270 EnrichedLog netcoreapp3.1 124μs 117ns 438ns 0 0 0 4.28 KB
#6270 EnrichedLog net472 155μs 133ns 517ns 0.694 0.231 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.04μs 0.99ns 3.7ns 0.0303 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.13μs 5.73ns 22.2ns 0.0289 0 0 2.2 KB
master EnrichedLog net472 5.07μs 4.9ns 18.3ns 0.319 0 0 2.02 KB
#6270 EnrichedLog net6.0 2.9μs 1.87ns 7.25ns 0.0303 0 0 2.2 KB
#6270 EnrichedLog netcoreapp3.1 4.29μs 3.54ns 13.7ns 0.0279 0 0 2.2 KB
#6270 EnrichedLog net472 4.93μs 2.99ns 11.6ns 0.32 0 0 2.02 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.48μs 1.02ns 3.95ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.71μs 0.513ns 1.99ns 0.0154 0 0 1.14 KB
master SendReceive net472 2.06μs 1.73ns 6.72ns 0.183 0 0 1.16 KB
#6270 SendReceive net6.0 1.33μs 1.53ns 5.91ns 0.0164 0 0 1.14 KB
#6270 SendReceive netcoreapp3.1 1.82μs 0.55ns 2.06ns 0.0155 0 0 1.14 KB
#6270 SendReceive net472 2.02μs 2.36ns 9.16ns 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.77μs 4.56ns 17.7ns 0.0223 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.89μs 1.35ns 5.05ns 0.0215 0 0 1.65 KB
master EnrichedLog net472 4.3μs 1.98ns 7.67ns 0.322 0 0 2.04 KB
#6270 EnrichedLog net6.0 2.81μs 0.972ns 3.5ns 0.0224 0 0 1.6 KB
#6270 EnrichedLog netcoreapp3.1 3.77μs 1.95ns 7.55ns 0.0227 0 0 1.65 KB
#6270 EnrichedLog net472 4.28μs 1.57ns 5.88ns 0.322 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 394ns 0.459ns 1.78ns 0.00807 0 0 576 B
master StartFinishSpan netcoreapp3.1 611ns 1.25ns 4.68ns 0.00761 0 0 576 B
master StartFinishSpan net472 649ns 1.5ns 5.8ns 0.0917 0 0 578 B
master StartFinishScope net6.0 502ns 0.695ns 2.69ns 0.00966 0 0 696 B
master StartFinishScope netcoreapp3.1 758ns 1.67ns 6.24ns 0.00922 0 0 696 B
master StartFinishScope net472 866ns 2.06ns 7.97ns 0.104 0 0 658 B
#6270 StartFinishSpan net6.0 393ns 0.459ns 1.78ns 0.00811 0 0 576 B
#6270 StartFinishSpan netcoreapp3.1 595ns 1.56ns 6.03ns 0.00761 0 0 576 B
#6270 StartFinishSpan net472 608ns 1.22ns 4.74ns 0.0916 0 0 578 B
#6270 StartFinishScope net6.0 560ns 0.706ns 2.73ns 0.00974 0 0 696 B
#6270 StartFinishScope netcoreapp3.1 721ns 1.1ns 4.26ns 0.00937 0 0 696 B
#6270 StartFinishScope net472 885ns 2.3ns 8.9ns 0.105 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6270

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.219 594.18 724.33

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 594ns 0.761ns 2.95ns 0.00961 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 952ns 1.56ns 6.06ns 0.00949 0 0 696 B
master RunOnMethodBegin net472 1.16μs 2.5ns 9.66ns 0.104 0 0 658 B
#6270 RunOnMethodBegin net6.0 722ns 1.66ns 6.44ns 0.00972 0 0 696 B
#6270 RunOnMethodBegin netcoreapp3.1 898ns 1.39ns 5.39ns 0.00947 0 0 696 B
#6270 RunOnMethodBegin net472 1.14μs 1.88ns 7.3ns 0.104 0 0 658 B

@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from 17bc420 to 2277786 Compare November 11, 2024 21:59
@dromanol
dromanol requested a review from a team as a code owner November 11, 2024 21:59
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 86827a9 to 6d649a3 Compare November 11, 2024 21:59
@andrewlock

andrewlock commented Nov 11, 2024

Copy link
Copy Markdown
Member

Throughput/Crank Report ⚡

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 (6270) (11.125M)   : 0, 11124713
    master (11.381M)   : 0, 11380797
    benchmarks/2.9.0 (11.033M)   : 0, 11032866

    section Automatic
    This PR (6270) (7.403M)   : 0, 7403107
    master (7.372M)   : 0, 7371851
    benchmarks/2.9.0 (7.786M)   : 0, 7785853

    section Trace stats
    master (7.651M)   : 0, 7651180

    section Manual
    master (11.409M)   : 0, 11409121

    section Manual + Automatic
    This PR (6270) (6.768M)   : 0, 6768396
    master (6.820M)   : 0, 6819669

    section DD_TRACE_ENABLED=0
    master (10.284M)   : 0, 10284096

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6270) (9.634M)   : 0, 9633688
    master (9.528M)   : 0, 9528332
    benchmarks/2.9.0 (9.495M)   : 0, 9494821

    section Automatic
    This PR (6270) (6.383M)   : 0, 6383298
    master (6.301M)   : 0, 6300873

    section Trace stats
    master (6.689M)   : 0, 6689036

    section Manual
    master (9.357M)   : 0, 9356534

    section Manual + Automatic
    This PR (6270) (5.881M)   : 0, 5881447
    master (5.894M)   : 0, 5894490

    section DD_TRACE_ENABLED=0
    master (8.921M)   : 0, 8920806

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6270) (9.868M)   : 0, 9867855
    master (9.919M)   : 0, 9919361
    benchmarks/2.9.0 (10.020M)   : 0, 10019592

    section Automatic
    This PR (6270) (6.280M)   : 0, 6280411
    master (6.191M)   : 0, 6191193
    benchmarks/2.9.0 (7.255M)   : 0, 7255257

    section Trace stats
    master (6.913M)   : 0, 6912642

    section Manual
    master (9.741M)   : 0, 9741372

    section Manual + Automatic
    This PR (6270) (5.685M)   : 0, 5685093
    master (5.793M)   : 0, 5793028

    section DD_TRACE_ENABLED=0
    master (9.131M)   : 0, 9130759

Loading

@NachoEchevarria NachoEchevarria left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 6d649a3 to 78fe837 Compare November 14, 2024 15:02
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from cb9c565 to fa44bc2 Compare November 15, 2024 10:05
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch 2 times, most recently from 14e921b to 8c9d6b8 Compare November 15, 2024 10:14
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from df76b2f to d1bb046 Compare November 15, 2024 10:39
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 239b853 to 2d3d5f9 Compare November 15, 2024 10:39
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from d1bb046 to b0d7fec Compare November 15, 2024 18:58
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 2d3d5f9 to 05ae16a Compare November 15, 2024 18:59
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from b0d7fec to 7c463e8 Compare November 18, 2024 10:48
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 05ae16a to 4ec56a4 Compare November 18, 2024 10:48
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from 7c463e8 to b818a93 Compare November 20, 2024 10:55
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 4ec56a4 to 002f3bf Compare November 20, 2024 10:56
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from b818a93 to 1c302eb Compare November 21, 2024 09:49
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch 2 times, most recently from 6f9b6c4 to 65e137b Compare November 21, 2024 09:58
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from 3075076 to 085dfa9 Compare November 22, 2024 14:04
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch 3 times, most recently from 3c882e7 to 5b64e6c Compare November 22, 2024 14:25
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from 02b9bdf to 7effd69 Compare November 22, 2024 14:46
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 5b64e6c to 317c444 Compare November 22, 2024 14:46
@dromanol
dromanol force-pushed the dani/apm/NativeCallTargets branch from 7effd69 to 35ca88a Compare November 22, 2024 18:34
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 317c444 to a9b8bb3 Compare November 22, 2024 18:34
Base automatically changed from dani/apm/NativeCallTargets to master November 22, 2024 21:20
@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from aa66464 to 1a55d8c Compare November 22, 2024 21:21
{
public static bool IsNetFxOnly(this TargetFrameworks tfm)
{
return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:chefkiss:

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, nice work 👍 Spotted a couple of bugs tho.

I wonder if we could/should simplify TargetFrameworks - shouldn't they only include the TFMs we actually target? 🤔

{
public static bool IsNetFxOnly(this TargetFrameworks tfm)
{
return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Technically this isn't correct, e.g.:

Suggested change
return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0;
return tfm != TargetFrameworks.None
&& ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But tbh, I would be inclined to do this 😄

Suggested change
return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0;
return tfm == TargetFrameworks.NET461
|| tfm == TargetFrameworks.NET462
|| tfm == (TargetFrameworks.NET461 | TargetFrameworks.NET462);

In fact, why aren't we only defining the values that this can be (i.e. our Datadog.Trace.dll TFMs 🤔) i.e.

internal enum TargetFrameworks : uint
{
    None = 0, // For CodeGenerator only
    NET462 = 1,
    NETSTANDARD2_0 = 2,
    NETCOREAPP3_1 = 4,
    NET6_0 = 8,
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I see your point. It simplifies casuistic. Fine.

@@ -27,3 +27,12 @@ internal enum TargetFrameworks : uint
NET8_0 = 512,
NET0_0 = 1024,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be NET9_0? 😖

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, removed in the simplification process

@dromanol
dromanol force-pushed the dani/apm/SkipNetFxDefsInLinux branch from 1a55d8c to dc3139d Compare November 28, 2024 21:43
@dromanol
dromanol merged commit 2df7434 into master Nov 28, 2024
@dromanol
dromanol deleted the dani/apm/SkipNetFxDefsInLinux branch November 28, 2024 23:26
@github-actions github-actions Bot added this to the vNext-v3 milestone Nov 28, 2024
veerbia pushed a commit that referenced this pull request Dec 16, 2024
## Summary of changes
Remove windows only definitions from non windows dlls

## Reason for change
Defs take up space. Removing non needed ones will help keep package size
as low as possible

## Implementation details
Surround windows only defs in #if _WIN32 clauses

## Test coverage

## Other details
<!-- Fixes #{issue} -->

<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->
@andrewlock andrewlock added the area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:asm-iast area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) area:builds project files, build scripts, pipelines, versioning, releases, packages 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants