Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1834814
Event to track how many times commands are executed on PMC.
erdembayar Sep 18, 2020
594fad9
Batch count of commands executed on PMC.
erdembayar Sep 18, 2020
a8cb55d
Fix format.
erdembayar Sep 18, 2020
ef02445
Add telemetry for how many times PMC was openened.
erdembayar Sep 23, 2020
2b2e4a6
Add code comment for automatically loaded PMC.
erdembayar Sep 24, 2020
b0476a6
There are 2 seperate instances of PowerShellHost.cs can be created fo…
erdembayar Sep 29, 2020
6a2cb41
Combine 2 events make less number of event (just 1) to emit.
erdembayar Sep 29, 2020
a3945de
Fix typos.
erdembayar Sep 29, 2020
287c0c6
Add actual origin which caused init.ps1 to run into telemetry.
erdembayar Sep 29, 2020
a9d8ffd
Make names of telemetry event a constants.
erdembayar Sep 29, 2020
2061923
Get donnie's advise for naming.
erdembayar Sep 29, 2020
57e8963
Remove init.ps1 telemetry because current scenario doesn't capture in…
erdembayar Sep 30, 2020
e7e032b
Address Andy's code review comment.
erdembayar Sep 30, 2020
22300d4
Remove unused variable.
erdembayar Sep 30, 2020
9127d0a
Send single event for both PMUI and PMC powershell events.
erdembayar Sep 30, 2020
be473af
Make powershell telemetry works for with and without solution load.
erdembayar Nov 3, 2020
8190d66
No need to emit separate nugetvssolutionclose if there were no soluti…
erdembayar Nov 4, 2020
a265545
Refactor code so it's not much mix too much telemetry code into other…
erdembayar Nov 5, 2020
a99b667
Add telemetry detecting Nuget command and load of init.ps1 for packages.
erdembayar Nov 9, 2020
bbe8502
Move telemetry logic into seperate class VsPowerShellHostTelemetryEmi…
erdembayar Nov 9, 2020
3a139c4
Fix formatting.
erdembayar Nov 10, 2020
1c3e9a1
Remove manually typed consts with centralized one.
erdembayar Nov 10, 2020
3ad32a1
Move INuGetTelemetryAggregator so we don't have to publish new api.
erdembayar Nov 10, 2020
b236d94
Clean up
erdembayar Nov 10, 2020
6509fdc
Fix typos
erdembayar Nov 10, 2020
3bacebb
Start recording PMC usage without any solution load as seperate 'NuGe…
erdembayar Nov 12, 2020
04b0b22
Clean up
erdembayar Nov 12, 2020
e6204aa
Add missing telemetry property
erdembayar Nov 13, 2020
ba3a265
INuGetTelemetryCollector doesn't need to be Lazy since it's used imme…
erdembayar Nov 13, 2020
f5d3a0f
Address code review comment by Nikolche.
erdembayar Nov 24, 2020
4c1ff17
Remove unnecessary load of assembly.
erdembayar Nov 24, 2020
1ace515
Merge branch 'dev' into dev-eryondon-PMC-telemetry-event
erdembayar Jan 15, 2021
1ff19e8
Revert unneeded change.
erdembayar Jan 15, 2021
7656aa6
Separate telemtry collector and emitter.
erdembayar Jan 16, 2021
1c4705c
Move solution events to VSSolutionManager.cs
erdembayar Jan 16, 2021
687d35c
Make telemetry collector thread safe.
erdembayar Jan 16, 2021
c00e380
Refactor to use separate telemetry-event classes.
erdembayar Jan 17, 2021
a3d322c
Correct class name same to file name.
erdembayar Jan 17, 2021
ac51183
Address PR comment by Fernando
erdembayar Jan 17, 2021
85fa8ff
Fix typo.
erdembayar Jan 17, 2021
43a9027
Correct event class names
erdembayar Jan 17, 2021
c801946
Clean up and improve Powershell/PowershellTelemetryEmitter.
erdembayar Jan 18, 2021
dea971b
Fix typos.
erdembayar Jan 19, 2021
2d78015
Stop passing telemetry event between different methods.
erdembayar Jan 19, 2021
87b7d9a
Improve reaadability
erdembayar Jan 20, 2021
0c4f737
Move no any solution is loaded and not executed any command logic to …
erdembayar Jan 20, 2021
4f20b18
Correct prefix .
erdembayar Jan 20, 2021
f4a8a12
Refactor whole design after consulting with Andy.
erdembayar Jan 21, 2021
32f08f3
Fix reopen flag might not work from dispose on PMC window.
erdembayar Jan 21, 2021
d057453
Correct window count logic.
erdembayar Jan 21, 2021
f25af0e
Improve formatting and fix PMC, PMUI loaded not set from after load f…
erdembayar Jan 21, 2021
eaa9b9f
Correct solution count.
erdembayar Jan 21, 2021
9ab746d
Address PR comment Nkolche.
erdembayar Jan 21, 2021
73fc122
Address remaining review comments from Andy.
erdembayar Jan 21, 2021
ec4ae8d
Clean up fix and fix typos.
erdembayar Jan 21, 2021
9179b9c
Fix if PMC opened without solution then that window load is not counted.
erdembayar Jan 21, 2021
99b450d
Address PR comments by Fernando.
erdembayar Jan 22, 2021
ccf74a0
Address latest Andy's comments (removing prefix etc)
erdembayar Jan 22, 2021
aa0ba5b
Address latest PR comment from Andy and Fernando. Now solution close …
erdembayar Jan 22, 2021
a9607e7
Fix naming conventions.
erdembayar Jan 22, 2021
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
17 changes: 17 additions & 0 deletions src/NuGet.Clients/NuGet.Console/Xamls/ConsoleContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using NuGet.VisualStudio;
using NuGet.VisualStudio.Common;
using NuGet.VisualStudio.Internal.Contracts;
using NuGet.VisualStudio.Telemetry.PowerShell;

namespace NuGetConsole
{
Expand All @@ -28,6 +29,9 @@ public ConsoleContainer()
{
InitializeComponent();

Loaded += ConsoleContainer_Loaded;
Unloaded += ConsoleContainer_UnLoaded;

ThreadHelper.JoinableTaskFactory.StartOnIdle(
async () =>
{
Expand Down Expand Up @@ -76,6 +80,9 @@ public void NotifyInitializationCompleted()

public void Dispose()
{
Loaded -= ConsoleContainer_Loaded;
Unloaded -= ConsoleContainer_UnLoaded;

// Use more verbose null-checking syntax to avoid ISB001 misfiring.
if (_solutionManager != null)
{
Expand All @@ -84,5 +91,15 @@ public void Dispose()

GC.SuppressFinalize(this);
}

void ConsoleContainer_Loaded(object sender, RoutedEventArgs e)
{
NuGetPowerShellUsage.RaisePmcWindowsLoadEvent(isLoad: true);
}

void ConsoleContainer_UnLoaded(object sender, RoutedEventArgs e)
{
NuGetPowerShellUsage.RaisePmcWindowsLoadEvent(isLoad: false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using NuGet.Protocol.Core.Types;
using NuGet.Versioning;
using NuGet.VisualStudio;
using NuGet.VisualStudio.Telemetry.PowerShell;
using ExecutionContext = NuGet.ProjectManagement.ExecutionContext;

namespace NuGet.PackageManagement.PowerShellCmdlets
Expand Down Expand Up @@ -214,6 +215,9 @@ protected override sealed void ProcessRecord()
stopWatch.Start();
try
{
// Record NuGetCmdlet executed
NuGetPowerShellUsage.RaiseNuGetCmdletExecutedEvent();

ProcessRecordCore();
}
catch (Exception ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;
using NuGet.VisualStudio;
using NuGet.VisualStudio.Telemetry.PowerShell;
using IAsyncServiceProvider = Microsoft.VisualStudio.Shell.IAsyncServiceProvider;
using Task = System.Threading.Tasks.Task;

Expand Down Expand Up @@ -184,8 +185,6 @@ private async Task InitializeAsync()
});
});

TelemetryActivity.NuGetTelemetryService = new NuGetVSTelemetryService();

_vsMonitorSelection = await _asyncServiceProvider.GetServiceAsync<SVsShellMonitorSelection, IVsMonitorSelection>();

var solutionLoadedGuid = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid;
Expand Down Expand Up @@ -499,6 +498,8 @@ private async Task OnSolutionExistsAndFullyLoadedAsync()

SolutionOpening?.Invoke(this, EventArgs.Empty);

NuGetPowerShellUsage.RaiseSolutionOpenEvent();

// although the SolutionOpened event fires, the solution may be only in memory (e.g. when
// doing File - New File). In that case, we don't want to act on the event.
if (!await IsSolutionOpenAsync())
Expand Down Expand Up @@ -526,6 +527,8 @@ private void OnAfterClosing()

private void OnBeforeClosing()
{
NuGetPowerShellUsage.RaiseSolutionCloseEvent();

SolutionClosing?.Invoke(this, EventArgs.Empty);
}

Expand Down
12 changes: 12 additions & 0 deletions src/NuGet.Clients/NuGet.Tools/NuGetPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using NuGet.VisualStudio.Common;
using NuGet.VisualStudio.Internal.Contracts;
using NuGet.VisualStudio.Telemetry;
using NuGet.VisualStudio.Telemetry.PowerShell;
using NuGetConsole;
using NuGetConsole.Implementation;
using ContractsNuGetServices = NuGet.VisualStudio.Contracts.NuGetServices;
Expand Down Expand Up @@ -96,6 +97,7 @@ public sealed class NuGetPackage : AsyncPackage, IVsPackageExtensionProvider, IV
private uint _solutionExistsCookie;
private bool _powerConsoleCommandExecuting;
private bool _initialized;
private NuGetPowerShellUsageCollector _nuGetPowerShellUsageCollector;

public NuGetPackage()
{
Expand Down Expand Up @@ -145,6 +147,9 @@ public NuGetPackage()
/// </summary>
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
_nuGetPowerShellUsageCollector = new NuGetPowerShellUsageCollector();
NuGet.Common.TelemetryActivity.NuGetTelemetryService = new NuGetVSTelemetryService();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkolev92
Reason I did it was if I import Nuget.Common then just 8-9 lines down on AsyncLazy<IVsMonitorSelection> needed exact same thing it needs fully qualified name. So instead of touching existing code for same change I tried to contain my changes.
image

Copy link
Member

@nkolev92 nkolev92 Jan 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in new PR#3863.


await base.InitializeAsync(cancellationToken, progress);

// Add our command handlers for menu (commands must exist in the .vsct file)
Expand Down Expand Up @@ -179,6 +184,8 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
ThreadHelper.JoinableTaskFactory);

await NuGetBrokeredServiceFactory.ProfferServicesAsync(this);

VsShellUtilities.ShutdownToken.Register(RegisterEmitVSInstancePowerShellTelemetry);
}

/// <summary>
Expand Down Expand Up @@ -1247,6 +1254,11 @@ private void OnBeginShutDown()
_dteEvents = null;
}

private void RegisterEmitVSInstancePowerShellTelemetry()
{
NuGetPowerShellUsage.RaiseVSInstanceCloseEvent();
}

#region IVsPersistSolutionOpts

// Called by the shell when a solution is opened and the SUO file is read.
Expand Down
Loading