Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable MSBuild buildcheck telemetry #43359

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Cli/dotnet/commands/dotnet-msbuild/MSBuildLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public sealed class MSBuildLogger : INodeLogger
internal const string TargetFrameworkTelemetryEventName = "targetframeworkeval";
internal const string BuildTelemetryEventName = "build";
internal const string LoggingConfigurationTelemetryEventName = "loggingConfiguration";
internal const string BuildcheckAcquisitionFailureEventName = "buildcheck/acquisitionfailure";
internal const string BuildcheckRunEventName = "buildcheck/run";
internal const string BuildcheckRuleStatsEventName = "buildcheck/rule";

internal const string SdkTaskBaseCatchExceptionTelemetryEventName = "taskBaseCatchException";
internal const string PublishPropertiesTelemetryEventName = "PublishProperties";
Expand Down Expand Up @@ -138,6 +141,21 @@ internal static void FormatAndSend(ITelemetry telemetry, TelemetryEventArgs args
toBeHashed: Array.Empty<string>(),
toBeMeasured: new[] { "FileLoggersCount" });
break;
case BuildcheckAcquisitionFailureEventName:
TrackEvent(telemetry, $"msbuild/{BuildcheckAcquisitionFailureEventName}", args.Properties,
toBeHashed: new[] { "AssemblyName", "ExceptionType", "ExceptionMessage" },
toBeMeasured: Array.Empty<string>());
break;
case BuildcheckRunEventName:
TrackEvent(telemetry, $"msbuild/{BuildcheckRunEventName}", args.Properties,
toBeHashed: Array.Empty<string>(),
toBeMeasured: new[] { "RulesCount", "CustomRulesCount", "ViolationsCount", "TotalRuntimeInMilliseconds" });
break;
case BuildcheckRuleStatsEventName:
TrackEvent(telemetry, $"msbuild/{BuildcheckRuleStatsEventName}", args.Properties,
toBeHashed: new[] { "RuleId", "CheckFriendlyName" },
toBeMeasured: new[] { "DefaultSeverityId", "ViolationMessagesCount", "ViolationWarningsCount", "ViolationErrorsCount", "TotalRuntimeInMilliseconds" });
break;
// Pass through events that don't need special handling
case SdkTaskBaseCatchExceptionTelemetryEventName:
case PublishPropertiesTelemetryEventName:
Expand Down
Loading