Forward MSBuild build/tasks/details telemetry event - #54092
Merged
Conversation
jankratochvilcz
force-pushed
the
jan/msbuild-telemetry-event-detais
branch
from
April 27, 2026 11:39
4da8540 to
a47927f
Compare
jankratochvilcz
marked this pull request as ready for review
May 25, 2026 15:10
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the .NET SDK’s MSBuild logger to forward a new MSBuild telemetry event (build/tasks/details) under the msbuild/ namespace, enabling richer per-task execution telemetry to flow through the CLI telemetry pipeline.
Changes:
- Add
TasksDetailsTelemetryEventName = "build/tasks/details"and forward it viaMSBuildLogger.FormatAndSendasmsbuild/build/tasks/detailswithout hashing. - Add a new unit test verifying the event name and that
Tasks,TaskCount, andTotalTaskCountare preserved verbatim.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Cli/dotnet/Commands/MSBuild/MSBuildLogger.cs | Adds a constant and a FormatAndSend switch case to forward build/tasks/details as msbuild/build/tasks/details. |
| test/dotnet.Tests/CommandTests/MSBuild/GivenMSBuildLogger.cs | Adds a test validating forwarding behavior and property preservation for the new telemetry event. |
| } | ||
|
|
||
| [Fact] | ||
| public void ItForwardsTaskDetailsEvent() |
baronfel
approved these changes
May 26, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1094e91b-1c9c-4704-998f-0a5959e900aa
jankratochvilcz
force-pushed
the
jan/msbuild-telemetry-event-detais
branch
from
July 23, 2026 07:54
a47927f to
41e43bc
Compare
baronfel
approved these changes
Jul 23, 2026
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.
Context
Companion to dotnet/msbuild#13609, which adds a new per-task telemetry event
build/tasks/detailsemitted fromBuildManager. The MSBuild PR motivates this work: we want richer task-execution data (per-task name, executions count, task host runtime, etc.) so we can use real-world frequency data to drive decisions about which built-in tasks to prioritize / optimize.The event carries:
TaskCount— number of distinct tasks in the payload (capped at 100).TotalTaskCount— total number of distinct tasks observed.Tasks— JSON array of task-detail records (top 100 byExecutionsCount), ready for Kustomv-expand.Changes
src/Cli/dotnet/Commands/MSBuild/MSBuildLogger.cs:TasksDetailsTelemetryEventName = "build/tasks/details"constant.caseinFormatAndSendthat pass-through-forwards the event under themsbuild/namespace, with no hashed properties (the payload is already a JSON string with no PII).Unlike the existing
build/tasks/build/tasks/taskfactoryevents, this event is not aggregated client-side — MSBuild already does the aggregation/capping (top 100, hashed custom-task names) and the SDK just relays it.Testing
ItForwardsTaskDetailsEventinGivenMSBuildLoggerverifies the event is forwarded under the expected name and that all three properties (Tasks,TaskCount,TotalTaskCount) are preserved verbatim.GivenMSBuildLoggertests pass locally.Rollout
This change is forward-compatible: older MSBuilds simply won't emit the event, and the
caseinFormatAndSendis a no-op when the event isn't raised. No env-var gating is needed on the SDK side — gating lives in MSBuild (MSBUILDTELEMETRYEXCLUDETASKSDETAILS/Traits.ExcludeTasksDetailsFromTelemetry).