From fd6b7d2740bdc6dedff62cd05a3872ff321ec35c Mon Sep 17 00:00:00 2001 From: Kevin Pilch Date: Thu, 15 Feb 2018 10:38:38 -0800 Subject: [PATCH] Add telemetry for when projects are created/pushed/etc Adds 3 telemetry points to see when projects get created, pushed to the workspace, and have their "LastDesignTimeBuildSucceeded" flag changed. Fixes internal bug 568001. --- .../ProjectSystem/AbstractProject.cs | 24 ++++++++++++++++++- .../Core/Portable/Log/FunctionId.cs | 4 ++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs index 6b4660d427975..05a14f6370991 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.VisualStudio.ComponentModelHost; @@ -37,6 +38,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem internal abstract partial class AbstractProject : ForegroundThreadAffinitizedObject, IVisualStudioHostProject #pragma warning restore CS0618 // IVisualStudioHostProject is obsolete { + private const string ProjectGuidPropertyName = "ProjectGuid"; + internal static object RuleSetErrorId = new object(); private readonly object _gate = new object(); @@ -171,6 +174,12 @@ public AbstractProject( } UpdateAssemblyName(); + + Logger.Log(FunctionId.AbstractProject_Created, + KeyValueLogMessage.Create(LogType.Trace, m => + { + m[ProjectGuidPropertyName] = Guid; + })); } internal IServiceProvider ServiceProvider { get; } @@ -318,9 +327,17 @@ public ProjectInfo CreateProjectInfoForCurrentState() protected void SetIntellisenseBuildResultAndNotifyWorkspaceHosts(bool succeeded) { - // set intellisense related info + // set IntelliSense related info LastDesignTimeBuildSucceeded = succeeded; + Logger.Log(FunctionId.AbstractProject_SetIntelliSenseBuild, + KeyValueLogMessage.Create(LogType.Trace, m => + { + m[ProjectGuidPropertyName] = Guid; + m[nameof(LastDesignTimeBuildSucceeded)] = LastDesignTimeBuildSucceeded; + m[nameof(PushingChangesToWorkspaceHosts)] = PushingChangesToWorkspaceHosts; + })); + if (PushingChangesToWorkspaceHosts) { // set workspace reference info @@ -1361,6 +1378,11 @@ protected virtual void OnDocumentRemoved(string filePath) internal void StartPushingToWorkspaceHosts() { _pushingChangesToWorkspaceHosts = true; + Logger.Log(FunctionId.AbstractProject_PushedToWorkspace, + KeyValueLogMessage.Create(LogType.Trace, m => + { + m[ProjectGuidPropertyName] = Guid; + })); } internal void StopPushingToWorkspaceHosts() diff --git a/src/Workspaces/Core/Portable/Log/FunctionId.cs b/src/Workspaces/Core/Portable/Log/FunctionId.cs index 395234a70d70d..5ca5eb5aa7c25 100644 --- a/src/Workspaces/Core/Portable/Log/FunctionId.cs +++ b/src/Workspaces/Core/Portable/Log/FunctionId.cs @@ -403,5 +403,9 @@ internal enum FunctionId MetadataOnlyImage_EmitFailure, LiveTableDataSource_OnDiagnosticsUpdated, Experiment_KeybindingsReset, + + AbstractProject_SetIntelliSenseBuild, + AbstractProject_Created, + AbstractProject_PushedToWorkspace, } }