-
Notifications
You must be signed in to change notification settings - Fork 147
[Profiler] Change profiler to use the libdatadog dynamic library instead #6301
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
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 252938 Passed, 2476 Skipped, 20h 44m 38.62s Total Time |
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:
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 (6301) - mean (69ms) : 67, 71
. : milestone, 69,
master - mean (70ms) : 66, 73
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6301) - mean (1,005ms) : 985, 1024
. : milestone, 1005,
master - mean (1,005ms) : 982, 1028
. : milestone, 1005,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6301) - mean (102ms) : 101, 104
. : milestone, 102,
master - mean (102ms) : 101, 104
. : milestone, 102,
section CallTarget+Inlining+NGEN
This PR (6301) - mean (688ms) : 670, 705
. : milestone, 688,
master - mean (687ms) : 671, 702
. : milestone, 687,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6301) - mean (89ms) : 87, 91
. : milestone, 89,
master - mean (89ms) : 87, 92
. : milestone, 89,
section CallTarget+Inlining+NGEN
This PR (6301) - mean (646ms) : 629, 662
. : milestone, 646,
master - mean (643ms) : 628, 658
. : milestone, 643,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6301) - mean (190ms) : 187, 194
. : milestone, 190,
master - mean (190ms) : 185, 195
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (6301) - mean (1,108ms) : 1083, 1134
. : milestone, 1108,
master - mean (1,104ms) : 1079, 1129
. : milestone, 1104,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6301) - mean (269ms) : 265, 273
. : milestone, 269,
master - mean (269ms) : 264, 273
. : milestone, 269,
section CallTarget+Inlining+NGEN
This PR (6301) - mean (875ms) : 851, 900
. : milestone, 875,
master - mean (875ms) : 848, 902
. : milestone, 875,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6301) - mean (261ms) : 257, 265
. : milestone, 261,
master - mean (261ms) : 257, 265
. : milestone, 261,
section CallTarget+Inlining+NGEN
This PR (6301) - mean (861ms) : 820, 902
. : milestone, 861,
master - mean (858ms) : 826, 890
. : milestone, 858,
|
6211ed7
to
11e14e2
Compare
Benchmarks Report for tracer 🐌Benchmarks for #6301 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations
|
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 41.52 KB | 41.73 KB | 214 B | 0.52% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | WriteAndFlushEnrichedTraces |
net6.0 | 585μs | 3.35μs | 25.5μs | 0.571 | 0 | 0 | 41.59 KB |
master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 706μs | 3.66μs | 18.3μs | 0.357 | 0 | 0 | 41.52 KB |
master | WriteAndFlushEnrichedTraces |
net472 | 892μs | 3.99μs | 14.4μs | 8.8 | 2.64 | 0.44 | 53.35 KB |
#6301 | WriteAndFlushEnrichedTraces |
net6.0 | 607μs | 3.57μs | 35μs | 0.579 | 0 | 0 | 41.73 KB |
#6301 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 728μs | 4.26μs | 41.1μs | 0.329 | 0 | 0 | 41.73 KB |
#6301 | WriteAndFlushEnrichedTraces |
net472 | 870μs | 4.1μs | 15.9μs | 8.3 | 2.62 | 0.437 | 53.34 KB |
Benchmarks.Trace.DbCommandBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6301
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0
1.126
1,239.46
1,395.77
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 | 1.126 | 1,239.46 | 1,395.77 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteNonQuery |
net6.0 | 1.24μs | 0.952ns | 3.56ns | 0.0142 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
netcoreapp3.1 | 1.79μs | 4.6ns | 17.2ns | 0.014 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
net472 | 2.04μs | 2.69ns | 10.4ns | 0.156 | 0.00102 | 0 | 987 B |
#6301 | ExecuteNonQuery |
net6.0 | 1.4μs | 1.86ns | 7.19ns | 0.014 | 0 | 0 | 1.02 KB |
#6301 | ExecuteNonQuery |
netcoreapp3.1 | 1.85μs | 2.72ns | 10.5ns | 0.014 | 0 | 0 | 1.02 KB |
#6301 | ExecuteNonQuery |
net472 | 2.18μs | 3.17ns | 12.3ns | 0.157 | 0.00109 | 0 | 987 B |
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6301
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0
1.125
1,352.93
1,202.29
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 | 1.125 | 1,352.93 | 1,202.29 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.35μs | 0.906ns | 3.39ns | 0.0135 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.52μs | 1.65ns | 5.72ns | 0.0128 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.61μs | 2.55ns | 9.89ns | 0.157 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.41μs | 0.842ns | 3.15ns | 0.0134 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.68μs | 0.757ns | 2.93ns | 0.0136 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.71μs | 1.63ns | 6.32ns | 0.166 | 0 | 0 | 1.05 KB |
#6301 | CallElasticsearch |
net6.0 | 1.2μs | 0.894ns | 3.34ns | 0.0138 | 0 | 0 | 976 B |
#6301 | CallElasticsearch |
netcoreapp3.1 | 1.65μs | 0.579ns | 2.17ns | 0.0131 | 0 | 0 | 976 B |
#6301 | CallElasticsearch |
net472 | 2.59μs | 2.58ns | 9.98ns | 0.158 | 0 | 0 | 995 B |
#6301 | CallElasticsearchAsync |
net6.0 | 1.32μs | 0.359ns | 1.29ns | 0.0131 | 0 | 0 | 952 B |
#6301 | CallElasticsearchAsync |
netcoreapp3.1 | 1.67μs | 0.707ns | 2.74ns | 0.0142 | 0 | 0 | 1.02 KB |
#6301 | CallElasticsearchAsync |
net472 | 2.59μs | 1.59ns | 6.15ns | 0.166 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.33μs | 0.607ns | 2.27ns | 0.0134 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.62μs | 1.56ns | 6.04ns | 0.0121 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.83μs | 0.464ns | 1.8ns | 0.145 | 0 | 0 | 915 B |
#6301 | ExecuteAsync |
net6.0 | 1.32μs | 0.287ns | 1.07ns | 0.0132 | 0 | 0 | 952 B |
#6301 | ExecuteAsync |
netcoreapp3.1 | 1.73μs | 0.637ns | 2.38ns | 0.0128 | 0 | 0 | 952 B |
#6301 | ExecuteAsync |
net472 | 1.81μs | 0.567ns | 2.12ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendAsync |
net6.0 | 4.46μs | 2.63ns | 9.85ns | 0.0313 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.21μs | 1.38ns | 4.98ns | 0.037 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.5μs | 1.48ns | 5.34ns | 0.492 | 0 | 0 | 3.12 KB |
#6301 | SendAsync |
net6.0 | 4.46μs | 5.12ns | 19.8ns | 0.0311 | 0 | 0 | 2.31 KB |
#6301 | SendAsync |
netcoreapp3.1 | 5.26μs | 1.85ns | 7.17ns | 0.0371 | 0 | 0 | 2.85 KB |
#6301 | SendAsync |
net472 | 7.51μs | 1.73ns | 6.46ns | 0.496 | 0 | 0 | 3.12 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 1.45μs | 0.72ns | 2.7ns | 0.0232 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.26μs | 0.821ns | 3.07ns | 0.0218 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.57μs | 0.96ns | 3.72ns | 0.249 | 0 | 0 | 1.57 KB |
#6301 | EnrichedLog |
net6.0 | 1.47μs | 0.683ns | 2.65ns | 0.0228 | 0 | 0 | 1.64 KB |
#6301 | EnrichedLog |
netcoreapp3.1 | 2.2μs | 0.947ns | 3.67ns | 0.0219 | 0 | 0 | 1.64 KB |
#6301 | EnrichedLog |
net472 | 2.47μs | 0.82ns | 3.07ns | 0.249 | 0 | 0 | 1.57 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 111μs | 102ns | 397ns | 0.0557 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 115μs | 98.7ns | 369ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 150μs | 130ns | 486ns | 0.673 | 0.224 | 0 | 4.46 KB |
#6301 | EnrichedLog |
net6.0 | 111μs | 119ns | 459ns | 0.0555 | 0 | 0 | 4.28 KB |
#6301 | EnrichedLog |
netcoreapp3.1 | 115μs | 189ns | 733ns | 0 | 0 | 0 | 4.28 KB |
#6301 | EnrichedLog |
net472 | 149μs | 109ns | 408ns | 0.665 | 0.222 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 3.22μs | 0.689ns | 2.48ns | 0.0306 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.14μs | 1.42ns | 5.32ns | 0.0309 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.8μs | 1.85ns | 7.15ns | 0.32 | 0 | 0 | 2.02 KB |
#6301 | EnrichedLog |
net6.0 | 3.07μs | 1.4ns | 5.41ns | 0.0307 | 0 | 0 | 2.2 KB |
#6301 | EnrichedLog |
netcoreapp3.1 | 4.07μs | 0.983ns | 3.41ns | 0.0289 | 0 | 0 | 2.2 KB |
#6301 | EnrichedLog |
net472 | 4.79μs | 2.35ns | 9.09ns | 0.319 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.4μs | 0.409ns | 1.58ns | 0.016 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.73μs | 0.553ns | 2.14ns | 0.0155 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.08μs | 0.914ns | 3.54ns | 0.183 | 0 | 0 | 1.16 KB |
#6301 | SendReceive |
net6.0 | 1.47μs | 0.718ns | 2.59ns | 0.016 | 0 | 0 | 1.14 KB |
#6301 | SendReceive |
netcoreapp3.1 | 1.76μs | 1.06ns | 3.96ns | 0.015 | 0 | 0 | 1.14 KB |
#6301 | SendReceive |
net472 | 2.04μs | 0.967ns | 3.75ns | 0.183 | 0 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.75μs | 2.48ns | 8.94ns | 0.0219 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.95μs | 2.75ns | 10.6ns | 0.0216 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.44μs | 1.98ns | 7.39ns | 0.323 | 0 | 0 | 2.04 KB |
#6301 | EnrichedLog |
net6.0 | 2.88μs | 1.05ns | 4.07ns | 0.0216 | 0 | 0 | 1.6 KB |
#6301 | EnrichedLog |
netcoreapp3.1 | 3.86μs | 8.73ns | 33.8ns | 0.023 | 0 | 0 | 1.65 KB |
#6301 | EnrichedLog |
net472 | 4.32μs | 3.86ns | 14.9ns | 0.323 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6301
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472
1.354
779.32
575.44
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 | 1.354 | 779.32 | 575.44 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 403ns | 0.165ns | 0.638ns | 0.00804 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 582ns | 0.466ns | 1.81ns | 0.00773 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 779ns | 0.225ns | 0.87ns | 0.0915 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 506ns | 0.144ns | 0.559ns | 0.00988 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 712ns | 0.464ns | 1.8ns | 0.00954 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 802ns | 0.386ns | 1.5ns | 0.104 | 0 | 0 | 658 B |
#6301 | StartFinishSpan |
net6.0 | 401ns | 0.166ns | 0.575ns | 0.00808 | 0 | 0 | 576 B |
#6301 | StartFinishSpan |
netcoreapp3.1 | 567ns | 0.501ns | 1.87ns | 0.0077 | 0 | 0 | 576 B |
#6301 | StartFinishSpan |
net472 | 576ns | 0.218ns | 0.786ns | 0.0917 | 0 | 0 | 578 B |
#6301 | StartFinishScope |
net6.0 | 490ns | 0.154ns | 0.598ns | 0.00978 | 0 | 0 | 696 B |
#6301 | StartFinishScope |
netcoreapp3.1 | 734ns | 0.415ns | 1.61ns | 0.00934 | 0 | 0 | 696 B |
#6301 | StartFinishScope |
net472 | 840ns | 0.336ns | 1.3ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 656ns | 0.153ns | 0.572ns | 0.00985 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 876ns | 0.393ns | 1.52ns | 0.00925 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.1μs | 0.324ns | 1.25ns | 0.104 | 0 | 0 | 658 B |
#6301 | RunOnMethodBegin |
net6.0 | 596ns | 0.324ns | 1.26ns | 0.00988 | 0 | 0 | 696 B |
#6301 | RunOnMethodBegin |
netcoreapp3.1 | 947ns | 0.451ns | 1.75ns | 0.0095 | 0 | 0 | 696 B |
#6301 | RunOnMethodBegin |
net472 | 1.13μs | 0.381ns | 1.47ns | 0.104 | 0 | 0 | 658 B |
cedf2e0
to
59958ab
Compare
968a5f1
to
8e19154
Compare
6b2ff48
to
279fa6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
<TopLevelDeployDirectoryBase Condition="'$(DeployToMonitoringHome)' == 'True'">$(EnlistmentRoot)\shared\bin\monitoring-home</TopLevelDeployDirectoryBase> | ||
<TopLevelDeployDirectoryBase Condition="'$(DeployToMonitoringHome)' != 'True'">$(BuildOutputRoot)\DDProf-Deploy</TopLevelDeployDirectoryBase> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just things moving around, but I'd Really like to ditch a bunch of this soon if possible, and deploy everything to the "standard" directories instead (which are controlled in CI by env vars etc too). Just an aside, not suggesting we do anything about it now! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 I'm always stressed out when I have to modify those files...
<ComponentGroup Id="Shared.Files.Libdatadog.64" Directory="INSTALLFOLDER.win_x64"> | ||
<Component Win64="yes"> | ||
<File Id="libdatadog" | ||
Source="$(var.MonitoringHomeDirectory)\win-x64\datadog_profiling_ffi.dll" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only ever going to be the profiling ffi dll? If so, would it make more sense for this to be in the profiler definition .wxs file, rather than in shared? And if it's going to be more than the profiling_ffi, does it make sense for the file to be called something different? e.g. libdatadog.ffi.dll or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is plan from libdatadog repo to rename this libdatadog_profiling.dll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any progress on that renaming? And to clarify, is this only an ffi for the profiling functionality? Will we have additional dlls for other ffi (for data pipelin etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not yet.
it's a ffi for profiler/data-pipeline/crash-tracking/... (whatever we decide to have in it)
Will we have additional dlls for other ffi (for data pipelin etc)
Nop, the goal is to have only one
// | ||
// See also the ValidateNativeTracerGlibcCompatibility Nuke task and the checks | ||
// in shared/src/Datadog.Trace.ClrProfiler.Native/cor_profiler.cpp#L1279 | ||
var expectedGlibcVersion = IsArm64 | ||
? new Version(2, 28) | ||
? new Version(2, 18) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... this is actually a little concerning to me 🤔 I assume this has gone done not because you've removed requirements from the profiler, but rather those requirements have shifted into the libdatadog files... To avoid issues, and to keep this check meaningful, we presumably need to check the libdatadog/ffi compatibility, as well no? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
Target PublishLibdatadog => _ => _ | ||
.Unlisted() | ||
.DependsOn(PublishLibdatadogWindows) | ||
.DependsOn(PublishLibdatadogLinux); | ||
|
||
Target PublishLibdatadogWindows => _ => _ | ||
.Unlisted() | ||
.OnlyWhenStatic(() => IsWin) | ||
.After(CompileProfilerNativeSrc) | ||
.Executes(() => | ||
{ | ||
const string fileName = "datadog_profiling_ffi"; | ||
foreach (var architecture in ArchitecturesForPlatformForProfiler) | ||
{ | ||
var sourceDir = ProfilerDeployDirectory / $"win-{architecture}"; | ||
var source = sourceDir / $"{fileName}.dll"; | ||
var dest = MonitoringHomeDirectory / $"win-{architecture}"; | ||
CopyFileToDirectory(source, dest, FileExistsPolicy.Overwrite); | ||
|
||
source = sourceDir / $"{fileName}.pdb"; | ||
dest = SymbolsDirectory / $"win-{architecture}" / Path.GetFileName(source); | ||
CopyFile(source, dest, FileExistsPolicy.Overwrite); | ||
} | ||
}); | ||
|
||
Target PublishLibdatadogLinux => _ => _ | ||
.Unlisted() | ||
.OnlyWhenStatic(() => IsLinux) | ||
.After(CompileProfilerNativeSrc) | ||
.Executes(() => | ||
{ | ||
var (arch, _) = GetUnixArchitectureAndExtension(); | ||
var sourceDir = ProfilerDeployDirectory / arch; | ||
EnsureExistingDirectory(MonitoringHomeDirectory / arch); | ||
|
||
var files = new[] { "libdatadog_profiling.so" }; | ||
foreach (var file in files) | ||
{ | ||
var source = sourceDir / file; | ||
var dest = MonitoringHomeDirectory / arch / file; | ||
CopyFile(source, dest, FileExistsPolicy.Overwrite); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally trying to reduce the number of targets we have (one day hoping to have it down to a number we can actually understand 😅). I realise you just used existing patterns with this, but I'm trying to change those patterns now 😄
Worst case, we could combine these three into a single target:
Target PublishLibdatadog => _ => _ | |
.Unlisted() | |
.DependsOn(PublishLibdatadogWindows) | |
.DependsOn(PublishLibdatadogLinux); | |
Target PublishLibdatadogWindows => _ => _ | |
.Unlisted() | |
.OnlyWhenStatic(() => IsWin) | |
.After(CompileProfilerNativeSrc) | |
.Executes(() => | |
{ | |
const string fileName = "datadog_profiling_ffi"; | |
foreach (var architecture in ArchitecturesForPlatformForProfiler) | |
{ | |
var sourceDir = ProfilerDeployDirectory / $"win-{architecture}"; | |
var source = sourceDir / $"{fileName}.dll"; | |
var dest = MonitoringHomeDirectory / $"win-{architecture}"; | |
CopyFileToDirectory(source, dest, FileExistsPolicy.Overwrite); | |
source = sourceDir / $"{fileName}.pdb"; | |
dest = SymbolsDirectory / $"win-{architecture}" / Path.GetFileName(source); | |
CopyFile(source, dest, FileExistsPolicy.Overwrite); | |
} | |
}); | |
Target PublishLibdatadogLinux => _ => _ | |
.Unlisted() | |
.OnlyWhenStatic(() => IsLinux) | |
.After(CompileProfilerNativeSrc) | |
.Executes(() => | |
{ | |
var (arch, _) = GetUnixArchitectureAndExtension(); | |
var sourceDir = ProfilerDeployDirectory / arch; | |
EnsureExistingDirectory(MonitoringHomeDirectory / arch); | |
var files = new[] { "libdatadog_profiling.so" }; | |
foreach (var file in files) | |
{ | |
var source = sourceDir / file; | |
var dest = MonitoringHomeDirectory / arch / file; | |
CopyFile(source, dest, FileExistsPolicy.Overwrite); | |
} | |
}); | |
Target PublishLibdatadog => _ => _ | |
.Unlisted() | |
.After(CompileProfilerNativeSrc) | |
.Executes(() => | |
{ | |
if (IsWin) | |
{ | |
const string fileName = "datadog_profiling_ffi"; | |
foreach (var architecture in ArchitecturesForPlatformForProfiler) | |
{ | |
var sourceDir = ProfilerDeployDirectory / $"win-{architecture}"; | |
var source = sourceDir / $"{fileName}.dll"; | |
var dest = MonitoringHomeDirectory / $"win-{architecture}"; | |
CopyFileToDirectory(source, dest, FileExistsPolicy.Overwrite); | |
source = sourceDir / $"{fileName}.pdb"; | |
dest = SymbolsDirectory / $"win-{architecture}" / Path.GetFileName(source); | |
CopyFile(source, dest, FileExistsPolicy.Overwrite); | |
} | |
} | |
else (IsLinux) | |
{ | |
var (arch, _) = GetUnixArchitectureAndExtension(); | |
var sourceDir = ProfilerDeployDirectory / arch; | |
EnsureExistingDirectory(MonitoringHomeDirectory / arch); | |
var files = new[] { "libdatadog_profiling.so" }; | |
foreach (var file in files) | |
{ | |
var source = sourceDir / file; | |
var dest = MonitoringHomeDirectory / arch / file; | |
CopyFile(source, dest, FileExistsPolicy.Overwrite); | |
} | |
} | |
}); |
but I think best case, we could do this copying as part of the existing PublishProfiler
step? Especially as this is a required step for the profiler to work... Ideally it would reduce some of the duplication in terms of finding paths and directories etc which this presumably introduces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I did that in the forthcoming event that the tracer will have to use this lib. I got a bit to far ahead :P
I'm make it part of PublishProfiler
.
We'll revisit it when integrating it for the tracer.
// The profiler has a different minimum glibc version to the tracer. | ||
// The _overall_ minimum is the highest of the two, but as we don't | ||
// currently enable the profiler on ARM64, we take the .NET runtime's minimum | ||
// glibc as our actual minimum in practice. Before we can enable the profiler | ||
// on arm64 we must first ensure we bring this glibc version down to 2.23. | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to elsewhere, I think we actually need to expand this so that we check the glibc requirements for all the libraries we load, including libdatadog (and potentially libddwaf, though I think that is compiled like the native loader?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these changes.
@@ -12,4 +12,40 @@ | |||
<AdditionalDependencies>$(LibDatadogDependencies);%(AdditionalDependencies)</AdditionalDependencies> | |||
</Link> | |||
</ItemDefinitionGroup> | |||
|
|||
<PropertyGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓
Shouldn't this be at the top level for both profiler and tracer?
For example if I'm running Datadog.Trace.Integration tests, we would like to copy right platform binaries in the target directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, but at this point it's only profiler, so I prefer scoping this change to profiler and coming back at it when integrating this the tracer
4e22760
to
dded8fd
Compare
Datadog ReportBranch report: ✅ 0 Failed, 230569 Passed, 2009 Skipped, 13h 34m 43.46s Total Time |
c3d9e7a
to
683abbc
Compare
1307ce2
to
71d81a6
Compare
Datadog ReportAll test runs ✅ 2 Total Test Services: 0 Failed, 2 Passed Test Services
|
71d81a6
to
5b4dc22
Compare
5b4dc22
to
649a8ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! :blindfold: 🤞 😄
<ClInclude Include="ThreadsCpuManagerHelper.h"> | ||
<Filter>Helpers</Filter> | ||
</ClInclude> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intentional? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not that I remember 🤔
I'll check thx
<ComponentGroup Id="Shared.Files.Libdatadog.64" Directory="INSTALLFOLDER.win_x64"> | ||
<Component Win64="yes"> | ||
<File Id="libdatadog" | ||
Source="$(var.MonitoringHomeDirectory)\win-x64\datadog_profiling_ffi.dll" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any progress on that renaming? And to clarify, is this only an ffi for the profiling functionality? Will we have additional dlls for other ffi (for data pipelin etc)
649a8ad
to
7f75212
Compare
7f75212
to
50ca661
Compare
Summary of changes
Use
libdatadog
shared library instead of static link against it.Reason for change
Tracer is going to use the Rust crate
datapipeline
to send their traces and so. This C API for datapipeline will be part of thelibdatadog
shared file.Since we cannot static link the profiler and the tracer against libdatadog (two Rust runtimes in the same process would bring hell), we need to use the dynamic library (Linux
sofile
and Windowsdll
).This PR is a first step: Having profiler using the shared library and ensuring that it works.
Implementation details
RPATH
in the ELF to instruct the dynamic loader where to look for libdatadog dynamic library.FindLibDatadog.cmake
to copy libdatadog sofile in the output of the cmake libraryLoadLibraryEx
in the Native loader to instruct the dynamic loader where to look for libdatadog dynamic library.Test coverage
Other details