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

[Profiler] Contention profiling: add blocking thread name #5981

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

gleocadie
Copy link
Collaborator

@gleocadie gleocadie commented Sep 4, 2024

Summary of changes

Add the blocking thread name as tag on sample.

Reason for change

In a previous PR, we provide the blocking thread id only. The backend would need the name to display something useful.

Implementation details

Add and propagate the blocking thread name.

Test coverage

Update the current test.

Other details

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Sep 4, 2024

Datadog Report

Branch report: gleocadie/add-blocking-thread-name
Commit report: 0378b3b
Test service: dd-trace-dotnet

✅ 0 Failed, 359081 Passed, 2324 Skipped, 16h 7m 43.16s Total Time

@andrewlock
Copy link
Member

andrewlock commented Sep 4, 2024

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 (5981) - mean (71ms)  : 67, 75
     .   : milestone, 71,
    master - mean (70ms)  : 67, 74
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (5981) - mean (1,080ms)  : 1056, 1104
     .   : milestone, 1080,
    master - mean (1,080ms)  : 1058, 1103
     .   : milestone, 1080,

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

    section CallTarget+Inlining+NGEN
    This PR (5981) - mean (755ms)  : 739, 771
     .   : milestone, 755,
    master - mean (762ms)  : 735, 790
     .   : milestone, 762,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5981) - mean (94ms)  : 89, 98
     .   : milestone, 94,
    master - mean (93ms)  : 90, 95
     .   : milestone, 93,

    section CallTarget+Inlining+NGEN
    This PR (5981) - mean (710ms)  : 693, 727
     .   : milestone, 710,
    master - mean (708ms)  : 685, 731
     .   : milestone, 708,

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

    section CallTarget+Inlining+NGEN
    This PR (5981) - mean (1,163ms)  : 1139, 1188
     .   : milestone, 1163,
    master - mean (1,162ms)  : 1131, 1193
     .   : milestone, 1162,

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

    section CallTarget+Inlining+NGEN
    This PR (5981) - mean (923ms)  : 893, 953
     .   : milestone, 923,
    master - mean (916ms)  : 899, 932
     .   : milestone, 916,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5981) - mean (265ms)  : 260, 270
     .   : milestone, 265,
    master - mean (265ms)  : 261, 269
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (5981) - mean (907ms)  : 885, 929
     .   : milestone, 907,
    master - mean (904ms)  : 885, 922
     .   : milestone, 904,

Loading

@andrewlock
Copy link
Member

andrewlock commented Sep 4, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #5981 compared to master:

  • All benchmarks have the same speed
  • 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.45μs 41.1ns 250ns 0.0186 0.00745 0 5.42 KB
master StartStopWithChild netcoreapp3.1 10μs 55.6ns 360ns 0.025 0.00999 0 5.62 KB
master StartStopWithChild net472 15.9μs 48.6ns 182ns 1.02 0.304 0.0961 6.07 KB
#5981 StartStopWithChild net6.0 7.79μs 44.3ns 319ns 0.0195 0.00779 0 5.43 KB
#5981 StartStopWithChild netcoreapp3.1 9.84μs 53.3ns 311ns 0.0196 0.0049 0 5.62 KB
#5981 StartStopWithChild net472 15.9μs 58.9ns 228ns 1.01 0.293 0.1 6.06 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 464μs 228ns 824ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 622μs 185ns 668ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 854μs 341ns 1.32μs 0.425 0 0 3.3 KB
#5981 WriteAndFlushEnrichedTraces net6.0 468μs 84.6ns 305ns 0 0 0 2.7 KB
#5981 WriteAndFlushEnrichedTraces netcoreapp3.1 637μs 209ns 808ns 0 0 0 2.7 KB
#5981 WriteAndFlushEnrichedTraces net472 833μs 711ns 2.66μs 0.417 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 186μs 1.06μs 7.23μs 0.181 0 0 18.45 KB
master SendRequest netcoreapp3.1 209μs 1.12μs 6.34μs 0.198 0 0 20.61 KB
master SendRequest net472 0.000468ns 0.000329ns 0.00128ns 0 0 0 0 b
#5981 SendRequest net6.0 189μs 1.09μs 8.78μs 0.191 0 0 18.45 KB
#5981 SendRequest netcoreapp3.1 213μs 1.21μs 8.4μs 0.204 0 0 20.61 KB
#5981 SendRequest net472 0.00239ns 0.000798ns 0.00299ns 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 568μs 2.8μs 12.8μs 0.59 0 0 41.64 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 665μs 3.57μs 19.6μs 0.324 0 0 41.69 KB
master WriteAndFlushEnrichedTraces net472 864μs 3.91μs 15.1μs 8.08 2.55 0.425 53.26 KB
#5981 WriteAndFlushEnrichedTraces net6.0 573μs 1.54μs 5.54μs 0.563 0 0 41.78 KB
#5981 WriteAndFlushEnrichedTraces netcoreapp3.1 692μs 3.41μs 14.9μs 0.365 0 0 41.87 KB
#5981 WriteAndFlushEnrichedTraces net472 919μs 3.4μs 13.2μs 8.46 2.35 0.47 53.3 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 0.879ns 3.4ns 0.0145 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.73μs 1.36ns 5.27ns 0.014 0 0 1.02 KB
master ExecuteNonQuery net472 1.98μs 1.69ns 6.56ns 0.156 0 0 987 B
#5981 ExecuteNonQuery net6.0 1.31μs 1.21ns 4.52ns 0.0144 0 0 1.02 KB
#5981 ExecuteNonQuery netcoreapp3.1 1.66μs 1.97ns 7.61ns 0.0133 0 0 1.02 KB
#5981 ExecuteNonQuery net472 2.01μs 3.37ns 13ns 0.156 0 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.21μs 1.13ns 4.24ns 0.0134 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.58μs 0.758ns 2.94ns 0.0133 0 0 976 B
master CallElasticsearch net472 2.46μs 0.665ns 2.57ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.24μs 1.38ns 5.33ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.62μs 1.36ns 5.28ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.57μs 1.55ns 6ns 0.166 0 0 1.05 KB
#5981 CallElasticsearch net6.0 1.24μs 0.963ns 3.6ns 0.0137 0 0 976 B
#5981 CallElasticsearch netcoreapp3.1 1.57μs 1.3ns 5.03ns 0.0133 0 0 976 B
#5981 CallElasticsearch net472 2.49μs 1.92ns 7.42ns 0.158 0 0 995 B
#5981 CallElasticsearchAsync net6.0 1.22μs 0.7ns 2.62ns 0.0134 0 0 952 B
#5981 CallElasticsearchAsync netcoreapp3.1 1.6μs 1.59ns 5.96ns 0.0137 0 0 1.02 KB
#5981 CallElasticsearchAsync net472 2.63μs 1.53ns 5.93ns 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.3μs 1.46ns 5.65ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.62μs 2.18ns 8.43ns 0.0129 0 0 952 B
master ExecuteAsync net472 1.77μs 0.783ns 3.03ns 0.145 0 0 915 B
#5981 ExecuteAsync net6.0 1.31μs 1.3ns 5.03ns 0.0132 0 0 952 B
#5981 ExecuteAsync netcoreapp3.1 1.54μs 0.57ns 2.13ns 0.013 0 0 952 B
#5981 ExecuteAsync net472 1.71μs 1.73ns 6.72ns 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.14μs 1.31ns 4.9ns 0.0311 0 0 2.22 KB
master SendAsync netcoreapp3.1 5.05μs 1.99ns 7.69ns 0.0354 0 0 2.76 KB
master SendAsync net472 7.84μs 1.25ns 4.82ns 0.497 0 0 3.15 KB
#5981 SendAsync net6.0 4.21μs 1.41ns 5.28ns 0.0315 0 0 2.22 KB
#5981 SendAsync netcoreapp3.1 5.07μs 2.35ns 9.12ns 0.0355 0 0 2.76 KB
#5981 SendAsync net472 7.78μs 2.84ns 11ns 0.497 0 0 3.15 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.59μs 0.591ns 2.21ns 0.0231 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.39μs 0.723ns 2.71ns 0.0216 0 0 1.64 KB
master EnrichedLog net472 2.72μs 2.41ns 9.02ns 0.249 0 0 1.57 KB
#5981 EnrichedLog net6.0 1.51μs 4.38ns 17ns 0.0228 0 0 1.64 KB
#5981 EnrichedLog netcoreapp3.1 2.29μs 1.33ns 5.14ns 0.0221 0 0 1.64 KB
#5981 EnrichedLog net472 2.75μs 1.28ns 4.8ns 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 116μs 168ns 628ns 0.0583 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 120μs 173ns 668ns 0.0596 0 0 4.28 KB
master EnrichedLog net472 149μs 217ns 839ns 0.672 0.224 0 4.46 KB
#5981 EnrichedLog net6.0 116μs 137ns 493ns 0.058 0 0 4.28 KB
#5981 EnrichedLog netcoreapp3.1 120μs 168ns 629ns 0 0 0 4.28 KB
#5981 EnrichedLog net472 148μs 200ns 775ns 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 2.05ns 7.95ns 0.0305 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.22μs 1.28ns 4.79ns 0.0296 0 0 2.2 KB
master EnrichedLog net472 4.85μs 1.69ns 6.32ns 0.319 0 0 2.02 KB
#5981 EnrichedLog net6.0 2.9μs 1.07ns 4.16ns 0.0305 0 0 2.2 KB
#5981 EnrichedLog netcoreapp3.1 4.05μs 1.4ns 5.24ns 0.0283 0 0 2.2 KB
#5981 EnrichedLog net472 4.83μs 2.58ns 9.98ns 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.29μs 1.2ns 4.65ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.82μs 1.05ns 4.06ns 0.0155 0 0 1.14 KB
master SendReceive net472 2.18μs 1.85ns 7.17ns 0.183 0.00108 0 1.16 KB
#5981 SendReceive net6.0 1.39μs 0.709ns 2.74ns 0.016 0 0 1.14 KB
#5981 SendReceive netcoreapp3.1 1.78μs 1.75ns 6.78ns 0.0151 0 0 1.14 KB
#5981 SendReceive net472 2.11μs 0.926ns 3.59ns 0.183 0.00105 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.69μs 1.01ns 3.9ns 0.023 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.83μs 2.76ns 10.7ns 0.0211 0 0 1.65 KB
master EnrichedLog net472 4.4μs 0.83ns 3.11ns 0.324 0 0 2.04 KB
#5981 EnrichedLog net6.0 2.7μs 1.57ns 6.09ns 0.0229 0 0 1.6 KB
#5981 EnrichedLog netcoreapp3.1 3.82μs 1.61ns 6.24ns 0.021 0 0 1.65 KB
#5981 EnrichedLog net472 4.4μs 3.81ns 14.7ns 0.324 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 393ns 0.373ns 1.44ns 0.0081 0 0 576 B
master StartFinishSpan netcoreapp3.1 585ns 0.662ns 2.56ns 0.0076 0 0 576 B
master StartFinishSpan net472 563ns 0.173ns 0.669ns 0.0916 0 0 578 B
master StartFinishScope net6.0 481ns 0.419ns 1.62ns 0.00979 0 0 696 B
master StartFinishScope netcoreapp3.1 714ns 0.494ns 1.91ns 0.00965 0 0 696 B
master StartFinishScope net472 818ns 0.768ns 2.97ns 0.104 0 0 658 B
#5981 StartFinishSpan net6.0 391ns 0.338ns 1.31ns 0.00807 0 0 576 B
#5981 StartFinishSpan netcoreapp3.1 574ns 0.465ns 1.8ns 0.00775 0 0 576 B
#5981 StartFinishSpan net472 595ns 0.924ns 3.46ns 0.0916 0 0 578 B
#5981 StartFinishScope net6.0 484ns 0.469ns 1.82ns 0.00979 0 0 696 B
#5981 StartFinishScope netcoreapp3.1 782ns 1.24ns 4.81ns 0.00933 0 0 696 B
#5981 StartFinishScope net472 838ns 4.17ns 17.7ns 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 614ns 0.368ns 1.42ns 0.00987 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 972ns 0.994ns 3.72ns 0.00923 0 0 696 B
master RunOnMethodBegin net472 1.04μs 0.674ns 2.61ns 0.104 0 0 658 B
#5981 RunOnMethodBegin net6.0 613ns 0.534ns 2.07ns 0.0098 0 0 696 B
#5981 RunOnMethodBegin netcoreapp3.1 955ns 1.08ns 4.18ns 0.00937 0 0 696 B
#5981 RunOnMethodBegin net472 1.06μs 0.903ns 3.5ns 0.105 0 0 658 B

@gleocadie gleocadie marked this pull request as ready for review September 4, 2024 12:35
@gleocadie gleocadie requested a review from a team as a code owner September 4, 2024 12:35
@gleocadie gleocadie force-pushed the gleocadie/add-blocking-thread-name branch from 64668cb to 0378b3b Compare September 4, 2024 13:43
Copy link
Contributor

@chrisnas chrisnas left a comment

Choose a reason for hiding this comment

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

LGTM

@gleocadie gleocadie merged commit 86a85c9 into master Sep 5, 2024
74 of 78 checks passed
@gleocadie gleocadie deleted the gleocadie/add-blocking-thread-name branch September 5, 2024 11:36
@github-actions github-actions bot added this to the vNext-v3 milestone Sep 5, 2024
@andrewlock andrewlock added area:profiler Issues related to the continous-profiler area:profiler labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:profiler Issues related to the continous-profiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants