Skip to content

Add ETW events for node launch lifecycle#13459

Merged
rainersigwald merged 3 commits intodotnet:mainfrom
rainersigwald:etw-for-nodes
Mar 30, 2026
Merged

Add ETW events for node launch lifecycle#13459
rainersigwald merged 3 commits intodotnet:mainfrom
rainersigwald:etw-for-nodes

Conversation

@rainersigwald
Copy link
Copy Markdown
Member

@rainersigwald rainersigwald commented Mar 27, 2026

Adds ETW instrumentation around the node create-or-connect path in NodeProviderOutOfProcBase.GetNodes, to help chase down a possible regression from #13175.

New ETW events

Event ID Parameters Description
NodeConnectStart 99 nodeId Begin acquiring a node (reuse or launch)
NodeConnectStop 100 nodeId, processId, isReused Node acquired successfully
NodeReuseScanStart 101 Begin scanning for reusable node processes
NodeReuseScanStop 102 candidateCount Scan complete
NodeLaunchStart 103 nodeId Begin OS process creation
NodeLaunchStop 104 nodeId, processId Process created
NodePipeConnectStart 105 nodeId, processId Begin named pipe connect + handshake
NodePipeConnectStop 106 nodeId, processId, success Pipe connect complete

Timeline (new node)

NodeReuseScanStart / NodeReuseScanStop(candidates)
NodeConnectStart(nodeId)
  NodeLaunchStart(nodeId)
  NodeLaunchStop(nodeId, pid)
  NodePipeConnectStart(nodeId, pid)
  NodePipeConnectStop(nodeId, pid, success)
NodeConnectStop(nodeId, pid, isReused=false)

Timeline (reused node)

NodeReuseScanStart / NodeReuseScanStop(candidates)
NodeConnectStart(nodeId)
  NodePipeConnectStart(nodeId, candidatePid)
  NodePipeConnectStop(nodeId, candidatePid, success)
NodeConnectStop(nodeId, pid, isReused=true)

Both NodeProviderOutOfProc and NodeProviderOutOfProcTaskHost flow through GetNodes, so all node types are covered.

No behavioral change. Pure observability addition.

rainersigwald and others added 2 commits March 27, 2026 10:35
Add NodeConnectStart/NodeConnectStop event pair to MSBuildEventSource
(events 99-100) and instrument NodeProviderOutOfProcBase.GetNodes to
emit them. The stop event reports the node ID, process ID, and whether
the node was reused or newly launched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add NodeReuseScan, NodeLaunch, and NodePipeConnect start/stop event
pairs (events 101-106) to break down the NodeConnect span into process
enumeration, process creation, and pipe connect+handshake phases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rainersigwald rainersigwald self-assigned this Mar 27, 2026
@rainersigwald rainersigwald marked this pull request as ready for review March 27, 2026 22:16
Copilot AI review requested due to automatic review settings March 27, 2026 22:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds ETW instrumentation to the out-of-proc node acquisition path (GetNodes) to make it easier to diagnose timing/regressions around node reuse vs. launch (notably related to #13175’s apphost work).

Changes:

  • Added new MSBuildEventSource ETW events (IDs 99–106) for node connect, reuse scan, launch, and pipe connect lifecycle.
  • Emitted these events from NodeProviderOutOfProcBase.GetNodes across reuse + new-node creation flows.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Framework/MSBuildEventSource.cs Introduces new ETW event definitions for node connect/reuse/launch/pipe connect lifecycle.
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs Emits the new ETW events in the create-or-connect node acquisition path.

@rainersigwald rainersigwald merged commit f851364 into dotnet:main Mar 30, 2026
10 checks passed
@rainersigwald rainersigwald deleted the etw-for-nodes branch March 30, 2026 15:42
JanProvaznik added a commit to JanProvaznik/msbuild that referenced this pull request Mar 31, 2026
Renumber TaskHost callback events from 99-103 to 107-111 to avoid
clashing with node launch lifecycle events added in dotnet#13459.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dfederm pushed a commit to dfederm/msbuild that referenced this pull request Apr 9, 2026
Adds ETW instrumentation around the node create-or-connect path in
`NodeProviderOutOfProcBase.GetNodes`, to help chase down a possible
regression from dotnet#13175.

## New ETW events

| Event | ID | Parameters | Description |
|---|---|---|---|
| `NodeConnectStart` | 99 | `nodeId` | Begin acquiring a node (reuse or
launch) |
| `NodeConnectStop` | 100 | `nodeId`, `processId`, `isReused` | Node
acquired successfully |
| `NodeReuseScanStart` | 101 | | Begin scanning for reusable node
processes |
| `NodeReuseScanStop` | 102 | `candidateCount` | Scan complete |
| `NodeLaunchStart` | 103 | `nodeId` | Begin OS process creation |
| `NodeLaunchStop` | 104 | `nodeId`, `processId` | Process created |
| `NodePipeConnectStart` | 105 | `nodeId`, `processId` | Begin named
pipe connect + handshake |
| `NodePipeConnectStop` | 106 | `nodeId`, `processId`, `success` | Pipe
connect complete |

## Timeline (new node)
```
NodeReuseScanStart / NodeReuseScanStop(candidates)
NodeConnectStart(nodeId)
  NodeLaunchStart(nodeId)
  NodeLaunchStop(nodeId, pid)
  NodePipeConnectStart(nodeId, pid)
  NodePipeConnectStop(nodeId, pid, success)
NodeConnectStop(nodeId, pid, isReused=false)
```

## Timeline (reused node)
```
NodeReuseScanStart / NodeReuseScanStop(candidates)
NodeConnectStart(nodeId)
  NodePipeConnectStart(nodeId, candidatePid)
  NodePipeConnectStop(nodeId, candidatePid, success)
NodeConnectStop(nodeId, pid, isReused=true)
```

Both `NodeProviderOutOfProc` and `NodeProviderOutOfProcTaskHost` flow
through `GetNodes`.

No behavioral change. Pure observability addition.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants