Skip to content

Disable the locked tracer in the runner integration tests #6532

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 1 commit into from
Jan 13, 2025

Conversation

kevingosse
Copy link
Contributor

@kevingosse kevingosse commented Jan 13, 2025

Summary of changes

Disable the locked tracer globally in the runner integration tests.

Reason for change

The locked tracer was already disabled in CiRunCommandTests, but it turns out there are other tests that require to disable it (we just got lucky with the ordering). Rather than discovering them one by one, let's just disable it globally.

Implementation details

Also added the proper xunit.runner.json file to have more info on the running tests in the CI.

Other details

Discovered while trying to randomize the order of the tests.

@kevingosse kevingosse requested a review from a team as a code owner January 13, 2025 09:53
@kevingosse kevingosse changed the title UseLockedTracerManager Use the locked tracer in the runner integration tests Jan 13, 2025
@kevingosse kevingosse added the area:tests unit tests, integration tests label Jan 13, 2025
@kevingosse kevingosse changed the title Use the locked tracer in the runner integration tests Don't use the locked tracer in the runner integration tests Jan 13, 2025
@kevingosse kevingosse changed the title Don't use the locked tracer in the runner integration tests Disable the locked tracer in the runner integration tests Jan 13, 2025
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.

Just for clarity

  • The locked tracer means you can't replace the global tracer instance
  • There are multiple tests that require replacing the global tracer instance.
  • Therefore we can't use the locked tracer at all for these tests (in general)
  • We also must make sure they run sequentially and not in parallel

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jan 13, 2025

Datadog Report

Branch report: kevin/locked_tracer
Commit report: e1a3564
Test service: dd-trace-dotnet

✅ 0 Failed, 241901 Passed, 1964 Skipped, 18h 49m 31.14s Total Time

@andrewlock
Copy link
Member

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 (6532) - mean (69ms)  : 66, 71
     .   : milestone, 69,
    master - mean (69ms)  : 63, 75
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6532) - mean (982ms)  : 956, 1009
     .   : milestone, 982,
    master - mean (973ms)  : 953, 993
     .   : milestone, 973,

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

    section CallTarget+Inlining+NGEN
    This PR (6532) - mean (673ms)  : 656, 690
     .   : milestone, 673,
    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 (6532) - mean (91ms)  : 89, 93
     .   : milestone, 91,
    master - mean (91ms)  : 88, 93
     .   : milestone, 91,

    section CallTarget+Inlining+NGEN
    This PR (6532) - mean (633ms)  : 618, 648
     .   : milestone, 633,
    master - mean (632ms)  : 618, 646
     .   : milestone, 632,

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

    section CallTarget+Inlining+NGEN
    This PR (6532) - mean (1,100ms)  : 1070, 1129
     .   : milestone, 1100,
    master - mean (1,096ms)  : 1070, 1123
     .   : milestone, 1096,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6532) - mean (279ms)  : 274, 283
     .   : milestone, 279,
    master - mean (278ms)  : 272, 284
     .   : milestone, 278,

    section CallTarget+Inlining+NGEN
    This PR (6532) - mean (871ms)  : 843, 900
     .   : milestone, 871,
    master - mean (870ms)  : 843, 897
     .   : milestone, 870,

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

    section CallTarget+Inlining+NGEN
    This PR (6532) - mean (842ms)  : 809, 875
     .   : milestone, 842,
    master - mean (854ms)  : 816, 892
     .   : milestone, 854,

Loading

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6532 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.113
  • 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 8.29μs 38.2ns 153ns 0.0165 0.00827 0 5.62 KB
master StartStopWithChild netcoreapp3.1 10.1μs 51ns 222ns 0.0147 0.00491 0 5.8 KB
master StartStopWithChild net472 16.4μs 44ns 170ns 1.04 0.299 0.097 6.21 KB
#6532 StartStopWithChild net6.0 8.01μs 44.8ns 290ns 0.0123 0.00821 0 5.61 KB
#6532 StartStopWithChild netcoreapp3.1 10.1μs 57.3ns 384ns 0.0203 0.0102 0 5.8 KB
#6532 StartStopWithChild net472 16.3μs 46ns 178ns 1.04 0.316 0.0972 6.19 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 490μs 248ns 927ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 665μs 358ns 1.39μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 858μs 570ns 2.21μs 0.428 0 0 3.3 KB
#6532 WriteAndFlushEnrichedTraces net6.0 489μs 274ns 1.06μs 0 0 0 2.7 KB
#6532 WriteAndFlushEnrichedTraces netcoreapp3.1 654μs 510ns 1.97μs 0 0 0 2.7 KB
#6532 WriteAndFlushEnrichedTraces net472 843μs 388ns 1.45μs 0.419 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 152μs 878ns 7.66μs 0.157 0 0 14.47 KB
master SendRequest netcoreapp3.1 173μs 1.04μs 10.3μs 0.162 0 0 17.27 KB
master SendRequest net472 0.0047ns 0.00128ns 0.00479ns 0 0 0 0 b
#6532 SendRequest net6.0 153μs 893ns 8.09μs 0.138 0 0 14.47 KB
#6532 SendRequest netcoreapp3.1 168μs 976ns 8.46μs 0.159 0 0 17.27 KB
#6532 SendRequest net472 0.00805ns 0.00308ns 0.0111ns 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 580μs 2.98μs 14.3μs 0.598 0 0 41.43 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 657μs 2.64μs 9.87μs 0.347 0 0 41.79 KB
master WriteAndFlushEnrichedTraces net472 829μs 3.27μs 12.7μs 8.33 2.5 0.417 53.28 KB
#6532 WriteAndFlushEnrichedTraces net6.0 577μs 3.33μs 27.7μs 0.579 0 0 41.41 KB
#6532 WriteAndFlushEnrichedTraces netcoreapp3.1 719μs 4.01μs 25.7μs 0.331 0 0 41.73 KB
#6532 WriteAndFlushEnrichedTraces net472 835μs 2.17μs 8.13μs 8.33 2.5 0.417 53.27 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.3μs 1.56ns 6.04ns 0.0143 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.83μs 4ns 15.5ns 0.0136 0 0 1.02 KB
master ExecuteNonQuery net472 2.12μs 2.29ns 8.88ns 0.157 0.00105 0 987 B
#6532 ExecuteNonQuery net6.0 1.24μs 1.37ns 5.29ns 0.0143 0 0 1.02 KB
#6532 ExecuteNonQuery netcoreapp3.1 1.72μs 1.97ns 7.62ns 0.0137 0 0 1.02 KB
#6532 ExecuteNonQuery net472 2.1μs 1.98ns 7.4ns 0.157 0.00105 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.577ns 2.23ns 0.0134 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.52μs 1.07ns 4.01ns 0.0129 0 0 976 B
master CallElasticsearch net472 2.68μs 2.19ns 8.48ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.33μs 0.617ns 2.22ns 0.0132 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 2.92ns 11.3ns 0.0141 0 0 1.02 KB
master CallElasticsearchAsync net472 2.6μs 1.7ns 6.34ns 0.166 0 0 1.05 KB
#6532 CallElasticsearch net6.0 1.26μs 1.1ns 4.26ns 0.0134 0 0 976 B
#6532 CallElasticsearch netcoreapp3.1 1.58μs 0.684ns 2.56ns 0.0134 0 0 976 B
#6532 CallElasticsearch net472 2.6μs 2.11ns 7.91ns 0.157 0 0 995 B
#6532 CallElasticsearchAsync net6.0 1.4μs 2.16ns 8.36ns 0.0133 0 0 952 B
#6532 CallElasticsearchAsync netcoreapp3.1 1.64μs 0.737ns 2.76ns 0.0131 0 0 1.02 KB
#6532 CallElasticsearchAsync net472 2.61μs 2.62ns 10.1ns 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.32μs 1.08ns 4.04ns 0.0133 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.74μs 0.99ns 3.83ns 0.0128 0 0 952 B
master ExecuteAsync net472 1.79μs 0.376ns 1.46ns 0.145 0 0 915 B
#6532 ExecuteAsync net6.0 1.31μs 0.709ns 2.65ns 0.0131 0 0 952 B
#6532 ExecuteAsync netcoreapp3.1 1.62μs 0.407ns 1.47ns 0.0129 0 0 952 B
#6532 ExecuteAsync net472 1.85μs 0.413ns 1.49ns 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.41μs 1.7ns 6.6ns 0.0308 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.24μs 2.83ns 11ns 0.0394 0 0 2.85 KB
master SendAsync net472 7.34μs 1.84ns 7.11ns 0.492 0 0 3.12 KB
#6532 SendAsync net6.0 4.35μs 1.51ns 5.43ns 0.0304 0 0 2.31 KB
#6532 SendAsync netcoreapp3.1 5.26μs 2.45ns 9.49ns 0.037 0 0 2.85 KB
#6532 SendAsync net472 7.25μs 1.8ns 6.98ns 0.495 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.46μs 0.863ns 3.34ns 0.0227 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.27μs 1.14ns 4.25ns 0.0216 0 0 1.64 KB
master EnrichedLog net472 2.72μs 1.54ns 5.56ns 0.249 0 0 1.57 KB
#6532 EnrichedLog net6.0 1.51μs 0.625ns 2.34ns 0.0225 0 0 1.64 KB
#6532 EnrichedLog netcoreapp3.1 2.12μs 0.506ns 1.89ns 0.022 0 0 1.64 KB
#6532 EnrichedLog net472 2.57μs 2.68ns 10.4ns 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 121μs 95ns 368ns 0.0602 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 119μs 147ns 530ns 0.0599 0 0 4.28 KB
master EnrichedLog net472 151μs 321ns 1.24μs 0.671 0.224 0 4.46 KB
#6532 EnrichedLog net6.0 117μs 155ns 558ns 0 0 0 4.28 KB
#6532 EnrichedLog netcoreapp3.1 123μs 102ns 394ns 0 0 0 4.28 KB
#6532 EnrichedLog net472 152μs 152ns 588ns 0.668 0.223 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.11μs 0.716ns 2.77ns 0.0299 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.18μs 2.14ns 8.31ns 0.0292 0 0 2.2 KB
master EnrichedLog net472 5.06μs 1.46ns 5.66ns 0.32 0 0 2.02 KB
#6532 EnrichedLog net6.0 3.01μs 0.513ns 1.92ns 0.0302 0 0 2.2 KB
#6532 EnrichedLog netcoreapp3.1 4.14μs 3.33ns 12.9ns 0.0291 0 0 2.2 KB
#6532 EnrichedLog net472 4.88μs 1.21ns 4.67ns 0.321 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.997ns 3.86ns 0.0163 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.76μs 1.22ns 4.4ns 0.0158 0 0 1.14 KB
master SendReceive net472 2.1μs 0.779ns 2.91ns 0.184 0 0 1.16 KB
#6532 SendReceive net6.0 1.41μs 0.908ns 3.52ns 0.0161 0 0 1.14 KB
#6532 SendReceive netcoreapp3.1 1.83μs 2.86ns 11.1ns 0.0156 0 0 1.14 KB
#6532 SendReceive net472 2.12μs 0.792ns 3.07ns 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.79μs 0.541ns 1.95ns 0.0222 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.85μs 1.78ns 6.91ns 0.0212 0 0 1.65 KB
master EnrichedLog net472 4.3μs 2.32ns 8.98ns 0.322 0 0 2.04 KB
#6532 EnrichedLog net6.0 2.73μs 0.707ns 2.74ns 0.0217 0 0 1.6 KB
#6532 EnrichedLog netcoreapp3.1 3.99μs 1.64ns 6.36ns 0.022 0 0 1.65 KB
#6532 EnrichedLog net472 4.24μs 2.96ns 11.4ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6532

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.113 569.36 633.96

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 403ns 0.294ns 1.14ns 0.0081 0 0 576 B
master StartFinishSpan netcoreapp3.1 569ns 0.401ns 1.5ns 0.00769 0 0 576 B
master StartFinishSpan net472 710ns 0.553ns 2.14ns 0.0917 0 0 578 B
master StartFinishScope net6.0 541ns 0.262ns 1.02ns 0.00972 0 0 696 B
master StartFinishScope netcoreapp3.1 686ns 0.527ns 2.04ns 0.00938 0 0 696 B
master StartFinishScope net472 927ns 0.39ns 1.46ns 0.105 0 0 658 B
#6532 StartFinishSpan net6.0 399ns 0.249ns 0.965ns 0.00803 0 0 576 B
#6532 StartFinishSpan netcoreapp3.1 634ns 0.439ns 1.64ns 0.00799 0 0 576 B
#6532 StartFinishSpan net472 668ns 0.674ns 2.61ns 0.0917 0 0 578 B
#6532 StartFinishScope net6.0 561ns 0.415ns 1.61ns 0.00972 0 0 696 B
#6532 StartFinishScope netcoreapp3.1 723ns 0.364ns 1.36ns 0.00939 0 0 696 B
#6532 StartFinishScope net472 895ns 0.472ns 1.83ns 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 654ns 0.525ns 2.03ns 0.00982 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 873ns 0.651ns 2.52ns 0.00942 0 0 696 B
master RunOnMethodBegin net472 1.12μs 0.706ns 2.73ns 0.104 0 0 658 B
#6532 RunOnMethodBegin net6.0 663ns 0.52ns 2.01ns 0.00962 0 0 696 B
#6532 RunOnMethodBegin netcoreapp3.1 942ns 0.593ns 2.3ns 0.00911 0 0 696 B
#6532 RunOnMethodBegin net472 1.1μs 0.659ns 2.55ns 0.104 0 0 658 B

@kevingosse kevingosse merged commit 9d34d86 into master Jan 13, 2025
122 of 124 checks passed
@kevingosse kevingosse deleted the kevin/locked_tracer branch January 13, 2025 14:17
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 13, 2025
kevingosse pushed a commit that referenced this pull request Jan 16, 2025
## Summary of changes

Randomize the order of the tests.

## Reason for change

Flaky tests are much harder to fix when we discover them long after they
have been written. By randomizing the order of the tests, I'm hoping to
make them fail earlier.
In practice, this could temporarily increase the overall flakiness, but
I expect this will reduce the overall effort spent on fixing tests.

## Implementation details

In `CustomTestFramework`, randomize the list of all tests in each
collections, and the collections themselves.
The seed is displayed in the output. When a test order causes tests to
fail, this allows to deterministically reproduce that test order.

## Other details

Four other issues were found thanks to this:
#6535,
#6532,
#6511,
#6509
chojomok pushed a commit that referenced this pull request Jul 15, 2025
## Summary of changes

Disable the locked tracer globally in the runner integration tests.

## Reason for change

The locked tracer was already disabled in CiRunCommandTests, but it
turns out there are other tests that require to disable it (we just got
lucky with the ordering). Rather than discovering them one by one, let's
just disable it globally.

## Implementation details

Also added the proper xunit.runner.json file to have more info on the
running tests in the CI.

## Other details

Discovered while trying to randomize the order of the tests.
chojomok pushed a commit that referenced this pull request Jul 15, 2025
## Summary of changes

Randomize the order of the tests.

## Reason for change

Flaky tests are much harder to fix when we discover them long after they
have been written. By randomizing the order of the tests, I'm hoping to
make them fail earlier.
In practice, this could temporarily increase the overall flakiness, but
I expect this will reduce the overall effort spent on fixing tests.

## Implementation details

In `CustomTestFramework`, randomize the list of all tests in each
collections, and the collections themselves.
The seed is displayed in the output. When a test order causes tests to
fail, this allows to deterministically reproduce that test order.

## Other details

Four other issues were found thanks to this:
#6535,
#6532,
#6511,
#6509
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.

3 participants