Skip to content

[Profiler] Support Stable Config#7287

Merged
chrisnas merged 67 commits into
masterfrom
chrisnas/stable_config
Sep 23, 2025
Merged

[Profiler] Support Stable Config#7287
chrisnas merged 67 commits into
masterfrom
chrisnas/stable_config

Conversation

@chrisnas

Copy link
Copy Markdown
Contributor

Summary of changes

The managed layer of the tracer should be able to set basic configuration to the profiling including per runtimeID details

Reason for change

Support Stable Configuration

Implementation details

  • add p/invoke method
  • update profiler configuration management and SSI

Test coverage

  • update existing ones and add new needed scenarios

Other details

@chrisnas
chrisnas requested review from a team as code owners July 28, 2025 09:43
@github-actions github-actions Bot added the area:profiler Issues related to the continous-profiler label Jul 28, 2025
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Jul 28, 2025

Copy link
Copy Markdown

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 (7287) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7287) - mean (68ms)  : 66, 70
     .   : milestone, 68,
    master - mean (68ms)  : 66, 71
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (1,040ms)  : 1004, 1076
     .   : milestone, 1040,
    master - mean (1,002ms)  : 976, 1028
     .   : milestone, 1002,

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

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

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (745ms)  : 722, 767
     .   : milestone, 745,
    master - mean (713ms)  : 694, 731
     .   : milestone, 713,

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

    section Baseline
    This PR (7287) - mean (93ms)  : 91, 96
     .   : milestone, 93,
    master - mean (94ms)  : 92, 95
     .   : milestone, 94,

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (707ms)  : crit, 676, 738
     .   : crit, milestone, 707,
    master - mean (668ms)  : 654, 683
     .   : milestone, 668,

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

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

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (657ms)  : crit, 643, 672
     .   : crit, milestone, 657,
    master - mean (601ms)  : 588, 613
     .   : milestone, 601,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7287) - mean (194ms)  : 190, 198
     .   : milestone, 194,
    master - mean (194ms)  : 189, 200
     .   : milestone, 194,

    section Baseline
    This PR (7287) - mean (191ms)  : 184, 197
     .   : milestone, 191,
    master - mean (191ms)  : 186, 197
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (1,153ms)  : 1088, 1218
     .   : milestone, 1153,
    master - mean (1,102ms)  : 1065, 1138
     .   : milestone, 1102,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7287) - mean (276ms)  : 270, 282
     .   : milestone, 276,
    master - mean (276ms)  : 270, 281
     .   : milestone, 276,

    section Baseline
    This PR (7287) - mean (274ms)  : 266, 282
     .   : milestone, 274,
    master - mean (273ms)  : 265, 281
     .   : milestone, 273,

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (923ms)  : 890, 956
     .   : milestone, 923,
    master - mean (897ms)  : 857, 936
     .   : milestone, 897,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7287) - mean (267ms)  : 261, 272
     .   : milestone, 267,
    master - mean (267ms)  : 262, 272
     .   : milestone, 267,

    section Baseline
    This PR (7287) - mean (267ms)  : 259, 275
     .   : milestone, 267,
    master - mean (267ms)  : 260, 275
     .   : milestone, 267,

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (921ms)  : 875, 966
     .   : milestone, 921,
    master - mean (874ms)  : 834, 913
     .   : milestone, 874,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7287) - mean (265ms)  : 258, 273
     .   : milestone, 265,
    master - mean (267ms)  : 257, 276
     .   : milestone, 267,

    section Baseline
    This PR (7287) - mean (265ms)  : 260, 271
     .   : milestone, 265,
    master - mean (264ms)  : 258, 271
     .   : milestone, 264,

    section CallTarget+Inlining+NGEN
    This PR (7287) - mean (840ms)  : crit, 809, 871
     .   : crit, milestone, 840,
    master - mean (787ms)  : 766, 809
     .   : milestone, 787,

Loading

@pr-commenter

pr-commenter Bot commented Jul 29, 2025

Copy link
Copy Markdown

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7287 compared to master:

  • 1 benchmarks are faster, with geometric mean 2.488
  • 1 benchmarks are slower, with geometric mean 1.169
  • 5 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.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.5μs 56.3ns 319ns 0 0 0 5.49 KB
master StartStopWithChild netcoreapp3.1 14.2μs 45ns 174ns 0 0 0 5.71 KB
master StartStopWithChild net472 21.7μs 67.8ns 254ns 1.02 0.338 0.113 6.04 KB
#7287 StartStopWithChild net6.0 11μs 39.5ns 153ns 0 0 0 5.5 KB
#7287 StartStopWithChild netcoreapp3.1 13.7μs 64.7ns 259ns 0 0 0 5.71 KB
#7287 StartStopWithChild net472 22μs 116ns 578ns 0.877 0.219 0 6.03 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7287

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.35 KB 3.31 KB -46 B -1.37%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 922μs 218ns 843ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 207ns 803ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.21ms 2.26μs 8.76μs 0 0 0 3.35 KB
#7287 WriteAndFlushEnrichedTraces net6.0 930μs 80.5ns 290ns 0 0 0 2.71 KB
#7287 WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 218ns 843ns 0 0 0 2.7 KB
#7287 WriteAndFlushEnrichedTraces net472 1.21ms 349ns 1.35μs 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 334μs 610ns 2.36μs 0 0 0 175.6 KB
master AllCycleSimpleBody netcoreapp3.1 499μs 822ns 3.18μs 0 0 0 177.77 KB
master AllCycleSimpleBody net472 440μs 145ns 560ns 30.2 0 0 199.81 KB
master AllCycleMoreComplexBody net6.0 337μs 1.36μs 5.1μs 0 0 0 179.1 KB
master AllCycleMoreComplexBody netcoreapp3.1 501μs 771ns 2.89μs 0 0 0 181.18 KB
master AllCycleMoreComplexBody net472 463μs 268ns 1.04μs 30.1 0 0 203.32 KB
master ObjectExtractorSimpleBody net6.0 329ns 1.6ns 6.61ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 397ns 1.06ns 4.09ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 300ns 0.0507ns 0.19ns 0.0439 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.37μs 1.92ns 7.18ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.68μs 33.5ns 130ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.72μs 2.92ns 11.3ns 0.571 0 0 3.8 KB
#7287 AllCycleSimpleBody net6.0 332μs 1.54μs 6.18μs 0 0 0 175.6 KB
#7287 AllCycleSimpleBody netcoreapp3.1 469μs 1.32μs 4.94μs 0 0 0 177.77 KB
#7287 AllCycleSimpleBody net472 440μs 165ns 640ns 30.2 0 0 199.81 KB
#7287 AllCycleMoreComplexBody net6.0 341μs 1.61μs 6.66μs 0 0 0 179.1 KB
#7287 AllCycleMoreComplexBody netcoreapp3.1 506μs 1.93μs 7.46μs 0 0 0 181.18 KB
#7287 AllCycleMoreComplexBody net472 453μs 129ns 484ns 31.2 0 0 203.32 KB
#7287 ObjectExtractorSimpleBody net6.0 336ns 1.65ns 6.61ns 0 0 0 280 B
#7287 ObjectExtractorSimpleBody netcoreapp3.1 405ns 2.1ns 10.1ns 0 0 0 272 B
#7287 ObjectExtractorSimpleBody net472 301ns 0.0508ns 0.19ns 0.044 0 0 281 B
#7287 ObjectExtractorMoreComplexBody net6.0 6.36μs 28ns 109ns 0 0 0 3.78 KB
#7287 ObjectExtractorMoreComplexBody netcoreapp3.1 7.94μs 40.3ns 176ns 0 0 0 3.69 KB
#7287 ObjectExtractorMoreComplexBody net472 6.77μs 2.12ns 8.22ns 0.574 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 76.5μs 180ns 698ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97μs 238ns 921ns 0 0 0 32.4 KB
master EncodeArgs net472 108μs 12.4ns 48ns 4.86 0 0 32.51 KB
master EncodeLegacyArgs net6.0 146μs 50ns 173ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 197μs 372ns 1.44μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 22.6ns 87.5ns 0 0 0 2.16 KB
#7287 EncodeArgs net6.0 78.8μs 25.6ns 99.3ns 0 0 0 32.4 KB
#7287 EncodeArgs netcoreapp3.1 101μs 182ns 705ns 0 0 0 32.4 KB
#7287 EncodeArgs net472 111μs 11.6ns 44.8ns 5.02 0 0 32.51 KB
#7287 EncodeLegacyArgs net6.0 148μs 95.8ns 371ns 0 0 0 2.14 KB
#7287 EncodeLegacyArgs netcoreapp3.1 197μs 228ns 884ns 0 0 0 2.14 KB
#7287 EncodeLegacyArgs net472 262μs 85ns 329ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7287

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.488 732,916.82 294,543.75

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 392μs 130ns 505ns 0 0 0 4.56 KB
master RunWafRealisticBenchmark netcoreapp3.1 416μs 117ns 404ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 429μs 79ns 306ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 287μs 29.7ns 103ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 730μs 3.51μs 14.5μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 308μs 25.8ns 100ns 0 0 0 2.29 KB
#7287 RunWafRealisticBenchmark net6.0 394μs 63.5ns 229ns 0 0 0 4.55 KB
#7287 RunWafRealisticBenchmark netcoreapp3.1 408μs 37.1ns 139ns 0 0 0 4.48 KB
#7287 RunWafRealisticBenchmark net472 426μs 48.1ns 186ns 0 0 0 4.66 KB
#7287 RunWafRealisticBenchmarkWithAttack net6.0 281μs 27.1ns 105ns 0 0 0 2.24 KB
#7287 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 296μs 719ns 2.49μs 0 0 0 2.22 KB
#7287 RunWafRealisticBenchmarkWithAttack net472 310μs 41.5ns 161ns 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 60.9μs 37.6ns 136ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.5μs 66ns 238ns 0 0 0 17.42 KB
master SendRequest net472 0.00282ns 0.00156ns 0.00606ns 0 0 0 0 b
#7287 SendRequest net6.0 60.7μs 32.5ns 126ns 0 0 0 14.52 KB
#7287 SendRequest netcoreapp3.1 71.5μs 115ns 444ns 0 0 0 17.42 KB
#7287 SendRequest net472 0.00891ns 0.00205ns 0.00794ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #7287

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 1.169 800,100.72 935,103.75

Fewer allocations 🎉 in #7287

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 3 B 1 B -2 B -66.67%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 2.03ms 1.48μs 5.54μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.1ms 7.31μs 28.3μs 0 0 0 640 KB
master OriginalCharSlice net472 2.67ms 276ns 1.07μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.41ms 554ns 2.07μs 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.74ms 500ns 1.94μs 0 0 0 1 B
master OptimizedCharSlice net472 1.95ms 442ns 1.71μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 800μs 120ns 465ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 813μs 106ns 395ns 0 0 0 1 B
master OptimizedCharSliceWithPool net472 1.13ms 91ns 353ns 0 0 0 0 b
#7287 OriginalCharSlice net6.0 2.09ms 17.2μs 172μs 0 0 0 640.01 KB
#7287 OriginalCharSlice netcoreapp3.1 2.08ms 7.54μs 28.2μs 0 0 0 640 KB
#7287 OriginalCharSlice net472 2.65ms 145ns 501ns 100 0 0 641.95 KB
#7287 OptimizedCharSlice net6.0 1.4ms 387ns 1.45μs 0 0 0 4 B
#7287 OptimizedCharSlice netcoreapp3.1 1.7ms 504ns 1.82μs 0 0 0 1 B
#7287 OptimizedCharSlice net472 1.99ms 428ns 1.66μs 0 0 0 0 b
#7287 OptimizedCharSliceWithPool net6.0 935μs 67ns 260ns 0 0 0 1 B
#7287 OptimizedCharSliceWithPool netcoreapp3.1 812μs 497ns 1.92μs 0 0 0 1 B
#7287 OptimizedCharSliceWithPool net472 1.15ms 26.3ns 102ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7287

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 55.68 KB 56.08 KB 405 B 0.73%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 703μs 3.22μs 12.9μs 0 0 0 41.68 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 678μs 3.91μs 32.9μs 0 0 0 41.94 KB
master WriteAndFlushEnrichedTraces net472 910μs 2.25μs 8.43μs 4.46 0 0 55.68 KB
#7287 WriteAndFlushEnrichedTraces net6.0 748μs 1.16μs 4.48μs 0 0 0 41.6 KB
#7287 WriteAndFlushEnrichedTraces netcoreapp3.1 664μs 3.36μs 20.4μs 0 0 0 41.99 KB
#7287 WriteAndFlushEnrichedTraces net472 871μs 4.83μs 28.1μs 8.33 0 0 56.08 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.88μs 8.89ns 37.7ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.55μs 7.93ns 30.7ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.78μs 3.08ns 11.9ns 0.154 0.014 0 987 B
#7287 ExecuteNonQuery net6.0 1.89μs 8.54ns 33.1ns 0 0 0 1.02 KB
#7287 ExecuteNonQuery netcoreapp3.1 2.58μs 3.89ns 14.6ns 0 0 0 1.02 KB
#7287 ExecuteNonQuery net472 2.89μs 14.7ns 65.8ns 0.155 0.0141 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.79μs 6.33ns 24.5ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.23μs 8.52ns 33ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.47μs 1.31ns 4.74ns 0.159 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.77μs 8.8ns 36.3ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.4μs 8.77ns 34ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.69μs 5.86ns 22.7ns 0.166 0 0 1.1 KB
#7287 CallElasticsearch net6.0 1.76μs 8.47ns 35.9ns 0 0 0 1.03 KB
#7287 CallElasticsearch netcoreapp3.1 2.25μs 6.8ns 26.3ns 0 0 0 1.03 KB
#7287 CallElasticsearch net472 3.49μs 2.68ns 10.4ns 0.157 0 0 1.04 KB
#7287 CallElasticsearchAsync net6.0 1.79μs 7.73ns 29.9ns 0 0 0 1.01 KB
#7287 CallElasticsearchAsync netcoreapp3.1 2.38μs 9.12ns 35.3ns 0 0 0 1.08 KB
#7287 CallElasticsearchAsync net472 3.78μs 2.49ns 9.66ns 0.168 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.89μs 6.72ns 26ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.23μs 8.48ns 32.9ns 0 0 0 952 B
master ExecuteAsync net472 2.5μs 2.14ns 8.02ns 0.138 0 0 915 B
#7287 ExecuteAsync net6.0 1.9μs 8.02ns 31ns 0 0 0 952 B
#7287 ExecuteAsync netcoreapp3.1 2.26μs 6.52ns 25.3ns 0 0 0 952 B
#7287 ExecuteAsync net472 2.5μs 1.03ns 4ns 0.138 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.95μs 21.2ns 79.2ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.55μs 19.4ns 72.5ns 0 0 0 2.9 KB
master SendAsync net472 12.5μs 16.8ns 65.2ns 0.495 0 0 3.18 KB
#7287 SendAsync net6.0 7.13μs 16.6ns 64.3ns 0 0 0 2.36 KB
#7287 SendAsync netcoreapp3.1 8.54μs 33.3ns 129ns 0 0 0 2.9 KB
#7287 SendAsync net472 12μs 10.7ns 37.2ns 0.481 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7287

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.78 KB 44.07 KB 296 B 0.68%

Fewer allocations 🎉 in #7287

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 277.54 KB 275.06 KB -2.48 KB -0.89%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 278.16 KB 272.99 KB -5.17 KB -1.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 86.24 KB 42.64 KB -43.6 KB -50.56%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 48.6μs 268ns 1.65μs 0 0 0 43.78 KB
master StringConcatBenchmark netcoreapp3.1 49.7μs 289ns 2.65μs 0 0 0 86.24 KB
master StringConcatBenchmark net472 57.4μs 235ns 878ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 471μs 1.94μs 6.72μs 0 0 0 277.54 KB
master StringConcatAspectBenchmark netcoreapp3.1 548μs 1.83μs 6.86μs 0 0 0 278.16 KB
master StringConcatAspectBenchmark net472 400μs 2.28μs 17.1μs 0 0 0 278.53 KB
#7287 StringConcatBenchmark net6.0 48.4μs 265ns 1.45μs 0 0 0 44.07 KB
#7287 StringConcatBenchmark netcoreapp3.1 48.5μs 258ns 1.42μs 0 0 0 42.64 KB
#7287 StringConcatBenchmark net472 56.9μs 249ns 1.06μs 0 0 0 57.34 KB
#7287 StringConcatAspectBenchmark net6.0 477μs 2.16μs 7.8μs 0 0 0 275.06 KB
#7287 StringConcatAspectBenchmark netcoreapp3.1 515μs 2.27μs 8.49μs 0 0 0 272.99 KB
#7287 StringConcatAspectBenchmark net472 406μs 2.31μs 16μs 0 0 0 278.53 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.61μs 12.3ns 49.3ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.38μs 11.7ns 42.2ns 0 0 0 1.7 KB
master EnrichedLog net472 3.88μs 3.5ns 13.1ns 0.252 0 0 1.64 KB
#7287 EnrichedLog net6.0 2.56μs 10.3ns 41ns 0 0 0 1.7 KB
#7287 EnrichedLog netcoreapp3.1 3.44μs 16.2ns 67ns 0 0 0 1.7 KB
#7287 EnrichedLog net472 3.93μs 5.51ns 21.3ns 0.252 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 122μs 45.3ns 170ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 377ns 1.41μs 0 0 0 4.31 KB
master EnrichedLog net472 166μs 98.6ns 382ns 0 0 0 4.51 KB
#7287 EnrichedLog net6.0 123μs 70.3ns 263ns 0 0 0 4.31 KB
#7287 EnrichedLog netcoreapp3.1 128μs 307ns 1.15μs 0 0 0 4.31 KB
#7287 EnrichedLog net472 167μs 110ns 411ns 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.9μs 19.5ns 67.7ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.5μs 20.3ns 78.8ns 0 0 0 2.26 KB
master EnrichedLog net472 7.56μs 6.99ns 26.1ns 0.302 0 0 2.08 KB
#7287 EnrichedLog net6.0 4.98μs 7.36ns 27.5ns 0 0 0 2.26 KB
#7287 EnrichedLog netcoreapp3.1 6.62μs 16.1ns 62.5ns 0 0 0 2.26 KB
#7287 EnrichedLog net472 7.55μs 7.49ns 29ns 0.299 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.02μs 10.6ns 44.8ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.57μs 1.44ns 5.38ns 0 0 0 1.2 KB
master SendReceive net472 3.21μs 2.5ns 9.7ns 0.177 0 0 1.2 KB
#7287 SendReceive net6.0 2.1μs 2.57ns 9.97ns 0 0 0 1.2 KB
#7287 SendReceive netcoreapp3.1 2.58μs 12ns 49.3ns 0 0 0 1.2 KB
#7287 SendReceive net472 3.25μs 3.69ns 14.3ns 0.178 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.38μs 4.13ns 15.4ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.47μs 10.1ns 39.3ns 0 0 0 1.63 KB
master EnrichedLog net472 6.63μs 7.13ns 27.6ns 0.296 0 0 2.03 KB
#7287 EnrichedLog net6.0 4.14μs 11.8ns 45.9ns 0 0 0 1.58 KB
#7287 EnrichedLog netcoreapp3.1 5.49μs 10.5ns 40.8ns 0 0 0 1.63 KB
#7287 EnrichedLog net472 6.88μs 7.26ns 28.1ns 0.31 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 753ns 3.44ns 13.8ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 990ns 4.88ns 20.7ns 0 0 0 576 B
master StartFinishSpan net472 906ns 0.761ns 2.95ns 0.0903 0 0 578 B
master StartFinishScope net6.0 883ns 0.187ns 0.724ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.18μs 6.38ns 30.6ns 0 0 0 696 B
master StartFinishScope net472 1.1μs 0.537ns 2.01ns 0.0996 0 0 658 B
#7287 StartFinishSpan net6.0 763ns 3.73ns 16.2ns 0 0 0 576 B
#7287 StartFinishSpan netcoreapp3.1 929ns 4.87ns 23.4ns 0 0 0 576 B
#7287 StartFinishSpan net472 911ns 0.693ns 2.69ns 0.0917 0 0 578 B
#7287 StartFinishScope net6.0 887ns 4.91ns 24.5ns 0 0 0 696 B
#7287 StartFinishScope netcoreapp3.1 1.16μs 5.58ns 21.6ns 0 0 0 696 B
#7287 StartFinishScope net472 1.1μs 0.48ns 1.8ns 0.103 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.06μs 5.05ns 20.8ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.36μs 4.01ns 15.5ns 0 0 0 696 B
master RunOnMethodBegin net472 1.4μs 0.391ns 1.51ns 0.0979 0 0 658 B
#7287 RunOnMethodBegin net6.0 1.07μs 1.17ns 4.53ns 0 0 0 696 B
#7287 RunOnMethodBegin netcoreapp3.1 1.37μs 4.06ns 15.7ns 0 0 0 696 B
#7287 RunOnMethodBegin net472 1.39μs 0.785ns 3.04ns 0.104 0 0 658 B

@chrisnas
chrisnas requested a review from a team as a code owner August 1, 2025 07:53
@datadog-official

This comment has been minimized.

Comment thread tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs Outdated
andrewlock added a commit that referenced this pull request Sep 19, 2025
## Summary of changes

Ensure the profiler files are available in the execution benchmarks

## Reason for change

While working on #7287, we discovered that the profiler was not
downloaded, which was causing a stable config PInvoke to fail. To more
closely replicate customer environments, we should ensure the profiler
is available in these benchmarks, as it will impact startup time etc.

> Note that we are introducing a separate mitigation in #7287 to handle
the scenario where the profiler is not available, e.g. in serverless
environments

## Implementation details

Download the `windows-profiler-home` artifact. Note that the
`windows-tracer-home` artifact is _already_ available thanks to the
`restore-working-directory` step, so it's not necessary to re-download
it.

## Test coverage

This is the test, we'll examine the benchmarks out of interest to see if
there's any impact, but fundamentally this is the more "correct"
behaviour anyway.

## Other details

Blocks #7287
andrewlock added a commit that referenced this pull request Sep 19, 2025
## Summary of changes

Add a checker to decide whether the profiler is available

## Reason for change

We are going to be (and are currently) making P/Invoke calls on startup
to call the profiler. If the ClrProfiler is not attached, or the CP file
is not available (and so P/Invokes are not re-written) then this can
cause additional delays.

## Implementation details

Add explicit checks for
- Unsupported environments
- Has the profiler set the "profiler available" env var (only works on
Windows right now)
- Are we in known unsupported environments (lambda and Azure functions
outside of AAS extension)
- Is the ClrProfiler attached

## Test coverage

If everything still works, this _should_ work

## Other details

A blocker for #7287
Comment thread tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs Outdated
Comment thread tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs Outdated
@chrisnas
chrisnas merged commit 2fe4a6d into master Sep 23, 2025
162 checks passed
@chrisnas
chrisnas deleted the chrisnas/stable_config branch September 23, 2025 14:01
@github-actions github-actions Bot added this to the vNext-v3 milestone Sep 23, 2025
bouwkast added a commit that referenced this pull request Sep 23, 2025
## Summary of changes

Skip failing TraceAnnotationsTests in .NET 6.0

## Reason for change

Started failing after
#7287

## Implementation details

Just a dumb Skip.If to skip for the time if we are in .NET 6.0

## 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.

MergeQueue is NOT enabled in this repository. If you have write access
to the repo, the PR has 1-2 approvals (see above), and all of the
required checks have passed, you can use the Squash and Merge button to
merge the PR. If you don't have write access, or you need help, reach
out in the #apm-dotnet channel in Slack.
-->
bouwkast added a commit that referenced this pull request Sep 23, 2025
## Summary of changes

Skip failing TraceAnnotationsTests in .NET 6.0

## Reason for change

Started failing after
#7287

## Implementation details

Just a dumb Skip.If to skip for the time if we are in .NET 6.0

## Test coverage

~~I missed this one in
#7551 😢~~

I did the wrong one in
#7551 after looking at
the logs again

## 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.

MergeQueue is NOT enabled in this repository. If you have write access
to the repo, the PR has 1-2 approvals (see above), and all of the
required checks have passed, you can use the Squash and Merge button to
merge the PR. If you don't have write access, or you need help, reach
out in the #apm-dotnet channel in Slack.
-->
andrewlock added a commit that referenced this pull request Sep 24, 2025
## Summary of changes

Fixes flakiness in the `TraceAnnotation` tests

## Reason for change

#7287 incidentally
introduced flakiness in the test when the profiler is not available
(i.e. only on Windows). We temporarily disabled the test in #7551 and
#7552. This reinstates the test, and removes the flake.

## Implementation details

The important thing is that we do a "real" instrumentation in the app,
to insure that we send instrumentation telemetry. Without this, there's
a race condition between us instrumenting our "own" `HttpClient` usages
and the app ending.

In more detail, we see this flake because:

- The integration telemetry is only sent when something is instrumented
(or subsequently errors)
- The delay in profiling introduced in #7287 causes a delay in sending
the calltarget definitions
  - We will address that delay in a separate PR
- The telemetry thread runs in the background, and is already started
before we P/Invoke into the profiler
- The delay causes us to not instrument the HttpClient calls that the
background telemetry thread makes initially - if we skip the P/Invoke,
then they are instrumented at this point
- The app shuts down, which causes another telemetry flush
- At this point the `HttpClient` calls are instrumented, and the
instrumentation details are collected, but now we're shutting down, so
this data is never sent.

By forcing an instrumentation in the app, we bypass the race condition
entirely.

## Test coverage

Excluded the span from the tests so it's effectively the same. We don't
care about the contents of that span (or whether the request passes or
fails) - we just want to make sure we have instrumentation.

## Other details
andrewlock added a commit that referenced this pull request Sep 24, 2025
… env var (#7555)

## Summary of changes

Update profiler availability helper algorithm on Windows

## Reason for change

- If the Continuous Profiler isn't available, the native loader does not
rewrite P/Invokes and does not set
`DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH`
- If it is available, the native loader sets the
`DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH` value
- Currently, the `ProfilerAvailabilityHelper` is treating the presence
of the variable as indication the profiler is available, but it's not
treating the _absence_ as an indication the profiler is _not_ available.
- This PR changes that to treat the
`DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH` variable as the deciding
factor on Windows

(Note that his variable is _not_ available today on non-Windows as it
doesn't propagate from the native side. We hope to fix that in the
future, but in the mean time we must rely on heuristics).

## Implementation details

Update the logic of the helper on Windows to only rely on the
`DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH` variable.

Note that I also removed the AAS Extension check, as that only runs on
Windows anyway, so would never return `true` (as it's caught in the
`IsWindows()` branch).

## Test coverage

Updated the unit tests with new behaviour. Basically we need to skip
more tests on Windows, as it's only governed by that flag

## Other details

Related to the following:
- #7554
- #7287
- #7552
andrewlock added a commit that referenced this pull request Sep 25, 2025
## Summary of changes

Updates the rules around `ProfilerSettings` enablement

## Reason for change

After #7287, we decide whether the profiler is enabled in managed code,
instead of on the native side. However, we got some of the rules wrong.
Specifically, we believed that the profiler should behave different when
`DD_INJECTION_ENABLED` was set, but that's not the case. The profiler
should behave the same in all cases.

## Implementation details

Fixed the implementation to ignore the SSI variable, and updated the
corresponding unit tests

## Test coverage

Updated the tests that were affected

## Other details

The incorrect behaviour was actually introduced in #7303, but it didn't
have a visible impact until #7287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:profiler Issues related to the continous-profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants