Adding privacy event tags to each telemetry event. (#2879)

* Adding privacy event tags to each telemetry event.

* Moving Privacy events to Telemetry base, Removing tag values, and fixing namespaces.

* Adding documentation comments to fix style cop errors in release

* UTCReplace_AppSessionGuid boolean property to all C# telemetry events.

* Adding hardcoded version number to boot events.

* Adding reference to telemetry in settings unittest

* Adding Preview Pane events for loading w/ hardcoded version number

* Adding telemetry.h to msi for svg and markdown events

* removing unused explicit interface exception
This commit is contained in:
ryanbodrug-microsoft
2020-05-15 09:08:39 -07:00
committed by GitHub
parent d4b56f99ff
commit 34f814717b
34 changed files with 505 additions and 354 deletions

View File

@@ -576,6 +576,7 @@
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\powerpreview.dll" KeyPath="yes" /> <File Source="$(var.BinX64Dir)modules\FileExplorerPreview\powerpreview.dll" KeyPath="yes" />
<!-- File to include common library used by preview handlers --> <!-- File to include common library used by preview handlers -->
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\PreviewHandlerCommon.dll" /> <File Source="$(var.BinX64Dir)modules\FileExplorerPreview\PreviewHandlerCommon.dll" />
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\Telemetry.dll" />
<!-- File to include dll for Svg Preview Handler --> <!-- File to include dll for Svg Preview Handler -->
<File Source="$(var.BinX64Dir)modules\FileExplorerPreview\SvgPreviewHandler.dll" /> <File Source="$(var.BinX64Dir)modules\FileExplorerPreview\SvgPreviewHandler.dll" />
<!-- Files to include dll's for Markdown Preview Handler and it's dependencies --> <!-- Files to include dll's for Markdown Preview Handler and it's dependencies -->

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Text;
namespace Microsoft.PowerToys.Telemetry.Events
{
/// <summary>
/// A base class to implement properties that are common to all telemetry events.
/// </summary>
[EventData]
public class EventBase
{
public bool UTCReplace_AppSessionGuid => true;
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.PowerToys.Telemetry.Events
{
public interface IEvent
{
PartA_PrivTags PartA_PrivTags { get; }
}
}

View File

@@ -2,8 +2,9 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing; using System.Diagnostics.Tracing;
using PreviewHandlerCommon.Telemetry;
namespace Microsoft.PowerToys.Telemetry namespace Microsoft.PowerToys.Telemetry
{ {
@@ -12,7 +13,7 @@ namespace Microsoft.PowerToys.Telemetry
/// </summary> /// </summary>
public class PowerToysTelemetry : TelemetryBase public class PowerToysTelemetry : TelemetryBase
{ {
/// <summary> /// <summary>
/// Name for ETW event. /// Name for ETW event.
/// </summary> /// </summary>
@@ -34,7 +35,8 @@ namespace Microsoft.PowerToys.Telemetry
/// <summary> /// <summary>
/// Publishes ETW event when an action is triggered on /// Publishes ETW event when an action is triggered on
/// </summary> /// </summary>
public void WriteEvent<T>(T telemetryEvent) public void WriteEvent<T>(T telemetryEvent)
where T : EventBase, IEvent
{ {
this.Write<T>(null, new EventSourceOptions() this.Write<T>(null, new EventSourceOptions()
{ {

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>

View File

@@ -4,8 +4,24 @@
using System.Diagnostics.Tracing; using System.Diagnostics.Tracing;
namespace PreviewHandlerCommon.Telemetry namespace Microsoft.PowerToys.Telemetry
{ {
/// <summary>
/// Privacy Tag values
/// </summary>
public enum PartA_PrivTags
: ulong
{
/// <nodoc/>
None = 0,
/// <nodoc/>
ProductAndServicePerformance = 0x0u,
/// <nodoc/>
ProductAndServiceUsage = 0x0u,
}
/// <summary> /// <summary>
/// Base class for telemetry events. /// Base class for telemetry events.
/// </summary> /// </summary>

View File

@@ -0,0 +1,23 @@
// 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 Microsoft.PowerLauncher.Telemetry
{
[EventData]
public class SettingsBootEvent : EventBase, IEvent
{
/// <summary>
/// Gets The version string. TODO: This should be replaced by a P/Invoke call to get_product_version
/// </summary>
public string Version => "v0.18.0";
public double BootTimeMs { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
}
}

View File

@@ -1,12 +1,16 @@
using System.Diagnostics.Tracing; using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace Microsoft.PowerToys.Settings.Telemetry namespace Microsoft.PowerToys.Settings.Telemetry
{ {
[EventData] [EventData]
public class SettingsEnabledEvent public class SettingsEnabledEvent : EventBase, IEvent
{ {
public string Name { get; set; } public string Name { get; set; }
public bool Value { get; set; } public bool Value { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
} }
} }

View File

@@ -4,7 +4,9 @@
using System; using System;
using System.Windows; using System.Windows;
using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Settings.UI.Views; using Microsoft.PowerToys.Settings.UI.Views;
using Microsoft.PowerToys.Telemetry;
using Microsoft.Toolkit.Wpf.UI.XamlHost; using Microsoft.Toolkit.Wpf.UI.XamlHost;
using Windows.UI.Popups; using Windows.UI.Popups;
@@ -14,8 +16,14 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
public MainWindow() public MainWindow()
{ {
this.InitializeComponent(); var bootTime = new System.Diagnostics.Stopwatch();
bootTime.Start();
this.InitializeComponent();
bootTime.Stop();
PowerToysTelemetry.Log.WriteEvent(new SettingsBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
} }
private void WindowsXamlHost_ChildChanged(object sender, EventArgs e) private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
@@ -29,7 +37,7 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
// send IPC Message // send IPC Message
shellPage.SetDefaultSndMessageCallback(msg => shellPage.SetDefaultSndMessageCallback(msg =>
{ {
//IPC Manager is null when launching runner directly // IPC Manager is null when launching runner directly
Program.GetTwoWayIPCManager()?.Send(msg); Program.GetTwoWayIPCManager()?.Send(msg);
}); });

View File

@@ -68,6 +68,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\common\interop\interop.vcxproj" /> <ProjectReference Include="..\..\common\interop\interop.vcxproj" />
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj" />
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj" />
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" /> <ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -231,6 +231,10 @@
</AdditionalFiles> </AdditionalFiles>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj">
<Project>{5d00d290-4016-4cfe-9e41-1e7c724509ba}</Project>
<Name>Telemetry</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj"> <ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj">
<Project>{b1bcc8c6-46b5-4bfa-8f22-20f32d99ec6a}</Project> <Project>{b1bcc8c6-46b5-4bfa-8f22-20f32d99ec6a}</Project>
<Name>Microsoft.PowerToys.Settings.UI.Lib</Name> <Name>Microsoft.PowerToys.Settings.UI.Lib</Name>

View File

@@ -1,191 +1,195 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{A80355C2-780D-4245-BD80-25B8DE698EE3}</ProjectGuid> <ProjectGuid>{A80355C2-780D-4245-BD80-25B8DE698EE3}</ProjectGuid>
<OutputType>AppContainerExe</OutputType> <OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.PowerToys.Settings.UnitTest</RootNamespace> <RootNamespace>Microsoft.PowerToys.Settings.UnitTest</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Settings.UnitTest</AssemblyName> <AssemblyName>Microsoft.PowerToys.Settings.UnitTest</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion> <TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion> <UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled> <AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath> <OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath> <OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget> <PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath> <OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget> <PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM64\Debug\</OutputPath> <OutputPath>bin\ARM64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>ARM64</PlatformTarget> <PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<OutputPath>bin\ARM64\Release\</OutputPath> <OutputPath>bin\ARM64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>ARM64</PlatformTarget> <PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\Test\</OutputPath> <OutputPath>bin\x64\Debug\Test\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<NoWarn>;2008</NoWarn> <NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain> <UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" /> <SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ViewModelTests\FancyZones.cs" /> <Compile Include="ViewModelTests\FancyZones.cs" />
<Compile Include="ViewModelTests\General.cs" /> <Compile Include="ViewModelTests\General.cs" />
<Compile Include="ModelsTests\HelperTest.cs" /> <Compile Include="ModelsTests\HelperTest.cs" />
<Compile Include="ViewModelTests\ImageResizer.cs" /> <Compile Include="ViewModelTests\ImageResizer.cs" />
<Compile Include="ModelsTests\BasePTModuleSettingsTest.cs" /> <Compile Include="ModelsTests\BasePTModuleSettingsTest.cs" />
<Compile Include="ModelsTests\BasePTSettingsTest.cs" /> <Compile Include="ModelsTests\BasePTSettingsTest.cs" />
<Compile Include="ModelsTests\SettingsUtilsTests.cs" /> <Compile Include="ModelsTests\SettingsUtilsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnitTestApp.xaml.cs"> <Compile Include="UnitTestApp.xaml.cs">
<DependentUpon>UnitTestApp.xaml</DependentUpon> <DependentUpon>UnitTestApp.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ViewModelTests\PowerRename.cs" /> <Compile Include="ViewModelTests\PowerRename.cs" />
<Compile Include="ViewModelTests\PowerPreview.cs" /> <Compile Include="ViewModelTests\PowerPreview.cs" />
<Compile Include="ViewModelTests\ShortcutGuide.cs" /> <Compile Include="ViewModelTests\ShortcutGuide.cs" />
<Compile Include="ViewModelTests\PowerLauncherViewModelTest.cs" /> <Compile Include="ViewModelTests\PowerLauncherViewModelTest.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ApplicationDefinition Include="UnitTestApp.xaml"> <ApplicationDefinition Include="UnitTestApp.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AppxManifest Include="Package.appxmanifest"> <AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AppxManifest> </AppxManifest>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Assets\LockScreenLogo.scale-200.png" /> <Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" /> <Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" /> <Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" /> <Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" /> <Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" /> <Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.9</Version> <Version>6.2.9</Version>
</PackageReference> </PackageReference>
<PackageReference Include="MSTest.TestAdapter"> <PackageReference Include="MSTest.TestAdapter">
<Version>2.1.1</Version> <Version>2.1.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="MSTest.TestFramework"> <PackageReference Include="MSTest.TestFramework">
<Version>2.1.1</Version> <Version>2.1.1</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj"> <ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj">
<Project>{b1bcc8c6-46b5-4bfa-8f22-20f32d99ec6a}</Project> <Project>{5d00d290-4016-4cfe-9e41-1e7c724509ba}</Project>
<Name>Microsoft.PowerToys.Settings.UI.Lib</Name> <Name>Telemetry</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj"> <ProjectReference Include="..\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj">
<Project>{a7d5099e-f0fd-4bf3-8522-5a682759f915}</Project> <Project>{b1bcc8c6-46b5-4bfa-8f22-20f32d99ec6a}</Project>
<Name>Microsoft.PowerToys.Settings.UI</Name> <Name>Microsoft.PowerToys.Settings.UI.Lib</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> <ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj">
<ItemGroup /> <Project>{a7d5099e-f0fd-4bf3-8522-5a682759f915}</Project>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' "> <Name>Microsoft.PowerToys.Settings.UI</Name>
<VisualStudioVersion>14.0</VisualStudioVersion> </ProjectReference>
</PropertyGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> <ItemGroup />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
</Target> </Target>
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>

View File

@@ -1,10 +1,19 @@
using System.Diagnostics.Tracing; using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
[EventData] [EventData]
public class LauncherBootEvent public class LauncherBootEvent : EventBase, IEvent
{ {
/// <summary>
/// TODO: This should be replaced by a P/Invoke call to get_product_version
/// </summary>
public string Version => "v0.18.0";
public double BootTimeMs { get; set; } public double BootTimeMs { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
} }
} }

View File

@@ -1,9 +1,16 @@
using System.Diagnostics.Tracing; // 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
[EventData] [EventData]
public class LauncherFirstDeleteEvent public class LauncherFirstDeleteEvent : EventBase, IEvent
{ {
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
} }
} }

View File

@@ -1,9 +1,12 @@
using System.Diagnostics.Tracing; using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
[EventData] [EventData]
public class LauncherHideEvent public class LauncherHideEvent : EventBase, IEvent
{ {
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
} }
} }

View File

@@ -1,4 +1,10 @@
using System.Diagnostics.Tracing; // 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
@@ -6,11 +12,13 @@ namespace Microsoft.PowerLauncher.Telemetry
/// ETW Event for when the user initiates a query /// ETW Event for when the user initiates a query
/// </summary> /// </summary>
[EventData] [EventData]
public class LauncherQueryEvent public class LauncherQueryEvent : EventBase, IEvent
{ {
public double QueryTimeMs { get; set; } public double QueryTimeMs { get; set; }
public int QueryLength { get; set; } public int QueryLength { get; set; }
public int NumResults { get; set; } public int NumResults { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
} }
} }

View File

@@ -1,4 +1,10 @@
using System.Diagnostics.Tracing; // 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
@@ -6,7 +12,7 @@ namespace Microsoft.PowerLauncher.Telemetry
/// ETW event for when a result is actioned. /// ETW event for when a result is actioned.
/// </summary> /// </summary>
[EventData] [EventData]
public class LauncherResultActionEvent public class LauncherResultActionEvent : EventBase, IEvent
{ {
public enum TriggerType public enum TriggerType
@@ -18,5 +24,7 @@ namespace Microsoft.PowerLauncher.Telemetry
public string Trigger { get; set; } public string Trigger { get; set; }
public string PluginName { get; set; } public string PluginName { get; set; }
public string ActionName { get; set; } public string ActionName { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
} }
} }

View File

@@ -1,9 +1,16 @@
using System.Diagnostics.Tracing; // 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
using System.Diagnostics.Tracing;
namespace Microsoft.PowerLauncher.Telemetry namespace Microsoft.PowerLauncher.Telemetry
{ {
[EventData] [EventData]
public class LauncherShowEvent public class LauncherShowEvent : EventBase, IEvent
{ {
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
} }
} }

View File

@@ -107,6 +107,10 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj">
<Project>{5d00d290-4016-4cfe-9e41-1e7c724509ba}</Project>
<Name>Telemetry</Name>
</ProjectReference>
<ProjectReference Include="..\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj"> <ProjectReference Include="..\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj">
<Project>{08c8c05f-0362-41bc-818c-724572df8b06}</Project> <Project>{08c8c05f-0362-41bc-818c-724572df8b06}</Project>
<Name>PowerLauncher.Telemetry</Name> <Name>PowerLauncher.Telemetry</Name>

View File

@@ -101,7 +101,6 @@
<Compile Include="Generated Files\AssemblyInfo.cs"> <Compile Include="Generated Files\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="MarkdownTelemetry.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
@@ -112,6 +111,9 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
</Compile> </Compile>
<Compile Include="Telemetry\Events\MarkdownFileHandlerLoaded.cs" />
<Compile Include="Telemetry\Events\MarkdownFilePreviewed.cs" />
<Compile Include="Telemetry\Events\MarkdownFilePreviewError.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="HtmlAgilityPack"> <PackageReference Include="HtmlAgilityPack">
@@ -132,6 +134,10 @@
</AdditionalFiles> </AdditionalFiles>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj">
<Project>{5D00D290-4016-4CFE-9E41-1E7C724509BA}</Project>
<Name>Telemetry</Name>
</ProjectReference>
<ProjectReference Include="..\common\PreviewHandlerCommon.csproj"> <ProjectReference Include="..\common\PreviewHandlerCommon.csproj">
<Project>{af2349b8-e5b6-4004-9502-687c1c7730b1}</Project> <Project>{af2349b8-e5b6-4004-9502-687c1c7730b1}</Project>
<Name>PreviewHandlerCommon</Name> <Name>PreviewHandlerCommon</Name>

View File

@@ -0,0 +1,25 @@
// 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 MarkdownPreviewHandler.Telemetry.Events
{
/// <summary>
/// A telemetry event that is triggered when a markdown file is viewed in the preview pane.
/// </summary>
[EventData]
public class MarkdownFileHandlerLoaded : EventBase, IEvent
{
/// <summary>
/// Gets The version string. TODO: This should be replaced by a P/Invoke call to get_product_version.
/// </summary>
public string Version => "v0.18.0";
/// <inheritdoc/>
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -0,0 +1,23 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace MarkdownPreviewHandler.Telemetry.Events
{
/// <summary>
/// A telemetry event that is triggered when an error occurs while attempting to view a markdown file in the preview pane.
/// </summary>
public class MarkdownFilePreviewError : EventBase, IEvent
{
/// <summary>
/// Gets or sets the error message.
/// </summary>
public string Message { get; set; }
/// <inheritdoc/>
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
}
}

View File

@@ -0,0 +1,20 @@
// 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 MarkdownPreviewHandler.Telemetry.Events
{
/// <summary>
/// A telemetry event that is triggered when a markdown file is viewed in the preview pane.
/// </summary>
[EventData]
public class MarkdownFilePreviewed : EventBase, IEvent
{
/// <inheritdoc/>
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -5,6 +5,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Common; using Common;
using Microsoft.PowerToys.Telemetry;
namespace MarkdownPreviewHandler namespace MarkdownPreviewHandler
{ {
@@ -27,6 +28,7 @@ namespace MarkdownPreviewHandler
/// <inheritdoc /> /// <inheritdoc />
protected override IPreviewHandlerControl CreatePreviewHandlerControl() protected override IPreviewHandlerControl CreatePreviewHandlerControl()
{ {
PowerToysTelemetry.Log.WriteEvent(new Telemetry.Events.MarkdownFileHandlerLoaded());
this.markdownPreviewHandlerControl = new MarkdownPreviewHandlerControl(); this.markdownPreviewHandlerControl = new MarkdownPreviewHandlerControl();
return this.markdownPreviewHandlerControl; return this.markdownPreviewHandlerControl;
} }

View File

@@ -10,6 +10,8 @@ using System.Windows.Forms;
using Common; using Common;
using Markdig; using Markdig;
using MarkdownPreviewHandler.Properties; using MarkdownPreviewHandler.Properties;
using MarkdownPreviewHandler.Telemetry.Events;
using Microsoft.PowerToys.Telemetry;
using PreviewHandlerCommon; using PreviewHandlerCommon;
namespace MarkdownPreviewHandler namespace MarkdownPreviewHandler
@@ -112,11 +114,11 @@ namespace MarkdownPreviewHandler
} }
}); });
MarkdownTelemetry.Log.MarkdownFilePreviewed(); PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewed());
} }
catch (Exception e) catch (Exception e)
{ {
MarkdownTelemetry.Log.MarkdownFilePreviewError(e.Message); PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewError { Message = e.Message });
this.InvokeOnControlThread(() => this.InvokeOnControlThread(() =>
{ {

View File

@@ -1,71 +0,0 @@
// 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 PreviewHandlerCommon.Telemetry;
namespace MarkdownPreviewHandler
{
/// <summary>
/// Telemetry helper class for markdown renderer.
/// </summary>
public class MarkdownTelemetry : TelemetryBase
{
/// <summary>
/// Name for ETW event.
/// </summary>
private const string EventSourceName = "Microsoft.PowerToys";
/// <summary>
/// ETW event name when markdown is previewed.
/// </summary>
private const string MarkdownFilePreviewedEventName = "PowerPreview_MDRenderer_Previewed";
/// <summary>
/// ETW event name when error is thrown during markdown preview.
/// </summary>
private const string MarkdownFilePreviewErrorEventName = "PowerPreview_MDRenderer_Error";
/// <summary>
/// Initializes a new instance of the <see cref="MarkdownTelemetry"/> class.
/// </summary>
public MarkdownTelemetry()
: base(EventSourceName)
{
return;
}
/// <summary>
/// Gets an instance of the <see cref="MarkdownTelemetry"/> class.
/// </summary>
public static MarkdownTelemetry Log { get; } = new MarkdownTelemetry();
/// <summary>
/// Publishes ETW event when markdown is previewed successfully.
/// </summary>
public void MarkdownFilePreviewed()
{
this.Write(MarkdownFilePreviewedEventName, new EventSourceOptions()
{
Keywords = ProjectKeywordMeasure,
Tags = ProjectTelemetryTagProductAndServicePerformance,
});
}
/// <summary>
/// Publishes ETW event when markdown could not be previewed.
/// </summary>
public void MarkdownFilePreviewError(string message)
{
this.Write(
MarkdownFilePreviewErrorEventName,
new EventSourceOptions()
{
Keywords = ProjectKeywordMeasure,
Tags = ProjectTelemetryTagProductAndServicePerformance,
},
new { Message = message, });
}
}
}

View File

@@ -14,7 +14,9 @@ using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using Common; using Common;
using Common.Utilities; using Common.Utilities;
using Microsoft.PowerToys.Telemetry;
using PreviewHandlerCommon; using PreviewHandlerCommon;
using SvgPreviewHandler.Telemetry.Events;
using SvgPreviewHandler.Utilities; using SvgPreviewHandler.Utilities;
namespace SvgPreviewHandler namespace SvgPreviewHandler
@@ -69,11 +71,11 @@ namespace SvgPreviewHandler
this.AddBrowserControl(svgData); this.AddBrowserControl(svgData);
this.Resize += this.FormResized; this.Resize += this.FormResized;
base.DoPreview(dataSource); base.DoPreview(dataSource);
SvgTelemetry.Log.SvgFilePreviewed(); PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewed());
} }
catch (Exception ex) catch (Exception ex)
{ {
SvgTelemetry.Log.SvgFilePreviewError(ex.Message); PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = ex.Message });
this.Controls.Clear(); this.Controls.Clear();
this.infoBarAdded = true; this.infoBarAdded = true;
this.AddTextBoxControl(Resource.SvgNotPreviewedError); this.AddTextBoxControl(Resource.SvgNotPreviewedError);

View File

@@ -5,6 +5,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Common; using Common;
using Microsoft.PowerToys.Telemetry;
namespace SvgPreviewHandler namespace SvgPreviewHandler
{ {
@@ -27,6 +28,7 @@ namespace SvgPreviewHandler
/// <inheritdoc/> /// <inheritdoc/>
protected override IPreviewHandlerControl CreatePreviewHandlerControl() protected override IPreviewHandlerControl CreatePreviewHandlerControl()
{ {
PowerToysTelemetry.Log.WriteEvent(new Telemetry.Events.SvgFileHandlerLoaded());
this.svgPreviewControl = new SvgPreviewControl(); this.svgPreviewControl = new SvgPreviewControl();
return this.svgPreviewControl; return this.svgPreviewControl;
} }

View File

@@ -107,10 +107,16 @@
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="SvgPreviewHandler.cs" /> <Compile Include="SvgPreviewHandler.cs" />
<Compile Include="SvgTelemetry.cs" /> <Compile Include="Telemetry\Events\SvgFileHandlerLoaded.cs" />
<Compile Include="Telemetry\Events\SvgFilePreviewed.cs" />
<Compile Include="Telemetry\Events\SvgFilePreviewError.cs" />
<Compile Include="Utilities\SvgPreviewHandlerHelper.cs" /> <Compile Include="Utilities\SvgPreviewHandlerHelper.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\Telemetry.csproj">
<Project>{5D00D290-4016-4CFE-9E41-1E7C724509BA}</Project>
<Name>Telemetry</Name>
</ProjectReference>
<ProjectReference Include="..\common\PreviewHandlerCommon.csproj"> <ProjectReference Include="..\common\PreviewHandlerCommon.csproj">
<Project>{af2349b8-e5b6-4004-9502-687c1c7730b1}</Project> <Project>{af2349b8-e5b6-4004-9502-687c1c7730b1}</Project>
<Name>PreviewHandlerCommon</Name> <Name>PreviewHandlerCommon</Name>

View File

@@ -1,70 +0,0 @@
// 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 PreviewHandlerCommon.Telemetry;
namespace SvgPreviewHandler
{
/// <summary>
/// Telemetry helper class for Svg renderer.
/// </summary>
public class SvgTelemetry : TelemetryBase
{
/// <summary>
/// Name for ETW event.
/// </summary>
private const string EventSourceName = "Microsoft.PowerToys";
/// <summary>
/// ETW event name when Svg is previewed.
/// </summary>
private const string SvgFilePreviewedEventName = "PowerPreview_SVGRenderer_Previewed";
/// <summary>
/// ETW event name when error is thrown during Svg preview.
/// </summary>
private const string SvgFilePreviewErrorEventName = "PowerPreview_SVGRenderer_Error";
/// <summary>
/// Initializes a new instance of the <see cref="SvgTelemetry"/> class.
/// </summary>
public SvgTelemetry()
: base(EventSourceName)
{
}
/// <summary>
/// Gets an instance of the <see cref="SvgTelemetry"/> class.
/// </summary>
public static SvgTelemetry Log { get; } = new SvgTelemetry();
/// <summary>
/// Publishes ETW event when svg is previewed successfully.
/// </summary>
public void SvgFilePreviewed()
{
this.Write(SvgFilePreviewedEventName, new EventSourceOptions()
{
Keywords = ProjectKeywordMeasure,
Tags = ProjectTelemetryTagProductAndServicePerformance,
});
}
/// <summary>
/// Publishes ETW event when svg could not be previewed.
/// </summary>
public void SvgFilePreviewError(string message)
{
this.Write(
SvgFilePreviewErrorEventName,
new EventSourceOptions()
{
Keywords = ProjectKeywordMeasure,
Tags = ProjectTelemetryTagProductAndServicePerformance,
},
new { Message = message, });
}
}
}

View File

@@ -0,0 +1,25 @@
// 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 SvgPreviewHandler.Telemetry.Events
{
/// <summary>
/// A telemetry event to be raised when a svg file has been viewed in the preview pane.
/// </summary>
[EventData]
public class SvgFileHandlerLoaded : EventBase, IEvent
{
/// <summary>
/// Gets The version string. TODO: This should be replaced by a P/Invoke call to get_product_version.
/// </summary>
public string Version => "v0.18.0";
/// <inheritdoc/>
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -0,0 +1,25 @@
// 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 SvgPreviewHandler.Telemetry.Events
{
/// <summary>
/// A telemetry event to be raised when an error has occured in the preview pane.
/// </summary>
[EventData]
public class SvgFilePreviewError : EventBase, IEvent
{
/// <summary>
/// Gets or sets the error messsage to log as part of the telemetry event.
/// </summary>
public string Message { get; set; }
/// <inheritdoc/>
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
}
}

View File

@@ -0,0 +1,20 @@
// 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 SvgPreviewHandler.Telemetry.Events
{
/// <summary>
/// A telemetry event to be raised when a svg file has been viewed in the preview pane.
/// </summary>
[EventData]
public class SvgFilePreviewed : EventBase, IEvent
{
/// <inheritdoc/>
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -93,9 +93,6 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\..\common\Telemetry\TelemetryBase.cs">
<Link>Telemetry\TelemetryBase.cs</Link>
</Compile>
<Compile Include="cominterop\IInitializeWithFile.cs" /> <Compile Include="cominterop\IInitializeWithFile.cs" />
<Compile Include="cominterop\COLORREF.cs" /> <Compile Include="cominterop\COLORREF.cs" />
<Compile Include="cominterop\IInitializeWithStream.cs" /> <Compile Include="cominterop\IInitializeWithStream.cs" />