Add telemetry for task host usage reasons.
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
## Context
The team wants to understand why tasks are routed to the task host. Currently there is no telemetry distinguishing the reason a specific task runs in a task host process versus in-proc.
## Goal
Add telemetry that records the reason each task is dispatched to the task host. The reasons to distinguish include:
1. **Explicitly requested** — the task or project explicitly opts into out-of-proc execution (e.g., `TaskHostFactory`).
2. **Non-MT-enlightened task** — the task does not have the `[MultiThreadedTask]` attribute and is being routed to the task host because the build is running in multi-threaded mode.
3. **Workaround / transient task host** — the task is force-routed to a transient task host for isolation (e.g., NuGet `RestoreTask`).
## Exit Criteria
- Telemetry events include a field indicating the task-host routing reason.
- The data can be queried to understand the distribution of task host usage across real-world builds.
## Notes
- This is a small, straightforward task (~1 hour of work).
- Discussed in grooming on June 2, 2026.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.