mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
[CmdNotFound]Add telemetry for instance created and failure (#31558)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace WinGetCommandNotFound.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class CmdNotFoundFeedbackProvidedFailureEvent : EventBase, IEvent
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace WinGetCommandNotFound.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class CmdNotFoundInstanceCreatedEvent : EventBase, IEvent
|
||||
{
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,9 @@ namespace WinGetCommandNotFound
|
||||
_pool = provider.Create(new PooledPowerShellObjectPolicy());
|
||||
_pool.Return(_pool.Get());
|
||||
Task.Run(() => WarmUp());
|
||||
|
||||
// Telemetry that a shell is creating an instance of CommandNotFound.
|
||||
PowerToysTelemetry.Log.WriteEvent(new Telemetry.CmdNotFoundInstanceCreatedEvent());
|
||||
}
|
||||
|
||||
public Guid Id => _guid;
|
||||
@@ -105,6 +108,7 @@ namespace WinGetCommandNotFound
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("GetFeedback failed to execute", ex);
|
||||
PowerToysTelemetry.Log.WriteEvent(new Telemetry.CmdNotFoundFeedbackProvidedFailureEvent { Message = ex.Message });
|
||||
return new FeedbackItem($"Failed to execute PowerToys Command Not Found.{Environment.NewLine}This is a known issue if PowerShell 7 is installed from the Store or MSIX. If that isn't your case, please report an issue.", new List<string>(), FeedbackDisplayLayout.Portrait);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user