Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Profiler] Refactoring to better wrap libdatadog #4763

Merged
merged 11 commits into from
Nov 10, 2023

Conversation

gleocadie
Copy link
Collaborator

@gleocadie gleocadie commented Oct 25, 2023

Summary of changes

Rewrite the wrapping around Libdatadog to ease migration, time to compile and testing.

Reason for change

The ProfileExporter class (former LibddprofExporter was containing every things related to libdatadog and exposing its internals.
When it comes to migrate to a breaking change version of libdatadog, since there was no wrapping, things got messy and difficult to reason about (new internals, new pseudo-wrapping classes...) and this impacted my mood and the compile-time (my mood being more important 😆 )

Libdatadog API is not object oriented and a better wrapping/encapsulation will be beneficial to read the code too.

Implementation details

  • Create public classes (ex: Profile, Tags, Exporter...) in the libdatadog namespace and they will be used by the ProfileExporter
  • Create internal/detail implementation (ex: ProfileImpl.hpp...) which encapsulate the libdatadog API
  • Use PIMPL to hide libdatadog internals
  • Renaming and cleanup code

Test coverage

  • Add unit tests

Other details

@github-actions github-actions bot added the area:profiler Issues related to the continous-profiler label Oct 25, 2023
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Oct 25, 2023

Datadog Report

Branch report: gleocadie/refactoring-better-wrap-libdatadog
Commit report: 1973bbd

dd-trace-dotnet: 0 Failed, 0 New Flaky, 304946 Passed, 1135 Skipped, 45m 28.4s Wall Time

@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch 2 times, most recently from c2e8f93 to 07ced96 Compare October 25, 2023 16:56
@andrewlock
Copy link
Member

andrewlock commented Oct 25, 2023

Benchmarks Report 🐌

Benchmarks for #4763 compared to master:

  • 5 benchmarks are slower, with geometric mean 1.162
  • 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 8.33μs 42ns 245ns 0.0245 0.0122 0 7.29 KB
master StartStopWithChild netcoreapp3.1 10μs 54.5ns 323ns 0.0247 0.00988 0 7.39 KB
master StartStopWithChild net472 15.6μs 67.1ns 260ns 1.28 0.326 0.0986 7.66 KB
#4763 StartStopWithChild net6.0 8.08μs 45.8ns 314ns 0.0276 0.0118 0 7.28 KB
#4763 StartStopWithChild netcoreapp3.1 10μs 51.5ns 262ns 0.0243 0.00972 0 7.39 KB
#4763 StartStopWithChild net472 15.5μs 46.4ns 180ns 1.29 0.322 0.0996 7.66 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 476μs 394ns 1.53μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 655μs 289ns 1.04μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 786μs 372ns 1.34μs 0.391 0 0 3.3 KB
#4763 WriteAndFlushEnrichedTraces net6.0 468μs 355ns 1.37μs 0 0 0 2.7 KB
#4763 WriteAndFlushEnrichedTraces netcoreapp3.1 626μs 176ns 633ns 0 0 0 2.7 KB
#4763 WriteAndFlushEnrichedTraces net472 805μs 949ns 3.67μs 0.401 0 0 3.3 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4763

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑netcoreapp3.1 1.161 179.65 208.52

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 43.2μs 21.9ns 81.8ns 0.0218 0 0 2.02 KB
master AllCycleSimpleBody netcoreapp3.1 45μs 66ns 256ns 0.0225 0 0 2 KB
master AllCycleSimpleBody net472 47.8μs 56ns 217ns 0.307 0 0 2.07 KB
master AllCycleMoreComplexBody net6.0 204μs 67.2ns 260ns 0.102 0 0 8.37 KB
master AllCycleMoreComplexBody netcoreapp3.1 208μs 63.4ns 237ns 0.104 0 0 8.26 KB
master AllCycleMoreComplexBody net472 213μs 181ns 699ns 1.27 0 0 8.43 KB
master ObjectExtractorSimpleBody net6.0 134ns 0.0527ns 0.197ns 0.00394 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 180ns 0.1ns 0.388ns 0.0037 0 0 272 B
master ObjectExtractorSimpleBody net472 155ns 0.169ns 0.656ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.78μs 1.87ns 7.01ns 0.0526 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.72μs 1.56ns 6.05ns 0.0503 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.54μs 2.28ns 8.82ns 0.602 0.00528 0 3.8 KB
#4763 AllCycleSimpleBody net6.0 43.3μs 25.8ns 96.5ns 0.0218 0 0 2.02 KB
#4763 AllCycleSimpleBody netcoreapp3.1 44.7μs 46.9ns 176ns 0.0224 0 0 2 KB
#4763 AllCycleSimpleBody net472 47.4μs 225ns 900ns 0.326 0 0 2.07 KB
#4763 AllCycleMoreComplexBody net6.0 202μs 68.1ns 255ns 0.102 0 0 8.37 KB
#4763 AllCycleMoreComplexBody netcoreapp3.1 210μs 159ns 594ns 0.104 0 0 8.26 KB
#4763 AllCycleMoreComplexBody net472 213μs 114ns 441ns 1.27 0 0 8.43 KB
#4763 ObjectExtractorSimpleBody net6.0 131ns 0.0737ns 0.276ns 0.00391 0 0 280 B
#4763 ObjectExtractorSimpleBody netcoreapp3.1 209ns 0.245ns 0.95ns 0.00377 0 0 272 B
#4763 ObjectExtractorSimpleBody net472 156ns 0.0747ns 0.279ns 0.0446 0 0 281 B
#4763 ObjectExtractorMoreComplexBody net6.0 2.82μs 1.29ns 5ns 0.0534 0 0 3.78 KB
#4763 ObjectExtractorMoreComplexBody netcoreapp3.1 3.75μs 1.9ns 7.36ns 0.0506 0 0 3.69 KB
#4763 ObjectExtractorMoreComplexBody net472 3.57μs 5.18ns 20.1ns 0.603 0.00532 0 3.8 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 RunWaf(args=NestedMap (10)) net6.0 12.7μs 7.95ns 29.7ns 0.127 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 20.2μs 4.67ns 17.5ns 0.121 0 0 9.41 KB
master RunWaf(args=NestedMap (10)) net472 29.9μs 9.2ns 34.4ns 1.5 0 0 9.47 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 76.8μs 38.6ns 149ns 0.191 0 0 15.76 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 86.9μs 155ns 558ns 0.174 0 0 15.71 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 102μs 161ns 625ns 2.51 0 0 16.03 KB
master RunWaf(args=NestedMap (100)) net6.0 24.2μs 7.79ns 30.2ns 0.277 0 0 19.66 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 39.5μs 7.37ns 28.6ns 0.276 0 0 20.41 KB
master RunWaf(args=NestedMap (100)) net472 56.3μs 18.7ns 72.3ns 3.27 0.0569 0 20.62 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 92.1μs 86.9ns 337ns 0.365 0 0 26 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 110μs 130ns 488ns 0.327 0 0 26.71 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 132μs 374ns 1.45μs 4.26 0.0656 0 27.18 KB
master RunWaf(args=NestedMap (20)) net6.0 24.3μs 11.7ns 42.2ns 0.266 0 0 19.39 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 40μs 22.8ns 88.2ns 0.261 0 0 19.83 KB
master RunWaf(args=NestedMap (20)) net472 56.4μs 19ns 68.6ns 3.18 0.0562 0 20.03 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 90.1μs 48ns 180ns 0.359 0 0 25.74 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 111μs 183ns 708ns 0.335 0 0 26.14 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 131μs 170ns 659ns 4.16 0.065 0 26.59 KB
#4763 RunWaf(args=NestedMap (10)) net6.0 13.7μs 4.61ns 17.3ns 0.129 0 0 9.42 KB
#4763 RunWaf(args=NestedMap (10)) netcoreapp3.1 20.1μs 7.81ns 28.1ns 0.12 0 0 9.41 KB
#4763 RunWaf(args=NestedMap (10)) net472 30.5μs 13.5ns 50.5ns 1.5 0 0 9.47 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 77.3μs 176ns 683ns 0.196 0 0 15.76 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 85.7μs 103ns 386ns 0.214 0 0 15.71 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [22]) net472 98.3μs 52.5ns 203ns 2.52 0 0 16.03 KB
#4763 RunWaf(args=NestedMap (100)) net6.0 24.9μs 7.46ns 28.9ns 0.273 0 0 19.66 KB
#4763 RunWaf(args=NestedMap (100)) netcoreapp3.1 39.3μs 11.4ns 41.1ns 0.274 0 0 20.41 KB
#4763 RunWaf(args=NestedMap (100)) net472 57.1μs 125ns 485ns 3.26 0.0567 0 20.62 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 91.2μs 101ns 393ns 0.362 0 0 26 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 111μs 387ns 1.5μs 0.332 0 0 26.71 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [23]) net472 133μs 247ns 956ns 4.29 0.065 0 27.18 KB
#4763 RunWaf(args=NestedMap (20)) net6.0 24.3μs 5.91ns 21.3ns 0.267 0 0 19.39 KB
#4763 RunWaf(args=NestedMap (20)) netcoreapp3.1 39.2μs 10.4ns 39ns 0.275 0 0 19.83 KB
#4763 RunWaf(args=NestedMap (20)) net472 56.3μs 35.6ns 128ns 3.17 0.0562 0 20.03 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 91.2μs 44.4ns 160ns 0.364 0 0 25.74 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 110μs 176ns 659ns 0.326 0 0 26.14 KB
#4763 RunWafWithAttack(args=Neste(...)tack) [22]) net472 129μs 63.1ns 244ns 4.19 0.0645 0 26.59 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 171μs 253ns 981ns 0.171 0 0 18.04 KB
master SendRequest netcoreapp3.1 189μs 226ns 876ns 0.189 0 0 20.2 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#4763 SendRequest net6.0 169μs 159ns 616ns 0.168 0 0 18.04 KB
#4763 SendRequest netcoreapp3.1 188μs 272ns 1.05μs 0.189 0 0 20.2 KB
#4763 SendRequest net472 0.000505ns 0.000189ns 0.000731ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #4763

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.62 KB 41.87 KB 243 B 0.58%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 541μs 340ns 1.32μs 0.546 0 0 41.62 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 645μs 643ns 2.41μs 0.321 0 0 41.8 KB
master WriteAndFlushEnrichedTraces net472 847μs 2.64μs 10.2μs 8.45 2.53 0.422 53.34 KB
#4763 WriteAndFlushEnrichedTraces net6.0 563μs 919ns 3.56μs 0.571 0 0 41.87 KB
#4763 WriteAndFlushEnrichedTraces netcoreapp3.1 646μs 768ns 2.66μs 0.319 0 0 41.95 KB
#4763 WriteAndFlushEnrichedTraces net472 815μs 3.87μs 16μs 8.28 2.48 0.414 53.25 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.03μs 0.621ns 2.41ns 0.0108 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.31μs 0.422ns 1.63ns 0.0102 0 0 768 B
master ExecuteNonQuery net472 1.67μs 1.12ns 4.18ns 0.116 0 0 730 B
#4763 ExecuteNonQuery net6.0 1.07μs 0.684ns 2.65ns 0.0107 0 0 768 B
#4763 ExecuteNonQuery netcoreapp3.1 1.29μs 0.853ns 3.3ns 0.0103 0 0 768 B
#4763 ExecuteNonQuery net472 1.64μs 0.544ns 2.04ns 0.116 0 0 730 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.25μs 0.396ns 1.48ns 0.0131 0 0 936 B
master CallElasticsearch netcoreapp3.1 1.38μs 1.18ns 4.56ns 0.013 0 0 936 B
master CallElasticsearch net472 2.34μs 1.4ns 5.42ns 0.151 0.00117 0 955 B
master CallElasticsearchAsync net6.0 1.16μs 0.48ns 1.8ns 0.0128 0 0 912 B
master CallElasticsearchAsync netcoreapp3.1 1.49μs 0.572ns 2.14ns 0.0132 0 0 984 B
master CallElasticsearchAsync net472 2.49μs 1.42ns 5.51ns 0.16 0 0 1.01 KB
#4763 CallElasticsearch net6.0 1.29μs 0.628ns 2.43ns 0.013 0 0 936 B
#4763 CallElasticsearch netcoreapp3.1 1.38μs 1.06ns 4.11ns 0.0124 0 0 936 B
#4763 CallElasticsearch net472 2.35μs 1.1ns 4.27ns 0.151 0 0 955 B
#4763 CallElasticsearchAsync net6.0 1.22μs 0.499ns 1.87ns 0.0128 0 0 912 B
#4763 CallElasticsearchAsync netcoreapp3.1 1.43μs 0.737ns 2.76ns 0.013 0 0 984 B
#4763 CallElasticsearchAsync net472 2.42μs 0.552ns 2.14ns 0.16 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.38μs 1.05ns 4.08ns 0.0132 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.48μs 0.692ns 2.59ns 0.0126 0 0 912 B
master ExecuteAsync net472 1.71μs 1.03ns 3.99ns 0.139 0.000847 0 875 B
#4763 ExecuteAsync net6.0 1.25μs 0.736ns 2.75ns 0.0125 0 0 912 B
#4763 ExecuteAsync netcoreapp3.1 1.45μs 0.358ns 1.34ns 0.0123 0 0 912 B
#4763 ExecuteAsync net472 1.69μs 0.765ns 2.96ns 0.139 0 0 875 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 3.84μs 2.38ns 8.9ns 0.0266 0 0 1.9 KB
master SendAsync netcoreapp3.1 4.44μs 1.29ns 4.84ns 0.0333 0 0 2.43 KB
master SendAsync net472 7.13μs 2.31ns 8.95ns 0.473 0 0 2.99 KB
#4763 SendAsync net6.0 3.73μs 1.77ns 6.85ns 0.0263 0 0 1.9 KB
#4763 SendAsync netcoreapp3.1 4.4μs 1.94ns 7ns 0.0332 0 0 2.43 KB
#4763 SendAsync net472 7.14μs 4.74ns 18.3ns 0.472 0 0 2.99 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.29μs 0.532ns 1.99ns 0.0224 0 0 1.57 KB
master EnrichedLog netcoreapp3.1 1.9μs 0.556ns 2ns 0.0216 0 0 1.57 KB
master EnrichedLog net472 2.24μs 4.2ns 16.3ns 0.236 0 0 1.49 KB
#4763 EnrichedLog net6.0 1.29μs 0.711ns 2.66ns 0.0217 0 0 1.57 KB
#4763 EnrichedLog netcoreapp3.1 1.82μs 0.918ns 3.44ns 0.0208 0 0 1.57 KB
#4763 EnrichedLog net472 2.23μs 1.9ns 7.36ns 0.237 0 0 1.49 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 113μs 185ns 715ns 0.0569 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 118μs 112ns 433ns 0 0 0 4.21 KB
master EnrichedLog net472 147μs 59.2ns 222ns 0.661 0.22 0 4.38 KB
#4763 EnrichedLog net6.0 111μs 99.4ns 385ns 0.0557 0 0 4.21 KB
#4763 EnrichedLog netcoreapp3.1 116μs 126ns 490ns 0 0 0 4.21 KB
#4763 EnrichedLog net472 146μs 137ns 514ns 0.656 0.219 0 4.38 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 2.67μs 0.918ns 3.43ns 0.0296 0 0 2.13 KB
master EnrichedLog netcoreapp3.1 3.85μs 1.53ns 5.94ns 0.0274 0 0 2.13 KB
master EnrichedLog net472 4.49μs 2.37ns 9.18ns 0.307 0 0 1.93 KB
#4763 EnrichedLog net6.0 2.85μs 0.846ns 3.17ns 0.0301 0 0 2.13 KB
#4763 EnrichedLog netcoreapp3.1 3.99μs 0.806ns 3.12ns 0.0279 0 0 2.13 KB
#4763 EnrichedLog net472 4.54μs 1.17ns 4.39ns 0.306 0 0 1.93 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.28μs 0.872ns 3.26ns 0.0152 0 0 1.1 KB
master SendReceive netcoreapp3.1 1.56μs 0.72ns 2.69ns 0.0148 0 0 1.1 KB
master SendReceive net472 1.94μs 2.29ns 8.86ns 0.177 0 0 1.12 KB
#4763 SendReceive net6.0 1.24μs 0.949ns 3.68ns 0.0154 0 0 1.1 KB
#4763 SendReceive netcoreapp3.1 1.67μs 0.711ns 2.75ns 0.015 0 0 1.1 KB
#4763 SendReceive net472 1.9μs 1.95ns 7.54ns 0.177 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 2.55μs 1.62ns 6.05ns 0.0217 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.66μs 1.57ns 5.88ns 0.02 0 0 1.58 KB
master EnrichedLog net472 4.03μs 1.16ns 4.03ns 0.309 0 0 1.96 KB
#4763 EnrichedLog net6.0 2.52μs 1.07ns 4.16ns 0.0214 0 0 1.53 KB
#4763 EnrichedLog netcoreapp3.1 3.66μs 0.984ns 3.81ns 0.0202 0 0 1.58 KB
#4763 EnrichedLog net472 4.06μs 0.853ns 3.3ns 0.311 0 0 1.96 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4763

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 1.228 572.39 703.07
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.167 494.02 576.31
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.137 547.24 621.98

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 454ns 0.0978ns 0.379ns 0.00754 0 0 536 B
master StartFinishSpan netcoreapp3.1 494ns 0.162ns 0.585ns 0.00715 0 0 536 B
master StartFinishSpan net472 573ns 0.405ns 1.57ns 0.0852 0 0 538 B
master StartFinishScope net6.0 547ns 0.175ns 0.679ns 0.00907 0 0 656 B
master StartFinishScope netcoreapp3.1 695ns 0.647ns 2.5ns 0.0089 0 0 656 B
master StartFinishScope net472 820ns 0.849ns 3.29ns 0.098 0 0 618 B
#4763 StartFinishSpan net6.0 449ns 0.141ns 0.51ns 0.00751 0 0 536 B
#4763 StartFinishSpan netcoreapp3.1 577ns 0.484ns 1.87ns 0.00722 0 0 536 B
#4763 StartFinishSpan net472 708ns 1.82ns 7.06ns 0.0853 0 0 538 B
#4763 StartFinishScope net6.0 622ns 0.304ns 1.18ns 0.00929 0 0 656 B
#4763 StartFinishScope netcoreapp3.1 760ns 0.181ns 0.676ns 0.00893 0 0 656 B
#4763 StartFinishScope net472 866ns 0.219ns 0.846ns 0.098 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4763

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.123 583.62 655.46

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 584ns 0.221ns 0.857ns 0.00942 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 851ns 0.327ns 1.22ns 0.00856 0 0 656 B
master RunOnMethodBegin net472 960ns 0.445ns 1.73ns 0.0982 0 0 618 B
#4763 RunOnMethodBegin net6.0 655ns 0.247ns 0.925ns 0.00904 0 0 656 B
#4763 RunOnMethodBegin netcoreapp3.1 781ns 0.361ns 1.4ns 0.00906 0 0 656 B
#4763 RunOnMethodBegin net472 989ns 0.433ns 1.68ns 0.098 0 0 618 B

@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch from 07ced96 to 3a8c4e4 Compare October 25, 2023 19:43
@andrewlock
Copy link
Member

andrewlock commented Oct 26, 2023

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4763) - mean (70ms)  : 64, 76
     .   : milestone, 70,
    master - mean (70ms)  : 62, 79
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (4763) - mean (999ms)  : 979, 1019
     .   : milestone, 999,
    master - mean (993ms)  : 970, 1015
     .   : milestone, 993,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4763) - mean (106ms)  : 101, 111
     .   : milestone, 106,
    master - mean (106ms)  : 102, 110
     .   : milestone, 106,

    section CallTarget+Inlining+NGEN
    This PR (4763) - mean (691ms)  : 670, 713
     .   : milestone, 691,
    master - mean (689ms)  : 673, 706
     .   : milestone, 689,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4763) - mean (90ms)  : 86, 93
     .   : milestone, 90,
    master - mean (89ms)  : 85, 93
     .   : milestone, 89,

    section CallTarget+Inlining+NGEN
    This PR (4763) - mean (654ms)  : 632, 675
     .   : milestone, 654,
    master - mean (654ms)  : 628, 681
     .   : milestone, 654,

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

    section CallTarget+Inlining+NGEN
    This PR (4763) - mean (1,105ms)  : 1082, 1127
     .   : milestone, 1105,
    master - mean (1,097ms)  : 1078, 1116
     .   : milestone, 1097,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4763) - mean (272ms)  : 269, 275
     .   : milestone, 272,
    master - mean (272ms)  : 268, 277
     .   : milestone, 272,

    section CallTarget+Inlining+NGEN
    This PR (4763) - mean (1,058ms)  : 1036, 1081
     .   : milestone, 1058,
    master - mean (1,054ms)  : 1027, 1081
     .   : milestone, 1054,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4763) - mean (263ms)  : 259, 267
     .   : milestone, 263,
    master - mean (262ms)  : 259, 265
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (4763) - mean (1,025ms)  : 1000, 1051
     .   : milestone, 1025,
    master - mean (1,029ms)  : 1002, 1057
     .   : milestone, 1029,

Loading

@andrewlock
Copy link
Member

andrewlock commented Oct 26, 2023

Throughput/Crank Report:zap:

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4763) (11.404M)   : 0, 11403540
    master (10.765M)   : 0, 10765367
    benchmarks/2.9.0 (11.215M)   : 0, 11214844

    section Automatic
    This PR (4763) (8.021M)   : 0, 8020591
    master (7.480M)   : 0, 7479538
    benchmarks/2.9.0 (8.052M)   : 0, 8052124

    section Trace stats
    This PR (4763) (8.376M)   : 0, 8375560
    master (7.889M)   : 0, 7888566

    section Manual
    This PR (4763) (10.179M)   : 0, 10179314
    master (9.812M)   : 0, 9812112

    section Manual + Automatic
    This PR (4763) (6.405M)   : crit ,0, 6405490
    master (7.340M)   : 0, 7340198

    section Version Conflict
    This PR (4763) (7.032M)   : 0, 7032176
    master (6.763M)   : 0, 6762729

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4763) (9.449M)   : 0, 9448687
    master (9.729M)   : 0, 9729105
    benchmarks/2.9.0 (9.491M)   : 0, 9490746

    section Automatic
    This PR (4763) (6.644M)   : 0, 6644132
    master (6.666M)   : 0, 6666142

    section Trace stats
    This PR (4763) (6.868M)   : 0, 6868402
    master (6.914M)   : 0, 6913998

    section Manual
    This PR (4763) (8.351M)   : 0, 8350548
    master (8.189M)   : 0, 8189252

    section Manual + Automatic
    This PR (4763) (6.239M)   : 0, 6239242
    master (6.212M)   : 0, 6212129

    section Version Conflict
    This PR (4763) (5.866M)   : 0, 5866260
    master (5.947M)   : 0, 5946691

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4763) (9.428M)   : 0, 9428216
    master (9.476M)   : 0, 9476236
    benchmarks/2.9.0 (9.522M)   : 0, 9522401

    section Automatic
    This PR (4763) (6.830M)   : 0, 6830495
    master (6.683M)   : 0, 6682612
    benchmarks/2.9.0 (7.002M)   : 0, 7001835

    section Trace stats
    This PR (4763) (6.993M)   : 0, 6993199
    master (6.975M)   : 0, 6974727

    section Manual
    This PR (4763) (8.302M)   : 0, 8302455
    master (8.455M)   : 0, 8454852

    section Manual + Automatic
    This PR (4763) (6.585M)   : 0, 6584945
    master (6.644M)   : 0, 6643657

    section Version Conflict
    This PR (4763) (6.011M)   : 0, 6010722
    master (6.056M)   : 0, 6055783

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    master (7.392M)   : 0, 7392030
    benchmarks/2.9.0 (7.864M)   : 0, 7864312

    section No attack
    master (2.126M)   : 0, 2125723
    benchmarks/2.9.0 (3.284M)   : 0, 3283847

    section Attack
    master (1.678M)   : 0, 1677679
    benchmarks/2.9.0 (2.563M)   : 0, 2563495

    section Blocking
    master (3.480M)   : 0, 3479765

    section IAST default
    master (6.599M)   : 0, 6598592

    section IAST full
    master (6.092M)   : 0, 6092306

    section Base vuln
    master (0.961M)   : 0, 961055

    section IAST vuln
    master (0.874M)   : 0, 873801

Loading

@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch from af1e91a to a16c017 Compare October 26, 2023 14:20
@gleocadie gleocadie marked this pull request as ready for review October 26, 2023 14:28
@gleocadie gleocadie requested a review from a team as a code owner October 26, 2023 14:28
@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch 2 times, most recently from a89cbbd to 9d4af22 Compare October 26, 2023 15:10
@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch from 9d4af22 to 1973bbd Compare October 27, 2023 12:16
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.

General comments:

  • avoid detail sub namespace
  • some .h/.hpp are not in the VS's solution libdatadog folder

@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch 3 times, most recently from db9c794 to 6fa391e Compare November 9, 2023 10:27
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Nov 9, 2023

Datadog Report

Branch report: gleocadie/refactoring-better-wrap-libdatadog
Commit report: 77086c0

dd-trace-dotnet: 0 Failed, 0 New Flaky, 299768 Passed, 1267 Skipped, 28m 48.47s Wall Time

@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch from 6fa391e to 55eaf94 Compare November 9, 2023 12:53
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
Look at 2 small questions

@gleocadie gleocadie force-pushed the gleocadie/refactoring-better-wrap-libdatadog branch from dbbd945 to 77086c0 Compare November 10, 2023 14:10
@gleocadie gleocadie merged commit 94f1f91 into master Nov 10, 2023
59 of 62 checks passed
@gleocadie gleocadie deleted the gleocadie/refactoring-better-wrap-libdatadog branch November 10, 2023 19:30
@github-actions github-actions bot added this to the vNext milestone Nov 10, 2023
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.

3 participants