Back to Msbuild

MSBuild Telemetry

documentation/wiki/CollectedTelemetry.md

18.4.06.8 KB
Original Source

MSBuild Telemetry

MSBuild emits and collects telemetry to guide decisions on modernization and optimization investments. Currently the MSBuild collects telemetry only when run from SDK host (mostly the dotnet build and dotnet msbuild commands). For more details please refer to the official SDK telemetry documentation.

Visual Studio collects some build related telemetry - but that is not leveraging any MSBuild instrumentation, but rather information about count and duration of MSBuild API invocations from the caller point of view. For general information about telemetry being collected by Visual Studio Family of products and regulations compliance please refer to the official documentation.

Type of data collected

To tailor modernization and performance optimization investments we need to contain anonymized Usage Data. Those reflect type of features being used and execution time being spent in them.

Opting out

MSBuild telemetry collection (that is turned on by default), can be opted out - same as .NET SDK telemetry in general - via setting DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 or true.

Datapoints overview

Logging Configuration

Expressed and collected via LoggingConfigurationTelemetry type

SDK versionsData
>= 8.0.100Indication if terminal logger was used.
>= 8.0.100User choice on terminal logger enablement.
>= 8.0.100Source of user choice on terminal logger enablement.
>= 8.0.100Default choice on terminal logger enablement.
>= 8.0.100Source of default choice on terminal logger enablement.
>= 8.0.100Indication if Console logger was used.
>= 8.0.100Console logger verbosity.
>= 8.0.100Indication if File logger was used.
>= 8.0.100File logger verbosity.
>= 8.0.100Indication if Binary logger was used.
>= 8.0.100Indication if Binary logger used with default log name.

Deprecated Data

IntroducedRemovedData
8.0.10010.0.100Console logger type (serial, parallel).
8.0.10010.0.100File logger type (serial, parallel).
8.0.10010.0.100Number of file loggers.

BuildCheck

Expressed and collected via BuildCheckTelemetry type

BuildCheck Run

SDK versionsData
>= 9.0.100Corelation guid for the run
>= 9.0.100Count of enabled rules for the run
>= 9.0.100Count of enabled custom rules for the run
>= 9.0.100Count of violations encountered for the run
>= 9.0.100Execution time spent by BuildCheck infrastructure and rules

BuildCheck Rule in a run

SDK versionsData
>= 9.0.100Corelation guid for the run.
>= 9.0.100Id of the rule.
>= 9.0.100Hashed Check Friendly name.
>= 9.0.100Indication if this is a built-in Check.
>= 9.0.100Default severity of a Check.
>= 9.0.100Number of projects that had this rule enabled.
>= 9.0.100List of explicit severities set for this rule (those can vary per project - hence list).
>= 9.0.100Count of diagnostics with Message severity emitted by this rule.
>= 9.0.100Count of diagnostics with Warning severity emitted by this rule.
>= 9.0.100Count of diagnostics with Error severity emitted by this rule.
>= 9.0.100Indication whether the rule was throttled.
>= 9.0.100Execution time spent by executing the Check defining this rule

BuildCheck Extensibility issues

SDK versionsData
>= 9.0.100Corelation guid for the run.
>= 9.0.100Hashed name of assembly that was referenced as a custom Check.
>= 9.0.100Hashed exception type thrown when attempting to load the custom check.
>= 9.0.100Hashed exception message thrown when attempting to load the custom check.

General Build

Expressed and collected via BuildTelemetry type

SDK versionsData
AllDisplay version of the Engine suitable for display to a user.
AllDuration of the build - from when it was requested (via API or CLI).
AllDuration of the build - from when it was started by internal BuildManager.
AllBuild engine runtime name.
AllHost in which MSBuild build was executed (e.g. "VS", "VSCode", "Azure DevOps", "GitHub Action", "CLI").
AllState of MSBuild server process before this build (one of 'cold', 'hot', null (if not run as server)).
AllPath to project file.
AllMSBuild server fallback reason (either "ServerBusy", "ConnectionError" or null (no fallback)).
AllOverall build success (true, false).
AllBuild target.
AllVersion of MSBuild.
>= 9.0.100Indication of enablement of BuildCheck feature.
>= 9.0.100Indication of Smart App Control being in evaluation mode on machine executing the build.
>= 10.0.100Indication if the build was run in multithreaded mode.
>= 10.0.200Primary failure category when BuildSuccess = false (one of: "Compiler", "MSBuildEngine", "Tasks", "SDK", "NuGet", "BuildCheck", "Other").
>= 10.0.200Count of compiler errors encountered during the build.
>= 10.0.200Count of MSBuild engine errors encountered during the build.
>= 10.0.200Count of task errors encountered during the build.
>= 10.0.200Count of SDK errors encountered during the build.
>= 10.0.200Count of NuGet errors encountered during the build.
>= 10.0.200Count of BuildCheck errors encountered during the build.
>= 10.0.200Count of other errors encountered during the build.

Project Build

Expressed and collected via ProjectTelemetry type

SDK versionsData
>= 10.0.100Count of tasks executed by task factory type (Assembly, Intrinsic, Code, RoslynCode, Xaml, and custom task factories).
>= 10.0.100Total count of tasks executed in the project.
>= 10.0.100Count of tasks executed in TaskHost (out-of-process).

Note: These telemetry events are aggregated per build by the SDK.