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

Pack trimming file in Datadog.Trace NuGet, and add trimming smoke tests for the NuGet packages #6678

Merged
merged 7 commits into from
Feb 18, 2025

Conversation

andrewlock
Copy link
Member

@andrewlock andrewlock commented Feb 18, 2025

Summary of changes

  • Pack the trimming file into the Datadog.Trace NuGet package
  • Add smoke tests for the Datadog.Trace and Datadog.Trace.Trimming NuGet packages
  • Remove the unnecessary sdk.props file from Datadog.Trace.Trimming

Reason for change

When users are building trimmed (non-aot) apps, they need to reference our trimming file, which is currently exposed via the Datadog.Trace.Trimming NuGet package. We created this as a separate package, because we didn't want people to have to reference the Datadog.Trace NuGet if they didn't need it.

However, there's not really a good reason to force people to have to reference another NuGet package if they are already referencing Datadog.Trace. And there's no harm in including the trimming file for non-trimmed apps, it has no impact.

Implementation details

  • Pack the same trimming.XML file into the Datadog.Trace NuGet package
  • Include a Datadog.Trace.props file to automatically reference the trimmer file when the NuGet is referenced
  • Added smoke tests that confirm the NuGet packaging is correct for both the new package, and the existing package
    • We already had "integration" tests that confirm the trimmer file works, but we didn't have any tests that were using the NuGet package, to confirm the props are correctly added etc.
  • Removed the sdk/sdk.props file from Datadog.Trace.Trimming as it's unused. This file is only useful if you're creating a "custom .NET SDK" to reference in the <Project SDK="Some.SDK"> element (which we're not).

Test coverage

Added smoke tests to confirm both the Datadog.Trace and Datadog.Trace.Trimming packages work as expected. For now, these are:

  • linux-x64/linux-musl-x64 only
  • net8.0/net9.0 only

We could expand that further if we want, but I'm not massively inclined to do so - we primarily want to ensure the packages are valid, and we don't really need to run that across all the different platforms IMO. Plus it will just increase the chance of flake.

Other details

As part of this, noticed that crash tracking didn't work.

I've kept these in the "standard, every PR" set of smoke tests for now, but maybe we should move them to the master-only set? 🤷‍♂️

@andrewlock andrewlock requested review from a team as code owners February 18, 2025 13:35
@andrewlock andrewlock added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Feb 18, 2025
@andrewlock andrewlock changed the title Add smoke tests for the trimming NuGet and pack trimming file in Datadog.Trace NuGet Pack trimming file in Datadog.Trace NuGet, and add trimming smoke tests for the NuGet packages Feb 18, 2025
Co-authored-by: Kevin Gosse <kevin.gosse@datadoghq.com>
@andrewlock andrewlock added type:enhancement Improvement to an existing feature area:tests unit tests, integration tests labels Feb 18, 2025
@andrewlock
Copy link
Member Author

andrewlock commented Feb 18, 2025

Execution-Time Benchmarks Report ⏱️

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

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

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

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

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

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6678) - mean (69ms)  : 65, 72
     .   : milestone, 69,
    master - mean (71ms)  : 61, 80
     .   : milestone, 71,

    section CallTarget+Inlining+NGEN
    This PR (6678) - mean (996ms)  : 973, 1018
     .   : milestone, 996,
    master - mean (996ms)  : 966, 1026
     .   : milestone, 996,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6678) - mean (102ms)  : 99, 104
     .   : milestone, 102,
    master - mean (102ms)  : 100, 104
     .   : milestone, 102,

    section CallTarget+Inlining+NGEN
    This PR (6678) - mean (672ms)  : 656, 687
     .   : milestone, 672,
    master - mean (675ms)  : 658, 692
     .   : milestone, 675,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6678) - mean (89ms)  : 87, 91
     .   : milestone, 89,
    master - mean (88ms)  : 87, 90
     .   : milestone, 88,

    section CallTarget+Inlining+NGEN
    This PR (6678) - mean (626ms)  : 607, 645
     .   : milestone, 626,
    master - mean (629ms)  : 613, 645
     .   : milestone, 629,

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

    section CallTarget+Inlining+NGEN
    This PR (6678) - mean (1,107ms)  : 1082, 1132
     .   : milestone, 1107,
    master - mean (1,109ms)  : 1083, 1136
     .   : milestone, 1109,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6678) - mean (271ms)  : 266, 276
     .   : milestone, 271,
    master - mean (271ms)  : 267, 276
     .   : milestone, 271,

    section CallTarget+Inlining+NGEN
    This PR (6678) - mean (866ms)  : 838, 894
     .   : milestone, 866,
    master - mean (868ms)  : 834, 901
     .   : milestone, 868,

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

    section CallTarget+Inlining+NGEN
    This PR (6678) - mean (840ms)  : 808, 872
     .   : milestone, 840,
    master - mean (847ms)  : 814, 881
     .   : milestone, 847,

Loading

@andrewlock
Copy link
Member Author

andrewlock commented Feb 18, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6678 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.119
  • All benchmarks have the same 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 7.89μs 43.6ns 276ns 0.0158 0.0079 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.2μs 50.9ns 288ns 0.0153 0.00511 0 5.81 KB
master StartStopWithChild net472 16μs 51.8ns 201ns 1.04 0.299 0.102 6.21 KB
#6678 StartStopWithChild net6.0 8.2μs 46.8ns 347ns 0.0169 0.00847 0 5.61 KB
#6678 StartStopWithChild netcoreapp3.1 10.2μs 52.1ns 260ns 0.0253 0.0101 0 5.79 KB
#6678 StartStopWithChild net472 16.1μs 31.5ns 118ns 1.04 0.305 0.0962 6.21 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 494μs 481ns 1.86μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 650μs 506ns 1.96μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 849μs 437ns 1.69μs 0.422 0 0 3.3 KB
#6678 WriteAndFlushEnrichedTraces net6.0 488μs 645ns 2.41μs 0 0 0 2.7 KB
#6678 WriteAndFlushEnrichedTraces netcoreapp3.1 708μs 595ns 2.31μs 0 0 0 2.7 KB
#6678 WriteAndFlushEnrichedTraces net472 839μs 479ns 1.86μs 0.422 0 0 3.3 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 128μs 293ns 1.14μs 0.194 0 0 14.47 KB
master SendRequest netcoreapp3.1 150μs 224ns 866ns 0.223 0 0 17.27 KB
master SendRequest net472 0.000437ns 0.0002ns 0.000749ns 0 0 0 0 b
#6678 SendRequest net6.0 132μs 604ns 2.34μs 0.195 0 0 14.47 KB
#6678 SendRequest netcoreapp3.1 148μs 184ns 714ns 0.222 0 0 17.27 KB
#6678 SendRequest net472 0ns 0ns 0ns 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 575μs 2.71μs 14.1μs 0.584 0 0 41.6 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 669μs 3.5μs 16.4μs 0.334 0 0 41.58 KB
master WriteAndFlushEnrichedTraces net472 867μs 2.58μs 10μs 8.08 2.55 0.425 53.28 KB
#6678 WriteAndFlushEnrichedTraces net6.0 573μs 3.2μs 20.5μs 0.553 0 0 41.6 KB
#6678 WriteAndFlushEnrichedTraces netcoreapp3.1 675μs 3.8μs 29.2μs 0.324 0 0 41.56 KB
#6678 WriteAndFlushEnrichedTraces net472 872μs 2.67μs 9.98μs 8.39 2.52 0.419 53.36 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.44μs 1.36ns 5.27ns 0.0144 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.73μs 1.18ns 4.24ns 0.0139 0 0 1.02 KB
master ExecuteNonQuery net472 2.02μs 1.52ns 5.87ns 0.156 0.00101 0 987 B
#6678 ExecuteNonQuery net6.0 1.35μs 1.29ns 5ns 0.0141 0 0 1.02 KB
#6678 ExecuteNonQuery netcoreapp3.1 1.77μs 2.1ns 8.13ns 0.0133 0 0 1.02 KB
#6678 ExecuteNonQuery net472 2.15μs 2.49ns 9.64ns 0.157 0.00107 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.28μs 0.484ns 1.81ns 0.0137 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.58μs 1.19ns 4.61ns 0.0134 0 0 976 B
master CallElasticsearch net472 2.57μs 2.42ns 9.36ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.35μs 0.691ns 2.59ns 0.0129 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.76μs 0.571ns 2.21ns 0.014 0 0 1.02 KB
master CallElasticsearchAsync net472 2.7μs 1.99ns 7.43ns 0.167 0 0 1.05 KB
#6678 CallElasticsearch net6.0 1.31μs 0.781ns 3.02ns 0.0137 0 0 976 B
#6678 CallElasticsearch netcoreapp3.1 1.56μs 2.76ns 10.3ns 0.0131 0 0 976 B
#6678 CallElasticsearch net472 2.53μs 3.19ns 11ns 0.158 0 0 995 B
#6678 CallElasticsearchAsync net6.0 1.38μs 3.85ns 14.9ns 0.0132 0 0 952 B
#6678 CallElasticsearchAsync netcoreapp3.1 1.77μs 1.02ns 3.67ns 0.0141 0 0 1.02 KB
#6678 CallElasticsearchAsync net472 2.55μs 1.27ns 4.92ns 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.32μs 0.689ns 2.58ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.6μs 0.877ns 3.28ns 0.0129 0 0 952 B
master ExecuteAsync net472 1.86μs 0.36ns 1.4ns 0.145 0 0 915 B
#6678 ExecuteAsync net6.0 1.3μs 0.801ns 3ns 0.0131 0 0 952 B
#6678 ExecuteAsync netcoreapp3.1 1.66μs 1.49ns 5.77ns 0.0124 0 0 952 B
#6678 ExecuteAsync net472 1.84μs 0.357ns 1.38ns 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.31μs 1.93ns 7.46ns 0.0323 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.33μs 2.69ns 10.1ns 0.0373 0 0 2.85 KB
master SendAsync net472 7.53μs 3.34ns 12.5ns 0.495 0 0 3.12 KB
#6678 SendAsync net6.0 4.41μs 1.22ns 4.55ns 0.0324 0 0 2.31 KB
#6678 SendAsync netcoreapp3.1 5.35μs 2.18ns 8.15ns 0.0375 0 0 2.85 KB
#6678 SendAsync net472 7.52μs 1.9ns 7.35ns 0.493 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.5μs 0.832ns 3.22ns 0.0231 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.32μs 0.732ns 2.74ns 0.0219 0 0 1.64 KB
master EnrichedLog net472 2.57μs 1.41ns 5.27ns 0.249 0 0 1.57 KB
#6678 EnrichedLog net6.0 1.48μs 1.74ns 6.72ns 0.0229 0 0 1.64 KB
#6678 EnrichedLog netcoreapp3.1 2.31μs 3.04ns 11.4ns 0.0228 0 0 1.64 KB
#6678 EnrichedLog net472 2.59μs 4.1ns 15.9ns 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 114μs 140ns 544ns 0.0566 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 118μs 192ns 742ns 0.0593 0 0 4.28 KB
master EnrichedLog net472 150μs 230ns 889ns 0.671 0.224 0 4.46 KB
#6678 EnrichedLog net6.0 114μs 147ns 570ns 0 0 0 4.28 KB
#6678 EnrichedLog netcoreapp3.1 120μs 178ns 691ns 0.0603 0 0 4.28 KB
#6678 EnrichedLog net472 149μs 157ns 609ns 0.671 0.224 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.18μs 0.636ns 2.46ns 0.0302 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.13μs 1.87ns 6.74ns 0.0288 0 0 2.2 KB
master EnrichedLog net472 4.85μs 0.943ns 3.65ns 0.32 0 0 2.02 KB
#6678 EnrichedLog net6.0 3.07μs 0.763ns 2.96ns 0.0307 0 0 2.2 KB
#6678 EnrichedLog netcoreapp3.1 4.17μs 2.76ns 10.7ns 0.0294 0 0 2.2 KB
#6678 EnrichedLog net472 4.95μs 1.05ns 3.65ns 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.39μs 0.877ns 3.39ns 0.0159 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.76μs 2.82ns 10.9ns 0.0151 0 0 1.14 KB
master SendReceive net472 2.14μs 0.889ns 3.21ns 0.183 0 0 1.16 KB
#6678 SendReceive net6.0 1.26μs 0.704ns 2.64ns 0.0158 0 0 1.14 KB
#6678 SendReceive netcoreapp3.1 1.87μs 0.669ns 2.5ns 0.0149 0 0 1.14 KB
#6678 SendReceive net472 2.04μs 1.63ns 6.11ns 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.8μs 0.939ns 3.64ns 0.0224 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.91μs 0.879ns 3.29ns 0.0214 0 0 1.65 KB
master EnrichedLog net472 4.36μs 2.64ns 9.87ns 0.322 0 0 2.04 KB
#6678 EnrichedLog net6.0 2.82μs 1.26ns 4.88ns 0.0226 0 0 1.6 KB
#6678 EnrichedLog netcoreapp3.1 3.98μs 0.957ns 3.58ns 0.0219 0 0 1.65 KB
#6678 EnrichedLog net472 4.38μs 3.23ns 12.5ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6678

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.119 545.05 487.30

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 426ns 0.495ns 1.92ns 0.00815 0 0 576 B
master StartFinishSpan netcoreapp3.1 571ns 0.757ns 2.73ns 0.00774 0 0 576 B
master StartFinishSpan net472 621ns 1.14ns 4.27ns 0.0918 0 0 578 B
master StartFinishScope net6.0 546ns 1.2ns 4.65ns 0.00971 0 0 696 B
master StartFinishScope netcoreapp3.1 677ns 1.26ns 4.71ns 0.00938 0 0 696 B
master StartFinishScope net472 902ns 2.37ns 9.19ns 0.104 0 0 658 B
#6678 StartFinishSpan net6.0 458ns 0.362ns 1.4ns 0.00801 0 0 576 B
#6678 StartFinishSpan netcoreapp3.1 612ns 0.582ns 2.25ns 0.00793 0 0 576 B
#6678 StartFinishSpan net472 587ns 0.432ns 1.62ns 0.0918 0 0 578 B
#6678 StartFinishScope net6.0 486ns 0.85ns 3.29ns 0.00976 0 0 696 B
#6678 StartFinishScope netcoreapp3.1 726ns 1.99ns 7.7ns 0.00914 0 0 696 B
#6678 StartFinishScope net472 860ns 0.646ns 2.5ns 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 632ns 1.06ns 4.1ns 0.00982 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 892ns 1.54ns 5.78ns 0.00948 0 0 696 B
master RunOnMethodBegin net472 1.09μs 3.31ns 12.8ns 0.104 0 0 658 B
#6678 RunOnMethodBegin net6.0 660ns 0.551ns 2.14ns 0.00971 0 0 696 B
#6678 RunOnMethodBegin netcoreapp3.1 874ns 0.479ns 1.85ns 0.00921 0 0 696 B
#6678 RunOnMethodBegin net472 1.05μs 0.667ns 2.58ns 0.104 0 0 658 B

@andrewlock andrewlock merged commit 428c2fc into master Feb 18, 2025
143 of 145 checks passed
@andrewlock andrewlock deleted the andrew/include-trimming-file-in-datadog-trace branch February 18, 2025 20:23
@github-actions github-actions bot added this to the vNext-v3 milestone Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tests unit tests, integration tests area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:enhancement Improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants