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

Don't log a warning for CORPROF_E_PROFILER_CANCEL_ACTIVATION #6550

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

kevingosse
Copy link
Collaborator

Summary of changes

Don't log a warning if the classfactory of the tracer or the profiler returns CORPROF_E_PROFILER_CANCEL_ACTIVATION.

Reason for change

The tracer and the profiler return this error code when explicitly disabled (either by an DD_{0}_ENABLED setting, or by process exclusion). This is expected and therefore should be logged as info rather than warning.

Implementation details

Just check the HResult. As a bonus, removed a superfluous log.

Test coverage

Tested on my machine.

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.

Nice, thanks 👍

@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 (6550) - mean (70ms)  : 64, 75
     .   : milestone, 70,
    master - mean (68ms)  : 66, 71
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (6550) - mean (985ms)  : 961, 1009
     .   : milestone, 985,
    master - mean (979ms)  : 952, 1005
     .   : milestone, 979,

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

    section CallTarget+Inlining+NGEN
    This PR (6550) - mean (681ms)  : 664, 697
     .   : milestone, 681,
    master - mean (677ms)  : 660, 694
     .   : milestone, 677,

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

    section CallTarget+Inlining+NGEN
    This PR (6550) - mean (632ms)  : 613, 651
     .   : milestone, 632,
    master - mean (633ms)  : 615, 652
     .   : milestone, 633,

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

    section CallTarget+Inlining+NGEN
    This PR (6550) - mean (1,099ms)  : 1063, 1134
     .   : milestone, 1099,
    master - mean (1,097ms)  : 1065, 1130
     .   : milestone, 1097,

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

    section CallTarget+Inlining+NGEN
    This PR (6550) - mean (868ms)  : 840, 895
     .   : milestone, 868,
    master - mean (870ms)  : 846, 893
     .   : milestone, 870,

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

    section CallTarget+Inlining+NGEN
    This PR (6550) - mean (847ms)  : 816, 878
     .   : milestone, 847,
    master - mean (851ms)  : 818, 883
     .   : milestone, 851,

Loading

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jan 15, 2025

Datadog Report

Branch report: kevin/profiler_disabled
Commit report: b76bfb9
Test service: dd-trace-dotnet

✅ 0 Failed, 248323 Passed, 2452 Skipped, 21h 0m 20.76s Total Time

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6550 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.112
  • 1 benchmarks are slower, with geometric mean 1.148
  • 1 benchmarks have fewer 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.31μs 47.1ns 319ns 0.0153 0.00764 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.4μs 52.4ns 251ns 0.0204 0.0102 0 5.79 KB
master StartStopWithChild net472 16.4μs 64.4ns 250ns 1.05 0.331 0.107 6.2 KB
#6550 StartStopWithChild net6.0 8.01μs 44.7ns 309ns 0.0158 0.00788 0 5.61 KB
#6550 StartStopWithChild netcoreapp3.1 10.1μs 48.7ns 189ns 0.024 0.0096 0 5.8 KB
#6550 StartStopWithChild net472 16.2μs 46.3ns 179ns 1.05 0.324 0.105 6.22 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 485μs 361ns 1.35μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 671μs 509ns 1.97μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 876μs 417ns 1.61μs 0.428 0 0 3.3 KB
#6550 WriteAndFlushEnrichedTraces net6.0 480μs 297ns 1.15μs 0 0 0 2.7 KB
#6550 WriteAndFlushEnrichedTraces netcoreapp3.1 660μs 743ns 2.88μs 0 0 0 2.7 KB
#6550 WriteAndFlushEnrichedTraces net472 853μs 678ns 2.62μs 0.425 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 153μs 880ns 7.1μs 0.158 0 0 14.47 KB
master SendRequest netcoreapp3.1 181μs 1.42μs 14.1μs 0.166 0 0 17.27 KB
master SendRequest net472 0.00445ns 0.00132ns 0.00512ns 0 0 0 0 b
#6550 SendRequest net6.0 155μs 844ns 7.36μs 0.143 0 0 14.47 KB
#6550 SendRequest netcoreapp3.1 176μs 981ns 8.21μs 0.169 0 0 17.27 KB
#6550 SendRequest net472 0.00141ns 0.000674ns 0.00252ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #6550

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.78 KB 41.52 KB -267 B -0.64%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 592μs 3.11μs 14.9μs 0.573 0 0 41.78 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 700μs 3.13μs 16.5μs 0.363 0 0 41.63 KB
master WriteAndFlushEnrichedTraces net472 843μs 3.19μs 12.4μs 8.33 2.5 0.417 53.32 KB
#6550 WriteAndFlushEnrichedTraces net6.0 575μs 3.08μs 16μs 0.551 0 0 41.52 KB
#6550 WriteAndFlushEnrichedTraces netcoreapp3.1 681μs 3.82μs 24.8μs 0.406 0 0 41.78 KB
#6550 WriteAndFlushEnrichedTraces net472 836μs 3.24μs 12.1μs 8.39 2.52 0.419 53.31 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 1.66ns 6.44ns 0.014 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.78μs 2.15ns 8.34ns 0.0134 0 0 1.02 KB
master ExecuteNonQuery net472 2.11μs 2.21ns 8.57ns 0.157 0.00106 0 987 B
#6550 ExecuteNonQuery net6.0 1.24μs 2.05ns 7.92ns 0.0143 0 0 1.02 KB
#6550 ExecuteNonQuery netcoreapp3.1 1.78μs 1.98ns 7.66ns 0.0134 0 0 1.02 KB
#6550 ExecuteNonQuery net472 2.08μs 2.11ns 7.89ns 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.27μs 0.452ns 1.69ns 0.0133 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.69μs 0.738ns 2.86ns 0.0124 0 0 976 B
master CallElasticsearch net472 2.64μs 1.52ns 5.88ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.25μs 0.542ns 2.1ns 0.0136 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 0.715ns 2.67ns 0.0139 0 0 1.02 KB
master CallElasticsearchAsync net472 2.59μs 1.32ns 4.94ns 0.167 0 0 1.05 KB
#6550 CallElasticsearch net6.0 1.17μs 0.485ns 1.81ns 0.0135 0 0 976 B
#6550 CallElasticsearch netcoreapp3.1 1.68μs 0.732ns 2.74ns 0.0125 0 0 976 B
#6550 CallElasticsearch net472 2.52μs 1.52ns 5.87ns 0.158 0 0 995 B
#6550 CallElasticsearchAsync net6.0 1.31μs 0.905ns 3.39ns 0.0132 0 0 952 B
#6550 CallElasticsearchAsync netcoreapp3.1 1.64μs 1.17ns 4.53ns 0.0134 0 0 1.02 KB
#6550 CallElasticsearchAsync net472 2.63μs 1.4ns 5.41ns 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.25μs 0.934ns 3.5ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.7μs 1.05ns 3.93ns 0.0127 0 0 952 B
master ExecuteAsync net472 1.78μs 0.352ns 1.36ns 0.145 0 0 915 B
#6550 ExecuteAsync net6.0 1.24μs 2.39ns 8.93ns 0.0131 0 0 952 B
#6550 ExecuteAsync netcoreapp3.1 1.73μs 1.34ns 5.17ns 0.0129 0 0 952 B
#6550 ExecuteAsync net472 1.77μs 0.414ns 1.6ns 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.32μs 1.85ns 6.68ns 0.0324 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.28μs 1.8ns 6.75ns 0.0369 0 0 2.85 KB
master SendAsync net472 7.32μs 1.43ns 5.36ns 0.495 0 0 3.12 KB
#6550 SendAsync net6.0 4.46μs 1.39ns 5.2ns 0.0313 0 0 2.31 KB
#6550 SendAsync netcoreapp3.1 5.36μs 0.888ns 3.44ns 0.0377 0 0 2.85 KB
#6550 SendAsync net472 7.4μs 1.82ns 6.8ns 0.494 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.43μs 0.778ns 2.91ns 0.0228 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.38μs 3.41ns 12.8ns 0.0219 0 0 1.64 KB
master EnrichedLog net472 2.71μs 1.01ns 3.78ns 0.249 0 0 1.57 KB
#6550 EnrichedLog net6.0 1.52μs 0.921ns 3.57ns 0.0229 0 0 1.64 KB
#6550 EnrichedLog netcoreapp3.1 2.19μs 0.84ns 3.14ns 0.0231 0 0 1.64 KB
#6550 EnrichedLog net472 2.71μs 0.822ns 3.08ns 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 118μs 141ns 526ns 0 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 123μs 284ns 1.1μs 0.0616 0 0 4.28 KB
master EnrichedLog net472 152μs 188ns 727ns 0.673 0.224 0 4.46 KB
#6550 EnrichedLog net6.0 116μs 183ns 684ns 0.0582 0 0 4.28 KB
#6550 EnrichedLog netcoreapp3.1 121μs 270ns 1.05μs 0.0602 0 0 4.28 KB
#6550 EnrichedLog net472 150μs 145ns 544ns 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 2.97μs 1.18ns 4.57ns 0.0312 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.15μs 1.97ns 7.64ns 0.029 0 0 2.2 KB
master EnrichedLog net472 4.8μs 2.24ns 8.37ns 0.32 0 0 2.02 KB
#6550 EnrichedLog net6.0 2.89μs 1.1ns 4.24ns 0.0305 0 0 2.2 KB
#6550 EnrichedLog netcoreapp3.1 4.19μs 2.74ns 10.6ns 0.0293 0 0 2.2 KB
#6550 EnrichedLog net472 4.85μs 1.37ns 5.32ns 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.31μs 1.02ns 3.94ns 0.0162 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.82μs 5.64ns 21.9ns 0.0153 0 0 1.14 KB
master SendReceive net472 2.19μs 1.5ns 5.83ns 0.183 0 0 1.16 KB
#6550 SendReceive net6.0 1.38μs 2.33ns 9.04ns 0.0158 0 0 1.14 KB
#6550 SendReceive netcoreapp3.1 1.88μs 2.34ns 9.05ns 0.0149 0 0 1.14 KB
#6550 SendReceive net472 2.04μs 1.98ns 7.67ns 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.67μs 0.993ns 3.84ns 0.0227 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.82μs 2.94ns 11.4ns 0.0228 0 0 1.65 KB
master EnrichedLog net472 4.44μs 2.29ns 8.88ns 0.322 0 0 2.04 KB
#6550 EnrichedLog net6.0 2.72μs 0.8ns 2.99ns 0.0217 0 0 1.6 KB
#6550 EnrichedLog netcoreapp3.1 3.86μs 1.31ns 4.91ns 0.0214 0 0 1.65 KB
#6550 EnrichedLog net472 4.46μs 3.22ns 12.5ns 0.322 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6550

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.148 408.94 469.40

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 409ns 0.306ns 1.18ns 0.00809 0 0 576 B
master StartFinishSpan netcoreapp3.1 557ns 0.436ns 1.63ns 0.00779 0 0 576 B
master StartFinishSpan net472 702ns 0.404ns 1.51ns 0.0918 0 0 578 B
master StartFinishScope net6.0 518ns 0.289ns 1.08ns 0.0097 0 0 696 B
master StartFinishScope netcoreapp3.1 835ns 0.478ns 1.85ns 0.00919 0 0 696 B
master StartFinishScope net472 860ns 0.687ns 2.66ns 0.104 0 0 658 B
#6550 StartFinishSpan net6.0 469ns 0.293ns 1.09ns 0.00801 0 0 576 B
#6550 StartFinishSpan netcoreapp3.1 549ns 0.155ns 0.581ns 0.00767 0 0 576 B
#6550 StartFinishSpan net472 647ns 0.289ns 1.12ns 0.0916 0 0 578 B
#6550 StartFinishScope net6.0 547ns 0.253ns 0.979ns 0.00987 0 0 696 B
#6550 StartFinishScope netcoreapp3.1 802ns 1.48ns 5.52ns 0.00935 0 0 696 B
#6550 StartFinishScope net472 896ns 0.714ns 2.77ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6550

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 1.112 1,125.96 1,012.40

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 673ns 0.349ns 1.35ns 0.00969 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 915ns 0.68ns 2.63ns 0.00923 0 0 696 B
master RunOnMethodBegin net472 1.13μs 0.381ns 1.47ns 0.104 0 0 658 B
#6550 RunOnMethodBegin net6.0 663ns 0.502ns 1.94ns 0.00962 0 0 696 B
#6550 RunOnMethodBegin netcoreapp3.1 891ns 1.03ns 4ns 0.00928 0 0 696 B
#6550 RunOnMethodBegin net472 1.01μs 0.591ns 2.21ns 0.104 0 0 658 B

@kevingosse kevingosse merged commit f15905a into master Jan 17, 2025
71 of 74 checks passed
@kevingosse kevingosse deleted the kevin/profiler_disabled branch January 17, 2025 09:59
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants