Skip to content

Add traits to exclude tests that will not run anyway #6858

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

Merged
merged 4 commits into from
Apr 22, 2025

Conversation

NachoEchevarria
Copy link
Contributor

@NachoEchevarria NachoEchevarria commented Apr 15, 2025

Summary of changes

Some tests launch SkipException when run under a certain OS but have no traits to exclude it's execution in the CI.
While the impact of these tests is low, adding these traits is recommended because:

  • It avoids launching tests that just throw an exception
  • It makes the logs cleaner
  • If a class contains no tests that should be run under a certain OS, we avoid calling the class constructor code by using traits.

Reason for change

Implementation details

Test coverage

Other details

@github-actions github-actions bot added the area:tests unit tests, integration tests label Apr 15, 2025
@andrewlock
Copy link
Member

andrewlock commented Apr 15, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6858 compared to master:

  • All benchmarks have the same speed
  • 2 benchmarks have fewer allocations
  • 2 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 ✔️ More allocations ⚠️

More allocations ⚠️ in #6858

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.74 KB 5.78 KB 43 B 0.75%

Fewer allocations 🎉 in #6858

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net6.0 5.58 KB 5.44 KB -133 B -2.38%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.7μs 92.1ns 921ns 0 0 0 5.58 KB
master StartStopWithChild netcoreapp3.1 10.4μs 137ns 1.37μs 0 0 0 5.74 KB
master StartStopWithChild net472 15.4μs 88.9ns 749ns 0.946 0.291 0 6.15 KB
#6858 StartStopWithChild net6.0 8.56μs 139ns 1.39μs 0 0 0 5.44 KB
#6858 StartStopWithChild netcoreapp3.1 10.3μs 97.4ns 954ns 0 0 0 5.78 KB
#6858 StartStopWithChild net472 14.9μs 75.8ns 363ns 1.04 0.318 0.0796 6.13 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #6858

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.31 KB 3.35 KB 34 B 1.03%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 488μs 1.37μs 5.14μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 652μs 868ns 3.25μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 834μs 507ns 1.76μs 0 0 0 3.31 KB
#6858 WriteAndFlushEnrichedTraces net6.0 724μs 22.9μs 229μs 0 0 0 2.71 KB
#6858 WriteAndFlushEnrichedTraces netcoreapp3.1 662μs 1.05μs 4.08μs 0 0 0 2.7 KB
#6858 WriteAndFlushEnrichedTraces net472 849μs 426ns 1.54μs 0 0 0 3.35 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #6858

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AspNetCoreBenchmark.SendRequest‑net6.0 14.65 KB 14.48 KB -170 B -1.16%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 137μs 1.12μs 11μs 0 0 0 14.65 KB
master SendRequest netcoreapp3.1 144μs 610ns 3.05μs 0 0 0 17.28 KB
master SendRequest net472 5.34E‑05ns 3.61E‑05ns 0.000125ns 0 0 0 0 b
#6858 SendRequest net6.0 124μs 722ns 6.38μs 0 0 0 14.48 KB
#6858 SendRequest netcoreapp3.1 140μs 784ns 5.26μs 0 0 0 17.28 KB
#6858 SendRequest net472 0.00345ns 0.00119ns 0.00462ns 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 589μs 4.55μs 44.5μs 0 0 0 41.66 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 685μs 5.27μs 50.3μs 0 0 0 41.74 KB
master WriteAndFlushEnrichedTraces net472 872μs 5.22μs 51.7μs 8.33 4.17 0 53.42 KB
#6858 WriteAndFlushEnrichedTraces net6.0 567μs 3.73μs 36μs 0 0 0 41.63 KB
#6858 WriteAndFlushEnrichedTraces netcoreapp3.1 741μs 7.86μs 75.8μs 0 0 0 41.68 KB
#6858 WriteAndFlushEnrichedTraces net472 881μs 7.12μs 70.8μs 7.81 3.91 0 53.44 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.25μs 4.12ns 15.9ns 0.0124 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 1.81μs 7.05ns 26.4ns 0.00895 0 0 1.02 KB
master ExecuteNonQuery net472 2.08μs 2.8ns 10.8ns 0.156 0.0104 0 995 B
#6858 ExecuteNonQuery net6.0 1.36μs 3.41ns 13.2ns 0.0135 0 0 1.03 KB
#6858 ExecuteNonQuery netcoreapp3.1 1.81μs 1.86ns 6.44ns 0.00926 0 0 1.02 KB
#6858 ExecuteNonQuery net472 2.13μs 3.53ns 13.2ns 0.149 0.0106 0 995 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.32μs 1.26ns 4.73ns 0.0136 0 0 984 B
master CallElasticsearch netcoreapp3.1 1.64μs 1.09ns 4.23ns 0.00829 0 0 984 B
master CallElasticsearch net472 2.5μs 1.46ns 5.66ns 0.15 0 0 1 KB
master CallElasticsearchAsync net6.0 1.2μs 1.31ns 4.89ns 0.0121 0 0 960 B
master CallElasticsearchAsync netcoreapp3.1 1.59μs 0.742ns 2.77ns 0.008 0 0 1.03 KB
master CallElasticsearchAsync net472 2.66μs 3.28ns 12.3ns 0.159 0 0 1.06 KB
#6858 CallElasticsearch net6.0 1.25μs 1.01ns 3.78ns 0.0124 0 0 984 B
#6858 CallElasticsearch netcoreapp3.1 1.61μs 0.588ns 2.2ns 0.00812 0 0 984 B
#6858 CallElasticsearch net472 2.68μs 1.65ns 6.19ns 0.148 0 0 1 KB
#6858 CallElasticsearchAsync net6.0 1.21μs 0.755ns 2.92ns 0.0121 0 0 960 B
#6858 CallElasticsearchAsync netcoreapp3.1 1.76μs 0.806ns 2.91ns 0.00872 0 0 1.03 KB
#6858 CallElasticsearchAsync net472 2.7μs 2.19ns 8.5ns 0.162 0 0 1.06 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.25μs 1.27ns 4.75ns 0.0126 0 0 960 B
master ExecuteAsync netcoreapp3.1 1.58μs 1.45ns 5.41ns 0.0079 0 0 960 B
master ExecuteAsync net472 1.81μs 1.39ns 5.4ns 0.145 0 0 923 B
#6858 ExecuteAsync net6.0 1.26μs 1.34ns 5.2ns 0.0127 0 0 960 B
#6858 ExecuteAsync netcoreapp3.1 1.61μs 1.63ns 6.33ns 0.00813 0 0 960 B
#6858 ExecuteAsync net472 1.82μs 0.712ns 2.76ns 0.145 0 0 923 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.43μs 4.4ns 17ns 0.0221 0 0 2.32 KB
master SendAsync netcoreapp3.1 5.35μs 5.21ns 19.5ns 0.027 0 0 2.86 KB
master SendAsync net472 7.46μs 3.75ns 14ns 0.485 0 0 3.13 KB
#6858 SendAsync net6.0 4.36μs 2.48ns 9.59ns 0.0222 0 0 2.32 KB
#6858 SendAsync netcoreapp3.1 5.44μs 2.01ns 7.51ns 0.0275 0 0 2.86 KB
#6858 SendAsync net472 7.48μs 5.44ns 20.4ns 0.487 0 0 3.13 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.52μs 1ns 3.62ns 0.0229 0 0 1.71 KB
master EnrichedLog netcoreapp3.1 2.29μs 1.25ns 4.68ns 0.0231 0 0 1.71 KB
master EnrichedLog net472 2.75μs 2.36ns 9.12ns 0.26 0 0 1.64 KB
#6858 EnrichedLog net6.0 1.56μs 1.57ns 6.07ns 0.0234 0 0 1.71 KB
#6858 EnrichedLog netcoreapp3.1 2.22μs 2.43ns 9.08ns 0.0218 0 0 1.71 KB
#6858 EnrichedLog net472 2.74μs 2.23ns 8.05ns 0.248 0 0 1.64 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 112μs 219ns 821ns 0 0 0 4.32 KB
master EnrichedLog netcoreapp3.1 117μs 329ns 1.27μs 0 0 0 4.32 KB
master EnrichedLog net472 150μs 87.1ns 326ns 0 0 0 4.51 KB
#6858 EnrichedLog net6.0 115μs 318ns 1.23μs 0 0 0 4.32 KB
#6858 EnrichedLog netcoreapp3.1 118μs 257ns 994ns 0 0 0 4.32 KB
#6858 EnrichedLog net472 150μs 130ns 504ns 0 0 0 4.51 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.1μs 1.83ns 7.11ns 0.0309 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 4.43μs 3.42ns 12.3ns 0.0221 0 0 2.26 KB
master EnrichedLog net472 4.98μs 2.25ns 8.4ns 0.326 0 0 2.09 KB
#6858 EnrichedLog net6.0 3.04μs 1.43ns 5.55ns 0.0304 0 0 2.26 KB
#6858 EnrichedLog netcoreapp3.1 4.3μs 5.27ns 20.4ns 0.0214 0 0 2.26 KB
#6858 EnrichedLog net472 4.61μs 2.51ns 9.4ns 0.322 0 0 2.09 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 1.01ns 3.92ns 0.0138 0 0 1.15 KB
master SendReceive netcoreapp3.1 1.78μs 1.16ns 4.35ns 0.00894 0 0 1.15 KB
master SendReceive net472 2.21μs 1.37ns 5.29ns 0.175 0 0 1.16 KB
#6858 SendReceive net6.0 1.37μs 0.968ns 3.62ns 0.0137 0 0 1.15 KB
#6858 SendReceive netcoreapp3.1 1.84μs 1.87ns 6.99ns 0.00918 0 0 1.15 KB
#6858 SendReceive net472 2.05μs 2.24ns 8.37ns 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.86μs 2.11ns 7.59ns 0.0143 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 4μs 3.41ns 12.8ns 0.0201 0 0 1.69 KB
master EnrichedLog net472 4.54μs 3.09ns 11.5ns 0.318 0 0 2.08 KB
#6858 EnrichedLog net6.0 2.7μs 2.06ns 7.99ns 0.0134 0 0 1.64 KB
#6858 EnrichedLog netcoreapp3.1 3.98μs 2.93ns 11ns 0.0199 0 0 1.69 KB
#6858 EnrichedLog net472 4.43μs 2.63ns 10.2ns 0.309 0 0 2.08 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 400ns 0.316ns 1.22ns 0.00794 0 0 584 B
master StartFinishSpan netcoreapp3.1 581ns 0.879ns 3.4ns 0.00582 0 0 584 B
master StartFinishSpan net472 630ns 0.643ns 2.49ns 0.0911 0 0 586 B
master StartFinishScope net6.0 511ns 0.476ns 1.71ns 0.0101 0 0 704 B
master StartFinishScope netcoreapp3.1 695ns 0.72ns 2.69ns 0.00674 0 0 704 B
master StartFinishScope net472 834ns 0.401ns 1.55ns 0.104 0 0 666 B
#6858 StartFinishSpan net6.0 405ns 0.367ns 1.32ns 0.00615 0 0 584 B
#6858 StartFinishSpan netcoreapp3.1 582ns 0.622ns 2.41ns 0.00585 0 0 584 B
#6858 StartFinishSpan net472 619ns 0.351ns 1.31ns 0.093 0 0 586 B
#6858 StartFinishScope net6.0 515ns 0.544ns 2.11ns 0.00772 0 0 704 B
#6858 StartFinishScope netcoreapp3.1 702ns 0.525ns 2.03ns 0.00716 0 0 704 B
#6858 StartFinishScope net472 818ns 0.332ns 1.24ns 0.103 0 0 666 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 754ns 0.674ns 2.61ns 0.00754 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 942ns 0.944ns 3.66ns 0.00473 0 0 704 B
master RunOnMethodBegin net472 1.13μs 1.52ns 5.88ns 0.103 0 0 666 B
#6858 RunOnMethodBegin net6.0 830ns 0.657ns 2.46ns 0.00801 0 0 704 B
#6858 RunOnMethodBegin netcoreapp3.1 919ns 1.18ns 4.59ns 0.00923 0 0 704 B
#6858 RunOnMethodBegin net472 1.04μs 0.753ns 2.92ns 0.103 0 0 666 B

@andrewlock
Copy link
Member

andrewlock commented Apr 15, 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 (6858) - mean (70ms)  : 67, 72
     .   : milestone, 70,
    master - mean (70ms)  : 66, 74
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6858) - mean (1,010ms)  : 978, 1042
     .   : milestone, 1010,
    master - mean (1,007ms)  : 987, 1026
     .   : milestone, 1007,

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

    section CallTarget+Inlining+NGEN
    This PR (6858) - mean (696ms)  : 679, 713
     .   : milestone, 696,
    master - mean (696ms)  : 678, 714
     .   : milestone, 696,

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

    section CallTarget+Inlining+NGEN
    This PR (6858) - mean (650ms)  : 629, 671
     .   : milestone, 650,
    master - mean (656ms)  : 639, 673
     .   : milestone, 656,

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

    section CallTarget+Inlining+NGEN
    This PR (6858) - mean (1,108ms)  : 1085, 1130
     .   : milestone, 1108,
    master - mean (1,110ms)  : 1076, 1145
     .   : milestone, 1110,

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

    section CallTarget+Inlining+NGEN
    This PR (6858) - mean (878ms)  : 851, 904
     .   : milestone, 878,
    master - mean (884ms)  : 847, 921
     .   : milestone, 884,

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

    section CallTarget+Inlining+NGEN
    This PR (6858) - mean (866ms)  : 835, 897
     .   : milestone, 866,
    master - mean (874ms)  : 849, 899
     .   : milestone, 874,

Loading

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 15, 2025

Datadog Report

Branch report: nacho/ExcludeNotRunningTests
Commit report: 811e8b0
Test service: dd-trace-dotnet

✅ 0 Failed, 255791 Passed, 2248 Skipped, 20h 28m 20.51s Total Time

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Apr 15, 2025

Datadog Report

Branch report: nacho/ExcludeNotRunningTests
Commit report: 77d31c2
Test service: dd-trace-dotnet

✅ 0 Failed, 4 Passed, 0 Skipped, 0s Total Time

@NachoEchevarria NachoEchevarria marked this pull request as ready for review April 16, 2025 09:09
@NachoEchevarria NachoEchevarria requested review from a team as code owners April 16, 2025 09:09
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

👍

@NachoEchevarria NachoEchevarria merged commit cf7b5c3 into master Apr 22, 2025
124 of 127 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/ExcludeNotRunningTests branch April 22, 2025 10:19
@github-actions github-actions bot added this to the vNext-v3 milestone Apr 22, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants