Skip to content

Update profiler availability helper to assume Windows always sets the env var#7555

Merged
andrewlock merged 2 commits intomasterfrom
andrew/fix-profiler-availability-check
Sep 24, 2025
Merged

Update profiler availability helper to assume Windows always sets the env var#7555
andrewlock merged 2 commits intomasterfrom
andrew/fix-profiler-availability-check

Conversation

@andrewlock
Copy link
Member

Summary of changes

Update profiler availability helper algorithm on Windows

Reason for change

  • If the Continuous Profiler isn't available, the native loader does not rewrite P/Invokes and does not set DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH
  • If it is available, the native loader sets the DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH value
  • Currently, the ProfilerAvailabilityHelper is treating the presence of the variable as indication the profiler is available, but it's not treating the absence as an indication the profiler is not available.
  • This PR changes that to treat the DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH variable as the deciding factor on Windows

(Note that his variable is not available today on non-Windows as it doesn't propagate from the native side. We hope to fix that in the future, but in the mean time we must rely on heuristics).

Implementation details

Update the logic of the helper on Windows to only rely on the DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH variable.

Note that I also removed the AAS Extension check, as that only runs on Windows anyway, so would never return true (as it's caught in the IsWindows() branch).

Test coverage

Updated the unit tests with new behaviour. Basically we need to skip more tests on Windows, as it's only governed by that flag

Other details

Related to the following:

@andrewlock andrewlock requested review from a team as code owners September 24, 2025 11:23
@andrewlock andrewlock added the area:profiler Issues related to the continous-profiler label Sep 24, 2025
@datadog-official
Copy link

datadog-official bot commented Sep 24, 2025

⚠️ Tests

⚠️ Warnings

❄️ 1 New flaky test detected

Computer01Test.CheckAppDomain from Datadog.Profiler.SmokeTests (Datadog) (✨ Fix with BitsAI)

Actual:   Trueeage in the log file D:\a\_work\1\s\profiler\build_data\Computer01Test\CheckAppDomain\net7.0\logs\DD-DotNet-Profiler-Native-Samples.Computer01-3892.log

ℹ️ Info

🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4a5c4a7 | Docs | Was this helpful? Give us feedback!

@dd-trace-dotnet-ci-bot
Copy link

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.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7555) - mean (68ms)  : 66, 70
     .   : milestone, 68,
    master - mean (68ms)  : 66, 70
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (1,049ms)  : 982, 1116
     .   : milestone, 1049,
    master - mean (1,049ms)  : 988, 1110
     .   : milestone, 1049,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (106ms)  : 105, 107
     .   : milestone, 106,
    master - mean (106ms)  : 105, 108
     .   : milestone, 106,

    section Baseline
    This PR (7555) - mean (105ms)  : 103, 108
     .   : milestone, 105,
    master - mean (105ms)  : 103, 108
     .   : milestone, 105,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (740ms)  : 718, 762
     .   : milestone, 740,
    master - mean (745ms)  : 716, 774
     .   : milestone, 745,

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

    section Baseline
    This PR (7555) - mean (93ms)  : 91, 96
     .   : milestone, 93,
    master - mean (93ms)  : 91, 95
     .   : milestone, 93,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (700ms)  : 678, 721
     .   : milestone, 700,
    master - mean (706ms)  : 677, 735
     .   : milestone, 706,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (93ms)  : 91, 94
     .   : milestone, 93,
    master - mean (92ms)  : 91, 93
     .   : milestone, 92,

    section Baseline
    This PR (7555) - mean (92ms)  : 90, 94
     .   : milestone, 92,
    master - mean (92ms)  : 90, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (654ms)  : 640, 668
     .   : milestone, 654,
    master - mean (664ms)  : 647, 680
     .   : milestone, 664,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (201ms)  : 197, 206
     .   : milestone, 201,
    master - mean (199ms)  : 197, 202
     .   : milestone, 199,

    section Baseline
    This PR (7555) - mean (197ms)  : 191, 203
     .   : milestone, 197,
    master - mean (196ms)  : 193, 199
     .   : milestone, 196,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (1,173ms)  : 1108, 1238
     .   : milestone, 1173,
    master - mean (1,170ms)  : 1101, 1240
     .   : milestone, 1170,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (283ms)  : 278, 287
     .   : milestone, 283,
    master - mean (282ms)  : 275, 289
     .   : milestone, 282,

    section Baseline
    This PR (7555) - mean (281ms)  : 276, 286
     .   : milestone, 281,
    master - mean (281ms)  : 276, 286
     .   : milestone, 281,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (945ms)  : 897, 993
     .   : milestone, 945,
    master - mean (945ms)  : 900, 989
     .   : milestone, 945,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (276ms)  : 271, 282
     .   : milestone, 276,
    master - mean (275ms)  : 269, 281
     .   : milestone, 275,

    section Baseline
    This PR (7555) - mean (276ms)  : 268, 284
     .   : milestone, 276,
    master - mean (275ms)  : 270, 279
     .   : milestone, 275,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (934ms)  : 894, 973
     .   : milestone, 934,
    master - mean (930ms)  : 895, 965
     .   : milestone, 930,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7555) - mean (275ms)  : 270, 280
     .   : milestone, 275,
    master - mean (275ms)  : 265, 286
     .   : milestone, 275,

    section Baseline
    This PR (7555) - mean (276ms)  : 270, 282
     .   : milestone, 276,
    master - mean (273ms)  : 266, 281
     .   : milestone, 273,

    section CallTarget+Inlining+NGEN
    This PR (7555) - mean (861ms)  : 833, 889
     .   : milestone, 861,
    master - mean (861ms)  : 840, 883
     .   : milestone, 861,

Loading

@andrewlock andrewlock merged commit 61ef7c4 into master Sep 24, 2025
159 checks passed
@andrewlock andrewlock deleted the andrew/fix-profiler-availability-check branch September 24, 2025 15:42
@github-actions github-actions bot added this to the vNext-v3 milestone Sep 24, 2025
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.

4 participants