Small refactor to use common powertoys telemetry event source accross modules.

This commit is contained in:
ryanbodrug-microsoft 2020-05-05 09:23:31 -07:00
parent a9cc4dabb7
commit def0d7a519
15 changed files with 55 additions and 15 deletions

View File

@ -246,6 +246,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Folder", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher.Telemetry", "src\modules\launcher\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj", "{08C8C05F-0362-41BC-818C-724572DF8B06}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telemetry", "src\common\ManagedTelemetry\Telemetry\Telemetry.csproj", "{5D00D290-4016-4CFE-9E41-1E7C724509BA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@ -886,6 +888,22 @@ Global
{08C8C05F-0362-41BC-818C-724572DF8B06}.Release|x64.Build.0 = Release|Any CPU
{08C8C05F-0362-41BC-818C-724572DF8B06}.Release|x86.ActiveCfg = Release|Any CPU
{08C8C05F-0362-41BC-818C-724572DF8B06}.Release|x86.Build.0 = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|ARM.Build.0 = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|ARM64.Build.0 = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|x64.ActiveCfg = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|x64.Build.0 = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|x86.ActiveCfg = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|x86.Build.0 = Debug|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|ARM.ActiveCfg = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|ARM.Build.0 = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|ARM64.ActiveCfg = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|ARM64.Build.0 = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|x64.ActiveCfg = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|x64.Build.0 = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|x86.ActiveCfg = Release|Any CPU
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -954,6 +972,7 @@ Global
{437AD818-3F1F-4CA5-A79B-25233A157026} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{08C8C05F-0362-41BC-818C-724572DF8B06} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
{5D00D290-4016-4CFE-9E41-1E7C724509BA} = {1AFB6476-670D-4E80-A464-657E01DFF482}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
namespace Microsoft.PowerLauncher.Telemetry
namespace Microsoft.PowerToys.Telemetry
{
public interface IEvent
{

View File

@ -5,12 +5,12 @@
using System.Diagnostics.Tracing;
using PreviewHandlerCommon.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
namespace Microsoft.PowerToys.Telemetry
{
/// <summary>
/// Telemetry helper class for Svg renderer.
/// Telemetry helper class for PowerToys.
/// </summary>
public class PowerLauncherTelemetry : TelemetryBase
public class PowerToysTelemetry : TelemetryBase
{
/// <summary>
@ -19,9 +19,9 @@ namespace Microsoft.PowerLauncher.Telemetry
private const string EventSourceName = "Microsoft.PowerToys";
/// <summary>
/// Initializes a new instance of the <see cref="PowerLauncherTelemetry"/> class.
/// Initializes a new instance of the <see cref="PowerToysTelemetry"/> class.
/// </summary>
public PowerLauncherTelemetry()
public PowerToysTelemetry()
: base(EventSourceName)
{
}
@ -29,7 +29,7 @@ namespace Microsoft.PowerLauncher.Telemetry
/// <summary>
/// Gets an instance of the <see cref="PowerLauncherTelemetry"/> class.
/// </summary>
public static PowerLauncherTelemetry Log = new PowerLauncherTelemetry();
public static PowerToysTelemetry Log = new PowerToysTelemetry();
/// <summary>
/// Publishes ETW event when an action is triggered on

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Telemetry\TelemetryBase.cs" Link="TelemetryBase.cs" />
</ItemGroup>
</Project>

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerLauncher.Telemetry
{

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\common\Telemetry\TelemetryBase.cs" Link="TelemetryBase.cs" />
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,5 @@
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
@ -98,7 +99,7 @@ namespace PowerLauncher
bootTime.Stop();
PowerLauncherTelemetry.Log.WriteEvent(new BootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
PowerToysTelemetry.Log.WriteEvent(new BootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
//[Conditional("RELEASE")]
// check udpate every 5 hours

View File

@ -28,6 +28,7 @@ using Mages.Core.Runtime.Converters;
using System.Runtime.InteropServices;
using Microsoft.PowerLauncher.Telemetry;
using System.Timers;
using Microsoft.PowerToys.Telemetry;
namespace PowerLauncher
{
@ -66,7 +67,7 @@ namespace PowerLauncher
_firstDeleteTimer.Stop();
if (_deletePressed)
{
PowerLauncherTelemetry.Log.WriteEvent(new FirstDeleteEvent());
PowerToysTelemetry.Log.WriteEvent(new FirstDeleteEvent());
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;
@ -26,7 +27,7 @@ namespace Wox.ViewModel
ActionName = Title
};
PowerLauncherTelemetry.Log.WriteEvent(eventData);
PowerToysTelemetry.Log.WriteEvent(eventData);
}
}
}

View File

@ -19,7 +19,8 @@ using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
using Microsoft.PowerLauncher.Telemetry;
using Wox.Storage;
using Microsoft.PowerToys.Telemetry;
namespace Wox.ViewModel
{
public class MainViewModel : BaseModel, ISavable
@ -311,11 +312,11 @@ namespace Wox.ViewModel
_visibility = value;
if(value == Visibility.Visible)
{
PowerLauncherTelemetry.Log.WriteEvent(new ShowEvent());
PowerToysTelemetry.Log.WriteEvent(new ShowEvent());
}
else
{
PowerLauncherTelemetry.Log.WriteEvent(new HideEvent());
PowerToysTelemetry.Log.WriteEvent(new HideEvent());
}
}
@ -461,7 +462,7 @@ namespace Wox.ViewModel
NumResults = Results.Results.Count,
QueryLength = query.RawQuery.Length
};
PowerLauncherTelemetry.Log.WriteEvent(queryEvent);
PowerToysTelemetry.Log.WriteEvent(queryEvent);
}, currentCancellationToken);
}