Skip to content

Commit

Permalink
Add telemetry for when projects are created/pushed/etc
Browse files Browse the repository at this point in the history
Adds 3 telemetry points to see when projects get created, pushed to the
workspace, and have their "LastDesignTimeBuildSucceeded" flag changed.

Fixes internal bug 568001.
  • Loading branch information
Pilchie committed Feb 15, 2018
1 parent d379f47 commit fd6b7d2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand Down Expand Up @@ -171,6 +174,12 @@ public AbstractProject(
}

UpdateAssemblyName();

Logger.Log(FunctionId.AbstractProject_Created,
KeyValueLogMessage.Create(LogType.Trace, m =>
{
m[ProjectGuidPropertyName] = Guid;
}));
}

internal IServiceProvider ServiceProvider { get; }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/Workspaces/Core/Portable/Log/FunctionId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,5 +403,9 @@ internal enum FunctionId
MetadataOnlyImage_EmitFailure,
LiveTableDataSource_OnDiagnosticsUpdated,
Experiment_KeybindingsReset,

AbstractProject_SetIntelliSenseBuild,
AbstractProject_Created,
AbstractProject_PushedToWorkspace,
}
}

0 comments on commit fd6b7d2

Please sign in to comment.