Emit telemetry when create-instance steps exceed 10s#40269
Open
shuaiyuanxx wants to merge 11 commits intomasterfrom
Open
Emit telemetry when create-instance steps exceed 10s#40269shuaiyuanxx wants to merge 11 commits intomasterfrom
shuaiyuanxx wants to merge 11 commits intomasterfrom
Conversation
7c33062 to
fd84d5e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds slow-operation instrumentation across VM/instance startup paths and updates the build pipeline to retain and publish binaries alongside PDBs during symbol publication.
Changes:
- Introduce
WslSlowOperation(RAII + threadpool-timer) to emit telemetry/logs when scoped operations exceed a threshold. - Wrap several VM/instance startup and plugin hook calls with
WslSlowOperationscopes to measure slow phases. - Update pipeline symbol publishing to also upload
.exe/.dllbinaries and avoid deleting test DLLs during staging.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/windows/service/exe/WslCoreVm.cpp | Adds WslSlowOperation scopes around key VM startup and instance creation operations. |
| src/windows/service/exe/WslCoreInstance.cpp | Narrows slow-operation timing specifically around blocking receives from init. |
| src/windows/service/exe/PluginManager.cpp | Adds slow-operation timing around plugin hook invocations. |
| src/windows/common/precomp.h | Exposes WslSlowOperation via the common precompiled header. |
| src/windows/common/WslSlowOperation.h | New RAII helper declaration for slow-operation timing and telemetry. |
| src/windows/common/WslSlowOperation.cpp | Implements timer-based slow threshold detection and start/end telemetry emission. |
| src/windows/common/CMakeLists.txt | Adds the new WslSlowOperation files to the common build. |
| .pipelines/build-job.yml | Keeps DLLs in bin/ and expands symbol publishing inputs to include .exe/.dll. |
fd84d5e to
a132d71
Compare
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a132d71 to
76192d4
Compare
Matches the codebase convention (100+ uses of TraceLoggingValue elsewhere, zero uses of TraceLoggingString before this PR). Functionally identical: both resolve to the ANSI string field for a const char* argument. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses review comment: avoid relying on transitive includes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OneBlue
reviewed
Apr 22, 2026
OneBlue
reviewed
Apr 23, 2026
Author
|
Hi @OneBlue, Thanks for the thorough review! All of your suggestions have been addressed — PTAL when you have a moment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Adds
SlowOperationWatcher, an RAII guard that emits aSlowOperationtelemetry event when a scoped step exceeds 10 s, so slowCreateInstancestarts can be attributed to a specific phase (HCS op, kernel boot, init-daemon wait, plugin hook) instead of the opaque timeout bucket.Fast path emits nothing. Slow path emits one
SlowOperationevent carryingname,thresholdMs, and the call site (file,function,line) captured viastd::source_location.PR Checklist
Detailed Description
src/windows/common/SlowOperationWatcher.{h,cpp}is a single-shot threadpool timer guard.wil::unique_threadpool_timer's destroyer cancels and drains on scope exit, so the callback cannot touch*thisafter destruction.Reset()disarms early for cases where the scope must outlive the watched call (e.g. to keep aReceiveMessagebuffer reference alive).Nameis restricted toconst char (&)[N]to enforce static storage.12 call sites wrapped:
WslCoreVm.cpp:HcsCreateSystem,HcsStartSystem,WaitForMiniInitConnect,ReadGuestCapabilities,CreateNatNetwork,AttachDistroVhd,WaitForInitDaemonConnectWslCoreInstance.cpp:WaitForCreateInstanceResult,WaitForDrvFsInit,WaitForInitConfigResponsePluginManager.cpp:PluginOnVmStarted,PluginOnDistributionStartedCall-site business logic is unchanged. No user-facing path.
Validation Steps Performed
Validated end-to-end against a Debug
wslservice.exewith ETW capture:wsl --shutdown+wsl -d Ubuntu -e echo hello— all guarded sites exercised, zeroSlowOperationevents.Sleep(11000)insideWaitForMiniInitConnect— oneSlowOperation{name="WaitForMiniInitConnect", thresholdMs=10000, file, function, line}event emitted.