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

Fix NoWarn for Datadog.Trace and Trimming #6745

Merged
merged 2 commits into from
Mar 7, 2025
Merged

Conversation

bouwkast
Copy link
Contributor

@bouwkast bouwkast commented Mar 5, 2025

Summary of changes

They were lacking $(NoWarn) and when installed would override any Directory.Build.props that had NoWarn set.

This depended / required on when MSBuild would evaluate the properties.

Reason for change

We shouldn't overwrite these.

Implementation details

Added $(NoWarn)

Test coverage

Reproduced locally:

Added a Directory.Build.props in a different project then installed Datadog.Trace as a NuGet

<Project>
  <PropertyGroup>
    <NoWarn>$(NoWarn);CA2200</NoWarn>
  </PropertyGroup>
</Project>

Created a warning like so

            try
            {
                return true;
            }
            catch (Exception e)
            {
                throw e;
            }

Warning not ignored.

Other details

Fixes #6742

They were lacking $(NoWarn) and when installed would
override any Directory.Build.props that had NoWarn set.

This depended / required on when MSBuild would evaulate
the properties.
@bouwkast bouwkast requested a review from a team as a code owner March 5, 2025 16:24
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Mar 5, 2025

Datadog Report

Branch report: steven/fix-no-warn
Commit report: 3466b67
Test service: dd-trace-dotnet

✅ 0 Failed, 257110 Passed, 2421 Skipped, 19h 38m 30.12s Total Time

@andrewlock
Copy link
Member

andrewlock commented Mar 5, 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 (6745) - mean (70ms)  : 66, 73
     .   : milestone, 70,
    master - mean (70ms)  : 66, 73
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6745) - mean (1,006ms)  : 986, 1025
     .   : milestone, 1006,
    master - mean (1,004ms)  : 982, 1026
     .   : milestone, 1004,

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

    section CallTarget+Inlining+NGEN
    This PR (6745) - mean (692ms)  : 673, 711
     .   : milestone, 692,
    master - mean (688ms)  : 670, 706
     .   : milestone, 688,

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

    section CallTarget+Inlining+NGEN
    This PR (6745) - mean (643ms)  : 626, 660
     .   : milestone, 643,
    master - mean (644ms)  : 625, 662
     .   : milestone, 644,

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

    section CallTarget+Inlining+NGEN
    This PR (6745) - mean (1,106ms)  : 1082, 1131
     .   : milestone, 1106,
    master - mean (1,105ms)  : 1081, 1130
     .   : milestone, 1105,

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

    section CallTarget+Inlining+NGEN
    This PR (6745) - mean (875ms)  : 843, 906
     .   : milestone, 875,
    master - mean (874ms)  : 842, 905
     .   : milestone, 874,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6745) - mean (262ms)  : 258, 266
     .   : milestone, 262,
    master - mean (261ms)  : 257, 265
     .   : milestone, 261,

    section CallTarget+Inlining+NGEN
    This PR (6745) - mean (849ms)  : 818, 879
     .   : milestone, 849,
    master - mean (856ms)  : 827, 886
     .   : milestone, 856,

Loading

@andrewlock
Copy link
Member

andrewlock commented Mar 5, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6745 compared to master:

  • 3 benchmarks are slower, with geometric mean 1.151
  • 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.55μs 49.2ns 399ns 0.0168 0.0084 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.6μs 57ns 317ns 0.0161 0.00536 0 5.8 KB
master StartStopWithChild net472 16.2μs 55.7ns 216ns 1.06 0.321 0.0962 6.21 KB
#6745 StartStopWithChild net6.0 8.4μs 48.2ns 395ns 0.0207 0.00829 0 5.61 KB
#6745 StartStopWithChild netcoreapp3.1 10.5μs 59.6ns 421ns 0.0162 0.00541 0 5.8 KB
#6745 StartStopWithChild net472 16.1μs 53.1ns 206ns 1.03 0.287 0.0958 6.21 KB
Benchmarks.Trace.AgentWriterBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6745

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.184 647,004.25 766,147.98

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 545μs 481ns 1.73μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 647μs 277ns 1.04μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 837μs 820ns 3.18μs 0.417 0 0 3.3 KB
#6745 WriteAndFlushEnrichedTraces net6.0 506μs 362ns 1.4μs 0 0 0 2.7 KB
#6745 WriteAndFlushEnrichedTraces netcoreapp3.1 766μs 482ns 1.87μs 0 0 0 2.7 KB
#6745 WriteAndFlushEnrichedTraces net472 847μs 270ns 974ns 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 134μs 224ns 867ns 0.2 0 0 14.47 KB
master SendRequest netcoreapp3.1 149μs 522ns 2.02μs 0.222 0 0 17.27 KB
master SendRequest net472 0.000677ns 0.000371ns 0.00139ns 0 0 0 0 b
#6745 SendRequest net6.0 135μs 335ns 1.3μs 0.201 0 0 14.47 KB
#6745 SendRequest netcoreapp3.1 150μs 349ns 1.35μs 0.228 0 0 17.27 KB
#6745 SendRequest net472 0.000334ns 0.00021ns 0.000815ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #6745

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.52 KB 41.78 KB 260 B 0.63%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 564μs 3.1μs 18.6μs 0.561 0 0 41.52 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 688μs 3.91μs 28.2μs 0.349 0 0 41.65 KB
master WriteAndFlushEnrichedTraces net472 859μs 3.94μs 15.8μs 8.25 2.6 0.434 53.28 KB
#6745 WriteAndFlushEnrichedTraces net6.0 612μs 3.55μs 30μs 0.558 0 0 41.78 KB
#6745 WriteAndFlushEnrichedTraces netcoreapp3.1 675μs 2.72μs 10.2μs 0.334 0 0 41.79 KB
#6745 WriteAndFlushEnrichedTraces net472 856μs 4.25μs 19μs 8.45 2.53 0.422 53.26 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.32μs 1.56ns 6.04ns 0.0139 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.83μs 2.57ns 9.97ns 0.0135 0 0 1.02 KB
master ExecuteNonQuery net472 2μs 2.75ns 10.7ns 0.156 0.000988 0 987 B
#6745 ExecuteNonQuery net6.0 1.26μs 1.15ns 4.15ns 0.0145 0 0 1.02 KB
#6745 ExecuteNonQuery netcoreapp3.1 1.76μs 1.5ns 5.41ns 0.0132 0 0 1.02 KB
#6745 ExecuteNonQuery net472 2.07μs 1.92ns 7.42ns 0.156 0.00103 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.19μs 0.604ns 2.18ns 0.0136 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.55μs 1.37ns 5.29ns 0.0132 0 0 976 B
master CallElasticsearch net472 2.46μs 1.15ns 4.32ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.23μs 0.855ns 3.31ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.63μs 0.777ns 2.91ns 0.0129 0 0 1.02 KB
master CallElasticsearchAsync net472 2.66μs 0.442ns 1.59ns 0.166 0 0 1.05 KB
#6745 CallElasticsearch net6.0 1.32μs 0.627ns 2.26ns 0.0136 0 0 976 B
#6745 CallElasticsearch netcoreapp3.1 1.55μs 1.25ns 4.67ns 0.0131 0 0 976 B
#6745 CallElasticsearch net472 2.46μs 0.927ns 3.34ns 0.158 0 0 995 B
#6745 CallElasticsearchAsync net6.0 1.35μs 0.846ns 3.16ns 0.0135 0 0 952 B
#6745 CallElasticsearchAsync netcoreapp3.1 1.7μs 1.62ns 6.06ns 0.0134 0 0 1.02 KB
#6745 CallElasticsearchAsync net472 2.52μs 0.71ns 2.66ns 0.167 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.31μs 0.379ns 1.37ns 0.0134 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.54μs 0.406ns 1.57ns 0.0123 0 0 952 B
master ExecuteAsync net472 1.82μs 0.663ns 2.48ns 0.145 0 0 915 B
#6745 ExecuteAsync net6.0 1.29μs 0.431ns 1.49ns 0.0135 0 0 952 B
#6745 ExecuteAsync netcoreapp3.1 1.65μs 0.522ns 1.88ns 0.0133 0 0 952 B
#6745 ExecuteAsync net472 1.89μs 0.414ns 1.55ns 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.52μs 2.28ns 8.83ns 0.0317 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.33μs 2.32ns 8.69ns 0.0374 0 0 2.85 KB
master SendAsync net472 7.58μs 2.23ns 8.63ns 0.495 0 0 3.12 KB
#6745 SendAsync net6.0 4.38μs 12.8ns 49.4ns 0.0326 0 0 2.31 KB
#6745 SendAsync netcoreapp3.1 5.32μs 3.14ns 12.2ns 0.0371 0 0 2.85 KB
#6745 SendAsync net472 7.42μs 2.68ns 10ns 0.495 0 0 3.12 KB
Benchmarks.Trace.ILoggerBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6745

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.117 1,455.21 1,624.86

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.46μs 0.721ns 2.7ns 0.0226 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.21μs 1.5ns 5.61ns 0.0221 0 0 1.64 KB
master EnrichedLog net472 2.57μs 0.925ns 3.58ns 0.249 0 0 1.57 KB
#6745 EnrichedLog net6.0 1.63μs 1.71ns 6.39ns 0.0227 0 0 1.64 KB
#6745 EnrichedLog netcoreapp3.1 2.1μs 1.2ns 4.65ns 0.0225 0 0 1.64 KB
#6745 EnrichedLog net472 2.56μs 0.976ns 3.65ns 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 113μs 125ns 485ns 0.0565 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 117μs 269ns 1.04μs 0.058 0 0 4.28 KB
master EnrichedLog net472 149μs 119ns 459ns 0.67 0.223 0 4.46 KB
#6745 EnrichedLog net6.0 113μs 186ns 696ns 0 0 0 4.28 KB
#6745 EnrichedLog netcoreapp3.1 117μs 276ns 1.07μs 0 0 0 4.28 KB
#6745 EnrichedLog net472 151μs 110ns 425ns 0.682 0.227 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.07μs 0.605ns 2.18ns 0.0305 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.24μs 1.06ns 3.95ns 0.0299 0 0 2.2 KB
master EnrichedLog net472 4.82μs 1.12ns 4.34ns 0.319 0 0 2.02 KB
#6745 EnrichedLog net6.0 3.04μs 1.15ns 4.47ns 0.0302 0 0 2.2 KB
#6745 EnrichedLog netcoreapp3.1 4.21μs 1.37ns 5.32ns 0.0294 0 0 2.2 KB
#6745 EnrichedLog net472 4.86μs 1.68ns 6.51ns 0.32 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.32μs 1.3ns 5.03ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.77μs 1.98ns 7.66ns 0.015 0 0 1.14 KB
master SendReceive net472 2.08μs 1.79ns 6.93ns 0.184 0 0 1.16 KB
#6745 SendReceive net6.0 1.4μs 0.499ns 1.87ns 0.0161 0 0 1.14 KB
#6745 SendReceive netcoreapp3.1 1.77μs 0.669ns 2.41ns 0.0151 0 0 1.14 KB
#6745 SendReceive net472 2.14μs 0.873ns 3.38ns 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.72μs 0.995ns 3.86ns 0.0218 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.91μs 1.19ns 4.46ns 0.0214 0 0 1.65 KB
master EnrichedLog net472 4.23μs 2.68ns 10ns 0.323 0 0 2.04 KB
#6745 EnrichedLog net6.0 2.71μs 0.999ns 3.87ns 0.0218 0 0 1.6 KB
#6745 EnrichedLog netcoreapp3.1 4.09μs 1.67ns 6.24ns 0.0225 0 0 1.65 KB
#6745 EnrichedLog net472 4.21μs 2.62ns 10.1ns 0.322 0 0 2.04 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 409ns 0.0715ns 0.267ns 0.00811 0 0 576 B
master StartFinishSpan netcoreapp3.1 602ns 0.432ns 1.67ns 0.00785 0 0 576 B
master StartFinishSpan net472 659ns 0.167ns 0.626ns 0.0918 0 0 578 B
master StartFinishScope net6.0 522ns 0.215ns 0.803ns 0.00979 0 0 696 B
master StartFinishScope netcoreapp3.1 701ns 0.744ns 2.78ns 0.00936 0 0 696 B
master StartFinishScope net472 822ns 0.815ns 3.16ns 0.104 0 0 658 B
#6745 StartFinishSpan net6.0 402ns 0.126ns 0.486ns 0.00815 0 0 576 B
#6745 StartFinishSpan netcoreapp3.1 576ns 2.06ns 7.99ns 0.00762 0 0 576 B
#6745 StartFinishSpan net472 722ns 0.266ns 0.994ns 0.0918 0 0 578 B
#6745 StartFinishScope net6.0 481ns 0.169ns 0.608ns 0.00984 0 0 696 B
#6745 StartFinishScope netcoreapp3.1 722ns 0.433ns 1.68ns 0.0094 0 0 696 B
#6745 StartFinishScope net472 907ns 0.61ns 2.36ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6745

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.152 606.20 698.48

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 606ns 0.195ns 0.756ns 0.00974 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 961ns 0.384ns 1.49ns 0.00932 0 0 696 B
master RunOnMethodBegin net472 1.06μs 0.562ns 2.1ns 0.104 0 0 658 B
#6745 RunOnMethodBegin net6.0 698ns 0.343ns 1.28ns 0.0098 0 0 696 B
#6745 RunOnMethodBegin netcoreapp3.1 1.04μs 0.832ns 3.22ns 0.00934 0 0 696 B
#6745 RunOnMethodBegin net472 1.07μs 0.308ns 1.15ns 0.104 0 0 658 B

@lucaspimentel
Copy link
Member

lucaspimentel commented Mar 7, 2025

Should we fix all of them? I did a quick search and found a few more:

  • tracer/Directory.Build.props
  • tracer/src/Datadog.Trace.Bundle/Datadog.Trace.Bundle.csproj
  • tracer/src/Datadog.Trace.BenchmarkDotNet/Datadog.Trace.BenchmarkDotNet.csproj
  • ...

(can be a separate PR if you want to merge this one quickly)

@lucaspimentel lucaspimentel added the area:builds project files, build scripts, pipelines, versioning, releases, packages label Mar 7, 2025
@bouwkast bouwkast requested a review from a team as a code owner March 7, 2025 15:18
@bouwkast
Copy link
Contributor Author

bouwkast commented Mar 7, 2025

Should we fix all of them? I did a quick search and found a few more:

Ah yeah good point, I didn't have those loaded so VS didn't show them, added those three - unsure fi there are others that would impact others but can come back later to just add it to all.

(edited formatting - Lucas)

@bouwkast bouwkast merged commit 3e0a933 into master Mar 7, 2025
144 of 146 checks passed
@bouwkast bouwkast deleted the steven/fix-no-warn branch March 7, 2025 19:40
@github-actions github-actions bot added this to the vNext-v3 milestone Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:builds project files, build scripts, pipelines, versioning, releases, packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: 3.11.0+ unconditionally overwrites NoWarn settings via Datadog.Trace.props
4 participants