Skip to content

More cleanup in native loader code#7475

Merged
andrewlock merged 7 commits intomasterfrom
andrew/more-native-cleanup
Sep 11, 2025
Merged

More cleanup in native loader code#7475
andrewlock merged 7 commits intomasterfrom
andrew/more-native-cleanup

Conversation

@andrewlock
Copy link
Member

Summary of changes

  • Cleanup of some of the native loader code
  • Add createdump to the exclude list

Reason for change

Various minor things that have been bugging me for a while.

Implementation details

  • Remove default_exclude_assemblies from the native tracer as it's no longer used (after [Crashtracker] Add module path to frames #7642)
  • Remove default_exclude_assemblies to default_exclude_processes as it was named incorrectly!
  • Move environment variables that were in util.h into the EnvironmentVariables type that's designed for this (and remove duplicates)
  • Rename EnvironmentVariables.h to environment.h for consistency with the majoring of the native loader code + native tracer. Use snake casing instead of PascalCasing
  • Move constants out of util.h into constants.h to avoid cluttering it
  • Add createdump to the process exclude list (I noticed we apparently instrument the createdump calls themselves in our CI!)

Test coverage

Covered by existing

Other details

Commit-by-commit review is easiest, as they're all small self-contained updates!

@andrewlock andrewlock added the area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) label Sep 5, 2025
@andrewlock andrewlock requested a review from a team as a code owner September 5, 2025 09:20
@andrewlock andrewlock added the type:cleanup Minor code clean up label Sep 5, 2025
@andrewlock andrewlock requested a review from a team as a code owner September 5, 2025 09:20
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Sep 5, 2025

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.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7475) - mean (69ms)  : 63, 75
     .   : milestone, 69,
    master - mean (70ms)  : 63, 76
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (989ms)  : 961, 1018
     .   : milestone, 989,
    master - mean (986ms)  : 961, 1011
     .   : milestone, 986,

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

    section Baseline
    This PR (7475) - mean (106ms)  : 103, 108
     .   : milestone, 106,
    master - mean (106ms)  : 103, 108
     .   : milestone, 106,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (701ms)  : 676, 727
     .   : milestone, 701,
    master - mean (699ms)  : 679, 719
     .   : milestone, 699,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (94ms)  : 93, 95
     .   : milestone, 94,
    master - mean (94ms)  : 93, 95
     .   : milestone, 94,

    section Baseline
    This PR (7475) - mean (93ms)  : 91, 95
     .   : milestone, 93,
    master - mean (93ms)  : 91, 95
     .   : milestone, 93,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (657ms)  : 637, 678
     .   : milestone, 657,
    master - mean (656ms)  : 637, 674
     .   : milestone, 656,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (93ms)  : 92, 94
     .   : milestone, 93,
    master - mean (93ms)  : 92, 94
     .   : milestone, 93,

    section Baseline
    This PR (7475) - mean (92ms)  : 90, 94
     .   : milestone, 92,
    master - mean (92ms)  : 90, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (590ms)  : 579, 601
     .   : milestone, 590,
    master - mean (597ms)  : 584, 610
     .   : milestone, 597,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (188ms)  : 180, 196
     .   : milestone, 188,
    master - mean (189ms)  : 181, 197
     .   : milestone, 189,

    section Baseline
    This PR (7475) - mean (185ms)  : 177, 194
     .   : milestone, 185,
    master - mean (185ms)  : 177, 193
     .   : milestone, 185,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (1,068ms)  : 1039, 1097
     .   : milestone, 1068,
    master - mean (1,077ms)  : 1036, 1117
     .   : milestone, 1077,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (269ms)  : 261, 277
     .   : milestone, 269,
    master - mean (269ms)  : 261, 277
     .   : milestone, 269,

    section Baseline
    This PR (7475) - mean (269ms)  : 257, 280
     .   : milestone, 269,
    master - mean (268ms)  : 257, 279
     .   : milestone, 268,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (878ms)  : 831, 926
     .   : milestone, 878,
    master - mean (872ms)  : 834, 911
     .   : milestone, 872,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (260ms)  : 251, 268
     .   : milestone, 260,
    master - mean (259ms)  : 251, 266
     .   : milestone, 259,

    section Baseline
    This PR (7475) - mean (259ms)  : 250, 267
     .   : milestone, 259,
    master - mean (261ms)  : 255, 267
     .   : milestone, 261,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (856ms)  : 826, 886
     .   : milestone, 856,
    master - mean (854ms)  : 812, 897
     .   : milestone, 854,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7475) - mean (260ms)  : 251, 269
     .   : milestone, 260,
    master - mean (261ms)  : 252, 270
     .   : milestone, 261,

    section Baseline
    This PR (7475) - mean (260ms)  : 252, 268
     .   : milestone, 260,
    master - mean (258ms)  : 249, 268
     .   : milestone, 258,

    section CallTarget+Inlining+NGEN
    This PR (7475) - mean (768ms)  : 739, 797
     .   : milestone, 768,
    master - mean (770ms)  : 740, 801
     .   : milestone, 770,

Loading

@andrewlock andrewlock force-pushed the andrew/more-native-cleanup branch from 4cc04cd to d958ee8 Compare September 5, 2025 12:02
@pr-commenter
Copy link

pr-commenter bot commented Sep 5, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7475 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.200
  • 3 benchmarks are slower, with geometric mean 1.862
  • 2 benchmarks have fewer allocations
  • 10 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.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10μs 15.5ns 53.5ns 0 0 0 5.5 KB
master StartStopWithChild netcoreapp3.1 13.4μs 68.9ns 338ns 0 0 0 5.69 KB
master StartStopWithChild net472 22.5μs 117ns 535ns 1.04 0.348 0.116 6.05 KB
#7475 StartStopWithChild net6.0 10.3μs 56.5ns 339ns 0 0 0 5.51 KB
#7475 StartStopWithChild netcoreapp3.1 14.5μs 66.6ns 266ns 0 0 0 5.7 KB
#7475 StartStopWithChild net472 21.7μs 118ns 622ns 0.982 0.327 0.109 6.03 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 932μs 43.8ns 158ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 61.2ns 221ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.2ms 352ns 1.36μs 0 0 0 3.31 KB
#7475 WriteAndFlushEnrichedTraces net6.0 929μs 89.6ns 323ns 0 0 0 2.7 KB
#7475 WriteAndFlushEnrichedTraces netcoreapp3.1 1.01ms 105ns 394ns 0 0 0 2.7 KB
#7475 WriteAndFlushEnrichedTraces net472 1.2ms 84.3ns 315ns 0 0 0 3.31 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 324μs 980ns 3.8μs 0 0 0 172.07 KB
master AllCycleSimpleBody netcoreapp3.1 465μs 1.78μs 6.88μs 0 0 0 174.18 KB
master AllCycleSimpleBody net472 430μs 103ns 400ns 30.2 0 0 195.46 KB
master AllCycleMoreComplexBody net6.0 334μs 238ns 890ns 0 0 0 175.58 KB
master AllCycleMoreComplexBody netcoreapp3.1 489μs 611ns 2.29μs 0 0 0 177.6 KB
master AllCycleMoreComplexBody net472 438μs 120ns 465ns 30.2 0 0 198.98 KB
master ObjectExtractorSimpleBody net6.0 316ns 1.83ns 13ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 402ns 2.18ns 11.9ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 303ns 0.117ns 0.436ns 0.0435 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.28μs 29.1ns 113ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.84μs 37.5ns 155ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.72μs 5.86ns 22.7ns 0.573 0 0 3.8 KB
#7475 AllCycleSimpleBody net6.0 324μs 1.36μs 5.28μs 0 0 0 172.07 KB
#7475 AllCycleSimpleBody netcoreapp3.1 481μs 1.53μs 5.93μs 0 0 0 174.18 KB
#7475 AllCycleSimpleBody net472 433μs 154ns 577ns 30.2 0 0 195.46 KB
#7475 AllCycleMoreComplexBody net6.0 331μs 301ns 1.09μs 0 0 0 175.58 KB
#7475 AllCycleMoreComplexBody netcoreapp3.1 462μs 457ns 1.65μs 0 0 0 177.6 KB
#7475 AllCycleMoreComplexBody net472 438μs 184ns 665ns 30.2 0 0 198.98 KB
#7475 ObjectExtractorSimpleBody net6.0 315ns 1.75ns 11ns 0 0 0 280 B
#7475 ObjectExtractorSimpleBody netcoreapp3.1 408ns 2.2ns 12.1ns 0 0 0 272 B
#7475 ObjectExtractorSimpleBody net472 299ns 0.0743ns 0.288ns 0.0437 0 0 281 B
#7475 ObjectExtractorMoreComplexBody net6.0 6.29μs 33.1ns 166ns 0 0 0 3.78 KB
#7475 ObjectExtractorMoreComplexBody netcoreapp3.1 7.78μs 29.4ns 114ns 0 0 0 3.69 KB
#7475 ObjectExtractorMoreComplexBody net472 6.88μs 9.95ns 38.5ns 0.586 0 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 77.6μs 216ns 835ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 95.6μs 280ns 971ns 0 0 0 32.4 KB
master EncodeArgs net472 110μs 16.2ns 62.9ns 4.95 0 0 32.51 KB
master EncodeLegacyArgs net6.0 144μs 226ns 873ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 195μs 200ns 775ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 262μs 45.3ns 175ns 0 0 0 2.16 KB
#7475 EncodeArgs net6.0 77μs 306ns 1.19μs 0 0 0 32.4 KB
#7475 EncodeArgs netcoreapp3.1 99.1μs 409ns 1.58μs 0 0 0 32.4 KB
#7475 EncodeArgs net472 109μs 17.5ns 65.7ns 4.92 0 0 32.5 KB
#7475 EncodeLegacyArgs net6.0 146μs 40.4ns 151ns 0 0 0 2.15 KB
#7475 EncodeLegacyArgs netcoreapp3.1 201μs 151ns 583ns 0 0 0 2.14 KB
#7475 EncodeLegacyArgs net472 262μs 97.5ns 378ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #7475

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.473 300,467.07 743,078.66
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.072 415,018.75 859,782.00

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 394μs 294ns 1.06μs 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 415μs 376ns 1.46μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 434μs 84.1ns 326ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 290μs 112ns 418ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 301μs 140ns 522ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 312μs 91.1ns 341ns 0 0 0 2.29 KB
#7475 RunWafRealisticBenchmark net6.0 392μs 62.7ns 243ns 0 0 0 4.55 KB
#7475 RunWafRealisticBenchmark netcoreapp3.1 817μs 10.1μs 101μs 0 0 0 4.48 KB
#7475 RunWafRealisticBenchmark net472 433μs 74ns 287ns 0 0 0 4.66 KB
#7475 RunWafRealisticBenchmarkWithAttack net6.0 291μs 80.6ns 312ns 0 0 0 2.24 KB
#7475 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 674μs 14.9μs 148μs 0 0 0 2.22 KB
#7475 RunWafRealisticBenchmarkWithAttack net472 313μs 47.8ns 185ns 0 0 0 2.29 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 62μs 292ns 1.13μs 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.5μs 52.2ns 202ns 0 0 0 17.42 KB
master SendRequest net472 0.0138ns 0.00141ns 0.00546ns 0 0 0 0 b
#7475 SendRequest net6.0 60.9μs 31.4ns 113ns 0 0 0 14.52 KB
#7475 SendRequest netcoreapp3.1 70.7μs 217ns 783ns 0 0 0 17.47 KB
#7475 SendRequest net472 0.0224ns 0.00126ns 0.00472ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7475

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 1.204 2,068,445.83 1,717,497.50
Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑netcoreapp3.1 1.195 2,466,977.08 2,063,678.12

More allocations ⚠️ in #7475

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 0 b 1 B 1 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 5 B 7 B 2 B 40.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 3 B 4 B 1 B 33.33%

Fewer allocations 🎉 in #7475

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 73 B 0 b -73 B -100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 47 B 0 b -47 B -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.92ms 5.86μs 22.7μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.46ms 6.72μs 26μs 0 0 0 640.11 KB
master OriginalCharSlice net472 2.72ms 201ns 751ns 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.41ms 181ns 701ns 0 0 0 5 B
master OptimizedCharSlice netcoreapp3.1 2.07ms 409ns 1.59μs 0 0 0 1 B
master OptimizedCharSlice net472 1.99ms 104ns 405ns 0 0 0 73 B
master OptimizedCharSliceWithPool net6.0 801μs 14ns 50.5ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 832μs 41.2ns 160ns 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.14ms 451ns 1.69μs 0 0 0 47 B
#7475 OriginalCharSlice net6.0 1.93ms 544ns 1.96μs 0 0 0 640.01 KB
#7475 OriginalCharSlice netcoreapp3.1 2.06ms 4.25μs 16.5μs 0 0 0 640 KB
#7475 OriginalCharSlice net472 2.61ms 154ns 596ns 100 0 0 641.95 KB
#7475 OptimizedCharSlice net6.0 1.38ms 603ns 2.33μs 0 0 0 7 B
#7475 OptimizedCharSlice netcoreapp3.1 1.72ms 130ns 502ns 0 0 0 1 B
#7475 OptimizedCharSlice net472 1.93ms 148ns 573ns 0 0 0 0 b
#7475 OptimizedCharSliceWithPool net6.0 804μs 26.8ns 100ns 0 0 0 4 B
#7475 OptimizedCharSliceWithPool netcoreapp3.1 815μs 211ns 815ns 0 0 0 1 B
#7475 OptimizedCharSliceWithPool net472 1.14ms 113ns 409ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7475

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.82 KB 42.35 KB 530 B 1.27%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.9 KB 42.29 KB 388 B 0.93%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 682μs 3.9μs 28.1μs 0 0 0 41.9 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 687μs 3.04μs 11.8μs 0 0 0 41.82 KB
master WriteAndFlushEnrichedTraces net472 867μs 2.7μs 9.73μs 8.33 0 0 56.15 KB
#7475 WriteAndFlushEnrichedTraces net6.0 679μs 3.97μs 36.2μs 0 0 0 42.29 KB
#7475 WriteAndFlushEnrichedTraces netcoreapp3.1 640μs 599ns 2.24μs 0 0 0 42.35 KB
#7475 WriteAndFlushEnrichedTraces net472 908μs 4.99μs 30.8μs 8.33 0 0 56.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.9μs 8.21ns 31.8ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.46μs 7.98ns 27.6ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.87μs 6.03ns 23.4ns 0.156 0.0141 0 987 B
#7475 ExecuteNonQuery net6.0 1.89μs 9.05ns 37.3ns 0 0 0 1.02 KB
#7475 ExecuteNonQuery netcoreapp3.1 2.55μs 8.59ns 33.3ns 0 0 0 1.02 KB
#7475 ExecuteNonQuery net472 2.74μs 2.49ns 8.97ns 0.151 0.0137 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.69μs 1.26ns 4.89ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.24μs 7.46ns 28.9ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.63μs 6.99ns 27.1ns 0.162 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.79μs 1.24ns 4.79ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.41μs 5.22ns 20.2ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.74μs 3.08ns 11.9ns 0.168 0 0 1.1 KB
#7475 CallElasticsearch net6.0 1.74μs 8.39ns 35.6ns 0 0 0 1.03 KB
#7475 CallElasticsearch netcoreapp3.1 2.25μs 1.02ns 3.83ns 0 0 0 1.03 KB
#7475 CallElasticsearch net472 3.57μs 6.59ns 25.5ns 0.16 0 0 1.04 KB
#7475 CallElasticsearchAsync net6.0 1.93μs 1.44ns 5.56ns 0 0 0 1.01 KB
#7475 CallElasticsearchAsync netcoreapp3.1 2.31μs 12ns 56.4ns 0 0 0 1.08 KB
#7475 CallElasticsearchAsync net472 3.84μs 5.01ns 19.4ns 0.172 0 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.88μs 6.92ns 25.9ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.36μs 12.1ns 53.9ns 0 0 0 952 B
master ExecuteAsync net472 2.59μs 4.64ns 18ns 0.144 0 0 915 B
#7475 ExecuteAsync net6.0 1.84μs 7.3ns 28.3ns 0 0 0 952 B
#7475 ExecuteAsync netcoreapp3.1 2.25μs 5.97ns 22.3ns 0 0 0 952 B
#7475 ExecuteAsync net472 2.48μs 10.3ns 39.9ns 0.136 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 6.93μs 6.2ns 21.5ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.77μs 11.5ns 44.5ns 0 0 0 2.9 KB
master SendAsync net472 12.5μs 10.5ns 40.6ns 0.496 0 0 3.18 KB
#7475 SendAsync net6.0 6.98μs 11.3ns 43.9ns 0 0 0 2.36 KB
#7475 SendAsync netcoreapp3.1 8.36μs 23.6ns 91.6ns 0 0 0 2.9 KB
#7475 SendAsync net472 12.3μs 11.8ns 45.6ns 0.493 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7475

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 1.261 49,850.00 62,850.00 several?

More allocations ⚠️ in #7475

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.1 KB 47.66 KB 4.56 KB 10.58%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 255.09 KB 275.73 KB 20.64 KB 8.09%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 259.59 KB 274.81 KB 15.22 KB 5.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 278.53 KB 286.72 KB 8.19 KB 2.94%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 42.91 KB 43.14 KB 224 B 0.52%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 42.9μs 241ns 1.94μs 0 0 0 43.1 KB
master StringConcatBenchmark netcoreapp3.1 51.8μs 475ns 4.65μs 0 0 0 42.91 KB
master StringConcatBenchmark net472 57.1μs 222ns 800ns 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 465μs 1.45μs 5.62μs 0 0 0 259.59 KB
master StringConcatAspectBenchmark netcoreapp3.1 487μs 2.27μs 9.38μs 0 0 0 255.09 KB
master StringConcatAspectBenchmark net472 408μs 2.29μs 14.6μs 0 0 0 278.53 KB
#7475 StringConcatBenchmark net6.0 44.7μs 254ns 2.15μs 0 0 0 47.66 KB
#7475 StringConcatBenchmark netcoreapp3.1 59.8μs 715ns 7.08μs 0 0 0 43.14 KB
#7475 StringConcatBenchmark net472 57.6μs 185ns 665ns 0 0 0 65.54 KB
#7475 StringConcatAspectBenchmark net6.0 488μs 2.22μs 8μs 0 0 0 274.81 KB
#7475 StringConcatAspectBenchmark netcoreapp3.1 477μs 5.82μs 57.6μs 0 0 0 275.73 KB
#7475 StringConcatAspectBenchmark net472 406μs 2.05μs 8.93μs 0 0 0 286.72 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 2.57μs 14ns 79.1ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.47μs 10.7ns 41.4ns 0 0 0 1.7 KB
master EnrichedLog net472 4.23μs 4.47ns 17.3ns 0.253 0 0 1.64 KB
#7475 EnrichedLog net6.0 2.53μs 12.7ns 55.5ns 0 0 0 1.7 KB
#7475 EnrichedLog netcoreapp3.1 3.32μs 16.5ns 70.2ns 0 0 0 1.7 KB
#7475 EnrichedLog net472 3.91μs 2.32ns 8.99ns 0.254 0 0 1.64 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 123μs 100ns 374ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 234ns 877ns 0 0 0 4.31 KB
master EnrichedLog net472 165μs 21.8ns 78.6ns 0 0 0 4.51 KB
#7475 EnrichedLog net6.0 122μs 30.8ns 115ns 0 0 0 4.31 KB
#7475 EnrichedLog netcoreapp3.1 128μs 397ns 1.54μs 0 0 0 4.31 KB
#7475 EnrichedLog net472 167μs 36ns 139ns 0 0 0 4.52 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 4.96μs 23.6ns 91.3ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.75μs 11.8ns 44.3ns 0 0 0 2.26 KB
master EnrichedLog net472 7.53μs 9.06ns 35.1ns 0.298 0 0 2.08 KB
#7475 EnrichedLog net6.0 5.08μs 18ns 64.8ns 0 0 0 2.26 KB
#7475 EnrichedLog netcoreapp3.1 6.73μs 13.1ns 50.6ns 0 0 0 2.26 KB
#7475 EnrichedLog net472 7.32μs 4.17ns 15.6ns 0.33 0 0 2.08 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 2μs 9.98ns 45.7ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.55μs 11.7ns 45.3ns 0 0 0 1.2 KB
master SendReceive net472 3.17μs 2.33ns 8.39ns 0.187 0 0 1.2 KB
#7475 SendReceive net6.0 1.94μs 0.611ns 2.29ns 0 0 0 1.2 KB
#7475 SendReceive netcoreapp3.1 2.76μs 12.7ns 49.2ns 0 0 0 1.2 KB
#7475 SendReceive net472 3.09μs 5.87ns 22.7ns 0.186 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 4.22μs 14.9ns 57.9ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.53μs 7.87ns 30.5ns 0 0 0 1.63 KB
master EnrichedLog net472 6.86μs 11.2ns 43.4ns 0.308 0 0 2.03 KB
#7475 EnrichedLog net6.0 4.13μs 2.41ns 9.03ns 0 0 0 1.58 KB
#7475 EnrichedLog netcoreapp3.1 5.59μs 10.5ns 40.6ns 0 0 0 1.63 KB
#7475 EnrichedLog net472 6.59μs 6.12ns 23.7ns 0.295 0 0 2.03 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 760ns 0.166ns 0.644ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 961ns 5.24ns 25.7ns 0 0 0 576 B
master StartFinishSpan net472 895ns 0.0206ns 0.0742ns 0.09 0 0 578 B
master StartFinishScope net6.0 869ns 4.79ns 29.1ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.19μs 0.544ns 2.11ns 0 0 0 696 B
master StartFinishScope net472 1.08μs 0.0897ns 0.324ns 0.103 0 0 658 B
#7475 StartFinishSpan net6.0 744ns 0.414ns 1.6ns 0 0 0 576 B
#7475 StartFinishSpan netcoreapp3.1 933ns 4.27ns 17.1ns 0 0 0 576 B
#7475 StartFinishSpan net472 895ns 0.136ns 0.473ns 0.0898 0 0 578 B
#7475 StartFinishScope net6.0 880ns 4.11ns 16.5ns 0 0 0 696 B
#7475 StartFinishScope netcoreapp3.1 1.11μs 5.99ns 31.7ns 0 0 0 696 B
#7475 StartFinishScope net472 1.09μs 0.0767ns 0.277ns 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 1.02μs 0.524ns 2.03ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.33μs 5.91ns 22.1ns 0 0 0 696 B
master RunOnMethodBegin net472 1.37μs 0.187ns 0.699ns 0.103 0 0 658 B
#7475 RunOnMethodBegin net6.0 1.01μs 5.01ns 20.7ns 0 0 0 696 B
#7475 RunOnMethodBegin netcoreapp3.1 1.35μs 1.14ns 4.43ns 0 0 0 696 B
#7475 RunOnMethodBegin net472 1.39μs 0.717ns 2.78ns 0.0983 0 0 658 B

Copy link
Contributor

@zacharycmontoya zacharycmontoya 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!

Comment on lines +15 to +16
inline static const shared::WSTRING include_process_names = WStr("DD_PROFILER_PROCESSES");
inline static const shared::WSTRING exclude_process_names = WStr("DD_PROFILER_EXCLUDE_PROCESSES");
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but we should consider renaming these two env vars to remove PROFILER from their names (while keeping backwards support for the old names). Something like:

DD_PROFILER_PROCESSES         -> DD_INCLUDE_PROCESS_NAMES
DD_PROFILER_EXCLUDE_PROCESSES -> DD_EXCLUDE_PROCESS_NAMES

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, while I totally agree in principal, this is very low down on the priority list (as I think you'd agree) given it's essentially an undocumented feature too. It would also be the first and only case of supporting "fallbacks" on the native-side I think

// Note that you should also consider adding to the SSI tracer/build/artifacts/requirements.json file
// FIXME: this should also take into account case insensitivity, but that is not yet supported
// https://devblogs.microsoft.com/oldnewthing/20241007-00/?p=110345
const shared::WSTRING default_exclude_assemblies[]{
Copy link
Member

@lucaspimentel lucaspimentel Sep 5, 2025

Choose a reason for hiding this comment

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

(commenting here because the new UI doesn't support file-level comments)
Should we rename this file to remove "profiler" from the name? Maybe constants.h?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, why not I guess 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

But given this touches like 30 files, I'll defer to a different PR 😅

Copy link
Member

@lucaspimentel lucaspimentel left a comment

Choose a reason for hiding this comment

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

I love cleanups, thanks!

@andrewlock andrewlock force-pushed the andrew/more-native-cleanup branch from 9fc398b to 6879900 Compare September 8, 2025 09:32
Copy link
Collaborator

@gleocadie gleocadie 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 9e2737a into master Sep 11, 2025
158 of 160 checks passed
@andrewlock andrewlock deleted the andrew/more-native-cleanup branch September 11, 2025 10:17
@github-actions github-actions bot added this to the vNext-v3 milestone Sep 11, 2025
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) type:cleanup Minor code clean up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants