Skip to content

[Profiler/Tracer] Bump to libdatadog v24.0.2#7560

Merged
gleocadie merged 17 commits intomasterfrom
gleocadie/bump-to-libdatadog-21
Dec 17, 2025
Merged

[Profiler/Tracer] Bump to libdatadog v24.0.2#7560
gleocadie merged 17 commits intomasterfrom
gleocadie/bump-to-libdatadog-21

Conversation

@gleocadie
Copy link
Collaborator

@gleocadie gleocadie commented Sep 25, 2025

Summary of changes

Bump to libdatadog v24.0.2.

Reason for change

This version provides fixes for crashtracker and new features for config.

Implementation details

Update vcpkg and cmake files.

Test coverage

Other details

https://datadoghq.atlassian.net/browse/PROF-12961

And wait for this PR to be merged first.

@github-actions github-actions bot added the area:profiler Issues related to the continous-profiler label Sep 25, 2025
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Sep 25, 2025

⚠️ Tests

⚠️ Warnings

❄️ 1 New flaky test detected

SubmitsTraces from Datadog.Trace.ClrProfiler.IntegrationTests.WcfTests (Datadog) (Fix with Cursor)

      Resource: BeginSrAsyncAdd,.0:00000/WcfSample/123,123/CalculatorService,NewWcfInstrumentation=False_enableWcfObfuscation=True.verified.txt

🧪 1 Test failed

StableConfigWhenProfilingEnabled from Datadog.Profiler.IntegrationTests.SingleStepInstrumentation.SingleStepInstrumentationTest (Datadog) (Fix with Cursor)
Exit code of "Samples.BuggyBits" should be 0 instead of 134 (= 0x86)
Expected: True
Actual:   False
This comment will be updated automatically if new data arrives.
* Fix with Cursor requires Datadog plugin ≥v2.17.0
🔗 Commit SHA: c720f8d | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@dd-trace-dotnet-ci-bot
Copy link

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

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7560) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration75.58 ± (75.76 - 76.62) ms75.13 ± (74.78 - 75.41) ms-0.6%
.NET Framework 4.8 - Bailout
duration79.92 ± (79.53 - 80.31) ms79.99 ± (79.87 - 80.57) ms+0.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1073.78 ± (1075.24 - 1084.42) ms1077.49 ± (1074.98 - 1082.79) ms+0.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.85 ± (22.78 - 22.92) ms22.84 ± (22.78 - 22.91) ms-0.0%
process.time_to_main_ms87.18 ± (86.82 - 87.53) ms86.60 ± (86.24 - 86.96) ms-0.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.92 - 10.93) MB10.90 ± (10.90 - 10.91) MB-0.2%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.96 ± (22.88 - 23.03) ms23.09 ± (23.02 - 23.16) ms+0.6%✅⬆️
process.time_to_main_ms88.80 ± (88.41 - 89.18) ms89.17 ± (88.85 - 89.50) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.97 ± (10.97 - 10.97) MB10.95 ± (10.95 - 10.95) MB-0.2%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms222.84 ± (221.35 - 224.33) ms222.36 ± (220.61 - 224.11) ms-0.2%
process.time_to_main_ms505.14 ± (503.92 - 506.35) ms505.25 ± (504.02 - 506.49) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.97 ± (47.94 - 47.99) MB48.08 ± (48.06 - 48.10) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 6 - Baseline
process.internal_duration_ms21.62 ± (21.56 - 21.68) ms21.66 ± (21.61 - 21.71) ms+0.2%✅⬆️
process.time_to_main_ms76.05 ± (75.70 - 76.41) ms75.53 ± (75.21 - 75.86) ms-0.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.62) MB10.65 ± (10.65 - 10.65) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.43 ± (21.38 - 21.48) ms21.57 ± (21.51 - 21.62) ms+0.6%✅⬆️
process.time_to_main_ms76.24 ± (75.94 - 76.54) ms76.64 ± (76.34 - 76.95) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.66 ± (10.65 - 10.66) MB10.68 ± (10.68 - 10.69) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms211.84 ± (210.55 - 213.14) ms210.61 ± (209.41 - 211.82) ms-0.6%
process.time_to_main_ms467.65 ± (466.70 - 468.60) ms464.48 ± (463.57 - 465.39) ms-0.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.48 ± (48.45 - 48.51) MB48.55 ± (48.53 - 48.57) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.68 ± (19.62 - 19.73) ms19.69 ± (19.63 - 19.75) ms+0.1%✅⬆️
process.time_to_main_ms74.64 ± (74.36 - 74.93) ms75.23 ± (74.85 - 75.62) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.67) MB7.66 ± (7.65 - 7.66) MB-0.2%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.88 ± (19.81 - 19.95) ms19.63 ± (19.58 - 19.69) ms-1.3%
process.time_to_main_ms76.14 ± (75.86 - 76.42) ms75.20 ± (74.88 - 75.51) ms-1.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.73 ± (7.72 - 7.74) MB7.73 ± (7.72 - 7.74) MB-0.0%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms191.96 ± (191.04 - 192.87) ms189.54 ± (188.67 - 190.41) ms-1.3%
process.time_to_main_ms450.87 ± (449.92 - 451.81) ms449.95 ± (449.03 - 450.87) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.48 ± (36.43 - 36.53) MB36.47 ± (36.43 - 36.50) MB-0.0%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration191.53 ± (191.80 - 192.61) ms191.30 ± (191.23 - 192.01) ms-0.1%
.NET Framework 4.8 - Bailout
duration194.64 ± (194.43 - 195.04) ms195.55 ± (195.33 - 195.98) ms+0.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1106.48 ± (1112.93 - 1122.52) ms1108.42 ± (1114.52 - 1124.26) ms+0.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms185.88 ± (185.56 - 186.20) ms186.61 ± (186.16 - 187.07) ms+0.4%✅⬆️
process.time_to_main_ms79.83 ± (79.65 - 80.01) ms80.29 ± (80.08 - 80.50) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.09 ± (16.06 - 16.12) MB16.05 ± (16.03 - 16.08) MB-0.3%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.8%
.NET Core 3.1 - Bailout
process.internal_duration_ms185.54 ± (185.25 - 185.82) ms185.58 ± (185.38 - 185.78) ms+0.0%✅⬆️
process.time_to_main_ms81.01 ± (80.89 - 81.13) ms81.20 ± (81.08 - 81.32) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.17 ± (16.14 - 16.20) MB16.13 ± (16.11 - 16.16) MB-0.2%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (20 - 21)-0.6%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms394.05 ± (391.50 - 396.59) ms394.63 ± (392.22 - 397.05) ms+0.1%✅⬆️
process.time_to_main_ms471.99 ± (471.34 - 472.64) ms474.05 ± (473.35 - 474.76) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.34 ± (58.18 - 58.49) MB58.40 ± (58.24 - 58.56) MB+0.1%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 6 - Baseline
process.internal_duration_ms190.38 ± (189.97 - 190.78) ms190.51 ± (190.24 - 190.77) ms+0.1%✅⬆️
process.time_to_main_ms69.59 ± (69.37 - 69.81) ms69.51 ± (69.34 - 69.68) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.98 ± (15.82 - 16.13) MB16.11 ± (15.97 - 16.26) MB+0.8%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.0%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms188.97 ± (188.72 - 189.21) ms189.93 ± (189.60 - 190.25) ms+0.5%✅⬆️
process.time_to_main_ms69.89 ± (69.81 - 69.98) ms70.29 ± (70.20 - 70.38) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.75 ± (15.58 - 15.93) MB15.81 ± (15.64 - 15.99) MB+0.4%✅⬆️
runtime.dotnet.threads.count19 ± (18 - 19)19 ± (19 - 19)+1.1%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms411.70 ± (409.24 - 414.16) ms407.03 ± (404.68 - 409.38) ms-1.1%
process.time_to_main_ms441.49 ± (440.78 - 442.20) ms441.36 ± (440.80 - 441.93) ms-0.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.95 ± (58.80 - 59.09) MB58.70 ± (58.55 - 58.85) MB-0.4%
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (30 - 30)+0.4%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms187.83 ± (187.52 - 188.15) ms188.92 ± (188.48 - 189.35) ms+0.6%✅⬆️
process.time_to_main_ms68.41 ± (68.23 - 68.59) ms68.93 ± (68.77 - 69.10) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.80 ± (11.77 - 11.83) MB11.81 ± (11.78 - 11.85) MB+0.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.2%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms187.27 ± (186.95 - 187.59) ms188.04 ± (187.74 - 188.33) ms+0.4%✅⬆️
process.time_to_main_ms69.71 ± (69.59 - 69.82) ms70.11 ± (69.96 - 70.26) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.80 ± (11.74 - 11.85) MB11.80 ± (11.73 - 11.88) MB+0.0%✅⬆️
runtime.dotnet.threads.count19 ± (18 - 19)19 ± (19 - 19)+1.5%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms363.53 ± (361.91 - 365.16) ms361.76 ± (360.19 - 363.32) ms-0.5%
process.time_to_main_ms423.98 ± (423.50 - 424.46) ms425.31 ± (424.73 - 425.89) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.95 ± (47.91 - 47.99) MB47.97 ± (47.94 - 47.99) MB+0.0%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.1%✅⬆️
Comparison explanation

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 highlighted 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).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (75ms)  : 70, 80
    master - mean (76ms)  : 70, 83

    section Bailout
    This PR (7560) - mean (80ms)  : 75, 85
    master - mean (80ms)  : 74, 86

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (1,079ms)  : 1024, 1134
    master - mean (1,080ms)  : 1014, 1146

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (117ms)  : 110, 123
    master - mean (117ms)  : 110, 124

    section Bailout
    This PR (7560) - mean (120ms)  : 113, 126
    master - mean (119ms)  : 110, 127

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (767ms)  : 716, 818
    master - mean (767ms)  : 727, 806

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (104ms)  : 98, 110
    master - mean (105ms)  : 98, 111

    section Bailout
    This PR (7560) - mean (105ms)  : 99, 112
    master - mean (104ms)  : 98, 111

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (704ms)  : 675, 733
    master - mean (708ms)  : 677, 739

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (103ms)  : 97, 110
    master - mean (103ms)  : 98, 108

    section Bailout
    This PR (7560) - mean (104ms)  : 95, 112
    master - mean (104ms)  : 99, 110

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (670ms)  : 645, 695
    master - mean (679ms)  : 648, 709

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (192ms)  : 188, 196
    master - mean (192ms)  : 187, 197

    section Bailout
    This PR (7560) - mean (196ms)  : 192, 199
    master - mean (195ms)  : 192, 198

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (1,119ms)  : 1045, 1194
    master - mean (1,118ms)  : 1046, 1190

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (275ms)  : 270, 281
    master - mean (274ms)  : 269, 279

    section Bailout
    This PR (7560) - mean (275ms)  : 272, 277
    master - mean (274ms)  : 271, 277

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (905ms)  : 850, 960
    master - mean (897ms)  : 850, 945

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (268ms)  : 264, 272
    master - mean (268ms)  : 262, 275

    section Bailout
    This PR (7560) - mean (268ms)  : 265, 272
    master - mean (266ms)  : 263, 270

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (881ms)  : 835, 926
    master - mean (883ms)  : 844, 923

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7560) - mean (267ms)  : 260, 274
    master - mean (266ms)  : 260, 272

    section Bailout
    This PR (7560) - mean (267ms)  : 264, 271
    master - mean (266ms)  : 262, 270

    section CallTarget+Inlining+NGEN
    This PR (7560) - mean (818ms)  : 800, 836
    master - mean (818ms)  : 798, 838

Loading

@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch 2 times, most recently from 0e74d35 to e7e8a6c Compare October 2, 2025 07:50
@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch from e7e8a6c to cd0cf78 Compare October 3, 2025 07:38
@dmehala
Copy link
Contributor

dmehala commented Oct 3, 2025

Hey @gleocadie
libdatadog v22.0.0 introduces a breaking change in the process discovery FFI. In case you are facing a compilation issue regarding this API, I have a draft that should solve this issue: #7607

Please let me know if I can help.

@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch 2 times, most recently from cadf784 to 74a70a6 Compare October 6, 2025 08:53
@gleocadie
Copy link
Collaborator Author

Hey @gleocadie libdatadog v22.0.0 introduces a breaking change in the process discovery FFI. In case you are facing a compilation issue regarding this API, I have a draft that should solve this issue: #7607

Please let me know if I can help.

Hey, sorry I missed your message @dmehala
I'll use your fixes in my PR and see how it goes
Thanks

@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch 7 times, most recently from 2a06b13 to cca2898 Compare October 6, 2025 12:36
@pr-commenter
Copy link

pr-commenter bot commented Oct 17, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7560 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.348
  • 1 benchmarks have fewer allocations
  • 1 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 11.2μs 58.2ns 267ns 0 0 0 5.5 KB
master StartStopWithChild netcoreapp3.1 13.7μs 73.2ns 401ns 0 0 0 5.71 KB
master StartStopWithChild net472 21.8μs 111ns 495ns 0.968 0.323 0.108 5.93 KB
#7560 StartStopWithChild net6.0 11.2μs 59.7ns 333ns 0 0 0 5.49 KB
#7560 StartStopWithChild netcoreapp3.1 14μs 69.4ns 303ns 0 0 0 5.7 KB
#7560 StartStopWithChild net472 22.9μs 122ns 633ns 0.882 0.22 0 5.96 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7560

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.26 KB 3.39 KB 128 B 3.92%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 1.29ms 1.8μs 6.99μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.38ms 203ns 759ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.7ms 222ns 858ns 0 0 0 3.26 KB
#7560 WriteAndFlushEnrichedTraces net6.0 1.25ms 505ns 1.89μs 0 0 0 2.7 KB
#7560 WriteAndFlushEnrichedTraces netcoreapp3.1 1.37ms 97.7ns 378ns 0 0 0 2.7 KB
#7560 WriteAndFlushEnrichedTraces net472 1.69ms 401ns 1.45μs 0 0 0 3.39 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 1.1μs 6.16ns 40.4ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.45μs 7.03ns 29ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.01μs 2.37ns 9.17ns 0.192 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.55μs 37.1ns 170ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 8.87μs 41.8ns 167ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.63μs 2.82ns 10.9ns 0.723 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 342ns 1.73ns 8.67ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 402ns 1.9ns 7.82ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 301ns 0.0159ns 0.0615ns 0.044 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.46μs 1.75ns 6.32ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.84μs 36.6ns 142ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.7μs 1.37ns 5.11ns 0.572 0 0 3.8 KB
#7560 AllCycleSimpleBody net6.0 1.1μs 6.27ns 46.5ns 0 0 0 1.22 KB
#7560 AllCycleSimpleBody netcoreapp3.1 1.42μs 1.37ns 5.29ns 0 0 0 1.2 KB
#7560 AllCycleSimpleBody net472 1.01μs 0.314ns 1.22ns 0.191 0 0 1.23 KB
#7560 AllCycleMoreComplexBody net6.0 7.35μs 37.4ns 171ns 0 0 0 4.72 KB
#7560 AllCycleMoreComplexBody netcoreapp3.1 9.06μs 43.5ns 179ns 0 0 0 4.62 KB
#7560 AllCycleMoreComplexBody net472 7.69μs 2.82ns 10.9ns 0.728 0 0 4.74 KB
#7560 ObjectExtractorSimpleBody net6.0 328ns 1.66ns 7.24ns 0 0 0 280 B
#7560 ObjectExtractorSimpleBody netcoreapp3.1 396ns 2.2ns 14.1ns 0 0 0 272 B
#7560 ObjectExtractorSimpleBody net472 313ns 0.134ns 0.519ns 0.044 0 0 281 B
#7560 ObjectExtractorMoreComplexBody net6.0 6.39μs 34.4ns 188ns 0 0 0 3.78 KB
#7560 ObjectExtractorMoreComplexBody netcoreapp3.1 7.69μs 38.4ns 163ns 0 0 0 3.69 KB
#7560 ObjectExtractorMoreComplexBody net472 6.78μs 5.18ns 20.1ns 0.577 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.6μs 222ns 829ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.1μs 128ns 496ns 0 0 0 32.4 KB
master EncodeArgs net472 108μs 9.2ns 34.4ns 4.89 0 0 32.5 KB
master EncodeLegacyArgs net6.0 149μs 12.9ns 50ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 200μs 55.2ns 199ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 39.3ns 152ns 0 0 0 2.14 KB
#7560 EncodeArgs net6.0 76μs 225ns 871ns 0 0 0 32.4 KB
#7560 EncodeArgs netcoreapp3.1 97.8μs 194ns 753ns 0 0 0 32.4 KB
#7560 EncodeArgs net472 109μs 15.4ns 59.8ns 4.92 0 0 32.5 KB
#7560 EncodeLegacyArgs net6.0 146μs 37.8ns 142ns 0 0 0 2.14 KB
#7560 EncodeLegacyArgs netcoreapp3.1 200μs 48.4ns 175ns 0 0 0 2.14 KB
#7560 EncodeLegacyArgs net472 263μs 17.9ns 69.3ns 0 0 0 2.14 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 415μs 898ns 3.24μs 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 464μs 4.46μs 43μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 486μs 436ns 1.63μs 0 0 0 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 317μs 1.53μs 6.1μs 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 349μs 3.16μs 29.8μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 363μs 225ns 813ns 0 0 0 0 b
#7560 RunWafRealisticBenchmark net6.0 420μs 1.09μs 3.94μs 0 0 0 4.55 KB
#7560 RunWafRealisticBenchmark netcoreapp3.1 449μs 2.66μs 25.3μs 0 0 0 4.48 KB
#7560 RunWafRealisticBenchmark net472 492μs 587ns 2.27μs 0 0 0 0 b
#7560 RunWafRealisticBenchmarkWithAttack net6.0 315μs 1.21μs 4.52μs 0 0 0 2.24 KB
#7560 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 323μs 1.37μs 4.74μs 0 0 0 2.22 KB
#7560 RunWafRealisticBenchmarkWithAttack net472 361μs 542ns 1.95μs 0 0 0 0 b
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 85.4μs 255ns 918ns 0 0 0 18.98 KB
master SendRequest netcoreapp3.1 96.2μs 242ns 1.28μs 0 0 0 21.18 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#7560 SendRequest net6.0 84.4μs 75ns 281ns 0 0 0 18.97 KB
#7560 SendRequest netcoreapp3.1 97.4μs 330ns 2.24μs 0 0 0 21.18 KB
#7560 SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7560

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 1.588 2,836,200.00 1,785,750.00
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 1.143 1,163,750.00 1,017,900.00

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 2ms 543ns 2.03μs 0 0 0 640 KB
master OriginalCharSlice netcoreapp3.1 3.87ms 813ns 3.15μs 0 0 0 640.05 KB
master OriginalCharSlice net472 2.61ms 945ns 3.66μs 0 0 0 638.98 KB
master OptimizedCharSlice net6.0 1.51ms 1.01μs 3.93μs 0 0 0 0 b
master OptimizedCharSlice netcoreapp3.1 2.84ms 447ns 1.61μs 0 0 0 0 b
master OptimizedCharSlice net472 2.03ms 439ns 1.64μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 1.16ms 486ns 1.82μs 0 0 0 0 b
master OptimizedCharSliceWithPool netcoreapp3.1 1.89ms 1.85μs 7.16μs 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.14ms 497ns 1.92μs 0 0 0 0 b
#7560 OriginalCharSlice net6.0 1.91ms 514ns 1.85μs 0 0 0 640 KB
#7560 OriginalCharSlice netcoreapp3.1 3.92ms 2.1μs 8.12μs 0 0 0 640.05 KB
#7560 OriginalCharSlice net472 2.67ms 1.14μs 4.42μs 0 0 0 638.98 KB
#7560 OptimizedCharSlice net6.0 1.46ms 814ns 2.94μs 0 0 0 0 b
#7560 OptimizedCharSlice netcoreapp3.1 1.79ms 2.31μs 15.1μs 0 0 0 0 b
#7560 OptimizedCharSlice net472 1.91ms 564ns 2.11μs 0 0 0 0 b
#7560 OptimizedCharSliceWithPool net6.0 1.02ms 656ns 2.54μs 0 0 0 0 b
#7560 OptimizedCharSliceWithPool netcoreapp3.1 1.88ms 1.51μs 5.86μs 0 0 0 0 b
#7560 OptimizedCharSliceWithPool net472 1.13ms 803ns 3.11μs 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 694μs 3.76μs 21.6μs 0 0 0 41.86 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 704μs 4.1μs 37.1μs 0 0 0 41.86 KB
master WriteAndFlushEnrichedTraces net472 894μs 2.92μs 11.3μs 8.33 4.17 0 56.39 KB
#7560 WriteAndFlushEnrichedTraces net6.0 682μs 1.25μs 4.85μs 0 0 0 41.74 KB
#7560 WriteAndFlushEnrichedTraces netcoreapp3.1 721μs 3.41μs 14.5μs 0 0 0 41.83 KB
#7560 WriteAndFlushEnrichedTraces net472 878μs 4.08μs 15.8μs 7.81 3.91 0 56.35 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.86μs 8.83ns 36.4ns 0 0 0 968 B
master ExecuteNonQuery netcoreapp3.1 2.56μs 5.33ns 20.7ns 0 0 0 960 B
master ExecuteNonQuery net472 2.75μs 1.1ns 4.12ns 0.138 0 0 931 B
#7560 ExecuteNonQuery net6.0 1.91μs 9.23ns 35.7ns 0 0 0 968 B
#7560 ExecuteNonQuery netcoreapp3.1 2.42μs 11.5ns 44.6ns 0 0 0 960 B
#7560 ExecuteNonQuery net472 2.66μs 2.54ns 9.85ns 0.147 0 0 931 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.73μs 1.59ns 6.14ns 0 0 0 952 B
master CallElasticsearch netcoreapp3.1 2.19μs 8.48ns 32.8ns 0 0 0 968 B
master CallElasticsearch net472 3.57μs 5.11ns 18.4ns 0.143 0 0 955 B
master CallElasticsearchAsync net6.0 1.72μs 3.41ns 13.2ns 0 0 0 928 B
master CallElasticsearchAsync netcoreapp3.1 2.33μs 9.71ns 37.6ns 0 0 0 1.02 KB
master CallElasticsearchAsync net472 3.52μs 4.21ns 16.3ns 0.159 0 0 1.01 KB
#7560 CallElasticsearch net6.0 1.74μs 6.38ns 24.7ns 0 0 0 952 B
#7560 CallElasticsearch netcoreapp3.1 2.14μs 9.04ns 35ns 0 0 0 968 B
#7560 CallElasticsearch net472 3.58μs 3.33ns 12.4ns 0.142 0 0 955 B
#7560 CallElasticsearchAsync net6.0 1.74μs 5.38ns 20.8ns 0 0 0 928 B
#7560 CallElasticsearchAsync netcoreapp3.1 2.32μs 7.05ns 27.3ns 0 0 0 1.02 KB
#7560 CallElasticsearchAsync net472 3.48μs 8.59ns 33.3ns 0.155 0 0 1.01 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.78μs 8.37ns 33.5ns 0 0 0 896 B
master ExecuteAsync netcoreapp3.1 2.35μs 6.18ns 23.9ns 0 0 0 896 B
master ExecuteAsync net472 2.63μs 2.71ns 10.1ns 0.131 0 0 859 B
#7560 ExecuteAsync net6.0 1.94μs 6.65ns 25.8ns 0 0 0 896 B
#7560 ExecuteAsync netcoreapp3.1 2.49μs 8.3ns 32.1ns 0 0 0 896 B
#7560 ExecuteAsync net472 2.56μs 2.07ns 8.03ns 0.126 0 0 859 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.87μs 14.3ns 53.6ns 0 0 0 2.29 KB
master SendAsync netcoreapp3.1 8.55μs 10.7ns 40ns 0 0 0 2.83 KB
master SendAsync net472 12μs 9.51ns 36.8ns 0.479 0 0 3.08 KB
#7560 SendAsync net6.0 6.71μs 9.25ns 34.6ns 0 0 0 2.29 KB
#7560 SendAsync netcoreapp3.1 8.35μs 25.6ns 99.2ns 0 0 0 2.83 KB
#7560 SendAsync net472 12μs 10ns 38.7ns 0.48 0 0 3.08 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7560

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 278.53 KB 270.34 KB -8.19 KB -2.94%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 41.8μs 155ns 558ns 0 0 0 42.51 KB
master StringConcatBenchmark netcoreapp3.1 50.5μs 319ns 3.04μs 0 0 0 42.54 KB
master StringConcatBenchmark net472 57.2μs 140ns 506ns 0 0 0 49.15 KB
master StringConcatAspectBenchmark net6.0 484μs 2.02μs 9.49μs 0 0 0 274.95 KB
master StringConcatAspectBenchmark netcoreapp3.1 512μs 2.6μs 14.7μs 0 0 0 256.76 KB
master StringConcatAspectBenchmark net472 402μs 2.08μs 10.6μs 0 0 0 278.53 KB
#7560 StringConcatBenchmark net6.0 42.3μs 211ns 896ns 0 0 0 42.51 KB
#7560 StringConcatBenchmark netcoreapp3.1 47.9μs 230ns 890ns 0 0 0 42.54 KB
#7560 StringConcatBenchmark net472 57μs 225ns 840ns 0 0 0 49.15 KB
#7560 StringConcatAspectBenchmark net6.0 483μs 2.46μs 10.7μs 0 0 0 275 KB
#7560 StringConcatAspectBenchmark netcoreapp3.1 496μs 1.33μs 5.33μs 0 0 0 255.62 KB
#7560 StringConcatAspectBenchmark net472 403μs 2.13μs 11.5μs 0 0 0 270.34 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.67μs 12.2ns 48.8ns 0 0 0 1.69 KB
master EnrichedLog netcoreapp3.1 3.56μs 18ns 80.4ns 0 0 0 1.7 KB
master EnrichedLog net472 3.9μs 3.28ns 12.7ns 0.252 0 0 1.6 KB
#7560 EnrichedLog net6.0 2.72μs 9.28ns 36ns 0 0 0 1.69 KB
#7560 EnrichedLog netcoreapp3.1 3.51μs 16.6ns 66.5ns 0 0 0 1.7 KB
#7560 EnrichedLog net472 3.82μs 4.67ns 18.1ns 0.248 0 0 1.6 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 35.7ns 133ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 128μs 27.2ns 98.1ns 0 0 0 4.31 KB
master EnrichedLog net472 181μs 31.6ns 118ns 0 0 0 4.51 KB
#7560 EnrichedLog net6.0 122μs 68.2ns 236ns 0 0 0 4.31 KB
#7560 EnrichedLog netcoreapp3.1 127μs 36.5ns 136ns 0 0 0 4.31 KB
#7560 EnrichedLog net472 166μs 34.4ns 133ns 0 0 0 4.51 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 5.07μs 7.05ns 27.3ns 0 0 0 2.24 KB
master EnrichedLog netcoreapp3.1 6.7μs 22.7ns 82ns 0 0 0 2.26 KB
master EnrichedLog net472 7.54μs 6.47ns 25.1ns 0.301 0 0 2.05 KB
#7560 EnrichedLog net6.0 5.1μs 14.6ns 56.5ns 0 0 0 2.24 KB
#7560 EnrichedLog netcoreapp3.1 6.8μs 21.6ns 83.8ns 0 0 0 2.26 KB
#7560 EnrichedLog net472 7.63μs 8.08ns 31.3ns 0.305 0 0 2.05 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.95μs 0.807ns 3.02ns 0 0 0 1.12 KB
master SendReceive netcoreapp3.1 2.55μs 12.5ns 56ns 0 0 0 1.14 KB
master SendReceive net472 2.96μs 5.83ns 22.6ns 0.177 0 0 1.12 KB
#7560 SendReceive net6.0 1.94μs 2.22ns 8.6ns 0 0 0 1.12 KB
#7560 SendReceive netcoreapp3.1 2.55μs 12ns 46.4ns 0 0 0 1.14 KB
#7560 SendReceive net472 3.04μs 6.47ns 25.1ns 0.167 0 0 1.12 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.52μs 15.1ns 56.3ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.86μs 11.8ns 45.6ns 0 0 0 1.63 KB
master EnrichedLog net472 6.68μs 7.41ns 28.7ns 0.301 0 0 2.03 KB
#7560 EnrichedLog net6.0 4.43μs 4.35ns 15.7ns 0 0 0 1.58 KB
#7560 EnrichedLog netcoreapp3.1 5.81μs 24.3ns 94.1ns 0 0 0 1.63 KB
#7560 EnrichedLog net472 6.71μs 7.62ns 29.5ns 0.302 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 746ns 4ns 17.4ns 0 0 0 520 B
master StartFinishSpan netcoreapp3.1 949ns 3.07ns 11.5ns 0 0 0 520 B
master StartFinishSpan net472 886ns 0.0461ns 0.172ns 0.08 0 0 522 B
master StartFinishScope net6.0 911ns 4.44ns 18.3ns 0 0 0 640 B
master StartFinishScope netcoreapp3.1 1.12μs 5.58ns 25.6ns 0 0 0 640 B
master StartFinishScope net472 1.07μs 2.74ns 10.6ns 0.0906 0 0 602 B
master StartFinishTwoScopes net6.0 1.81μs 0.818ns 3.06ns 0 0 0 1.19 KB
master StartFinishTwoScopes netcoreapp3.1 2.17μs 9.89ns 38.3ns 0 0 0 1.19 KB
master StartFinishTwoScopes net472 2.11μs 0.976ns 3.78ns 0.169 0 0 1.08 KB
#7560 StartFinishSpan net6.0 762ns 3.21ns 15.4ns 0 0 0 520 B
#7560 StartFinishSpan netcoreapp3.1 958ns 0.395ns 1.53ns 0 0 0 520 B
#7560 StartFinishSpan net472 898ns 0.0854ns 0.32ns 0.081 0 0 522 B
#7560 StartFinishScope net6.0 893ns 0.889ns 3.33ns 0 0 0 640 B
#7560 StartFinishScope netcoreapp3.1 1.11μs 5.72ns 28.6ns 0 0 0 640 B
#7560 StartFinishScope net472 1.08μs 0.0707ns 0.255ns 0.0923 0 0 602 B
#7560 StartFinishTwoScopes net6.0 1.75μs 0.739ns 2.66ns 0 0 0 1.19 KB
#7560 StartFinishTwoScopes netcoreapp3.1 2.21μs 9.85ns 38.1ns 0 0 0 1.19 KB
#7560 StartFinishTwoScopes net472 2.19μs 1.26ns 4.72ns 0.164 0 0 1.08 KB
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.08μs 5.36ns 22.7ns 0 0 0 640 B
master RunOnMethodBegin netcoreapp3.1 1.34μs 4.76ns 18.4ns 0 0 0 640 B
master RunOnMethodBegin net472 1.42μs 0.826ns 2.98ns 0.0923 0 0 602 B
#7560 RunOnMethodBegin net6.0 1.03μs 6.1ns 30.5ns 0 0 0 640 B
#7560 RunOnMethodBegin netcoreapp3.1 1.34μs 6.68ns 29.1ns 0 0 0 640 B
#7560 RunOnMethodBegin net472 1.43μs 1.46ns 5.65ns 0.0933 0 0 602 B

try
{
Length = (nuint)encoding.GetBytes(strPtr, str.Length, (byte*)Ptr, maxBytesCount);
*((byte*)Ptr + Length) = 0; // Add null terminator

Check failure

Code scanning / CodeQL

Unvalidated local pointer arithmetic

Unvalidated pointer arithmetic from virtual method [GetBytes](1).

Copilot Autofix

AI 4 months ago

To fix this problem, the result from the virtual method call (encoding.GetBytes) must be validated to ensure it is both non-negative and does not exceed the allocated buffer size (maxBytesCount), before using it in pointer arithmetic or memory access operations. In this instance, we should check that Length >= 0 && Length <= (nuint)maxBytesCount before writing the null terminator at *((byte*)Ptr + Length). If the value is outside this range, we should fail by freeing the allocation and setting Ptr and Length appropriately so the struct is left in a valid state and does not attempt an out-of-bounds write. All code changes need to be inside the CString(string? str) constructor in tracer/src/Datadog.Trace/LibDatadog/CString.cs.


Suggested changeset 1
tracer/src/Datadog.Trace/LibDatadog/CString.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tracer/src/Datadog.Trace/LibDatadog/CString.cs b/tracer/src/Datadog.Trace/LibDatadog/CString.cs
--- a/tracer/src/Datadog.Trace/LibDatadog/CString.cs
+++ b/tracer/src/Datadog.Trace/LibDatadog/CString.cs
@@ -36,7 +36,17 @@
                     try
                     {
                         Length = (nuint)encoding.GetBytes(strPtr, str.Length, (byte*)Ptr, maxBytesCount);
-                        *((byte*)Ptr + Length) = 0; // Add null terminator
+                        if (Length > (nuint)maxBytesCount)
+                        {
+                            // Prevent out-of-bounds write (should never happen with correct/built-in encoding)
+                            Marshal.FreeHGlobal(Ptr);
+                            Ptr = IntPtr.Zero;
+                            Length = UIntPtr.Zero;
+                        }
+                        else
+                        {
+                            *((byte*)Ptr + Length) = 0; // Add null terminator
+                        }
                     }
                     catch
                     {
EOF
@@ -36,7 +36,17 @@
try
{
Length = (nuint)encoding.GetBytes(strPtr, str.Length, (byte*)Ptr, maxBytesCount);
*((byte*)Ptr + Length) = 0; // Add null terminator
if (Length > (nuint)maxBytesCount)
{
// Prevent out-of-bounds write (should never happen with correct/built-in encoding)
Marshal.FreeHGlobal(Ptr);
Ptr = IntPtr.Zero;
Length = UIntPtr.Zero;
}
else
{
*((byte*)Ptr + Length) = 0; // Add null terminator
}
}
catch
{
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch from 3b52168 to 709579a Compare November 5, 2025 13:21
@gleocadie gleocadie changed the title [Profiler/Tracer] Bump to libdatadog v21 [Profiler/Tracer] Bump to libdatadog v23 Nov 5, 2025
@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch 2 times, most recently from c7e8436 to 4fa0ff5 Compare November 5, 2025 16:39
@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch from 7405a75 to 48c3b9d Compare November 17, 2025 14:17
@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch 3 times, most recently from 8016636 to b1fc02f Compare December 10, 2025 20:23
@gleocadie gleocadie changed the title [Profiler/Tracer] Bump to libdatadog v23 [Profiler/Tracer] Bump to libdatadog v24.0.2 Dec 11, 2025
@gleocadie gleocadie marked this pull request as ready for review December 11, 2025 08:36
@gleocadie gleocadie requested review from a team as code owners December 11, 2025 08:36
Copy link
Contributor

@chrisnas chrisnas left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 4737 to 4839
@@ -4836,7 +4836,7 @@ stages:
versionSpec: '3.12'
displayName: Install python 3.12

- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
- script: git clone -b gleocadie/disable-test-discovery-test-for-dotnet --depth 1 https://github.com/DataDog/system-tests.git
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this will be reverted once the PR in system-tests is merged

@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch from 584b781 to bde1368 Compare December 12, 2025 12:49
Copy link
Collaborator

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

Thanks LGTM, just wondering about the system test branch

displayName: Install python 3.12

- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
- script: git clone -b gleocadie/disable-test-discovery-test-for-dotnet --depth 1 https://github.com/DataDog/system-tests.git
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this merged?

@gleocadie gleocadie force-pushed the gleocadie/bump-to-libdatadog-21 branch from bde1368 to c720f8d Compare December 15, 2025 10:00
@gleocadie gleocadie merged commit ecfe0ce into master Dec 17, 2025
155 of 157 checks passed
@gleocadie gleocadie deleted the gleocadie/bump-to-libdatadog-21 branch December 17, 2025 08:37
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 17, 2025
@andrewlock andrewlock added libdatadog Updates to the libdatadog library and Rust integration and removed area:profiler Issues related to the continous-profiler labels Dec 22, 2025
andrewlock added a commit that referenced this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libdatadog Updates to the libdatadog library and Rust integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants