mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 03:49:07 +08:00
Removing unecceary EventName requirement. EventSource<T>.Write will use the type name of T if null is passed in. This saves us passing an extra string uneccesarily as the public property would be serialized into the event data as well as being specified as the EventName
This commit is contained in:
parent
b4d75e3240
commit
1f9c1ce8e4
@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
string EventName { get; }
|
||||
}
|
||||
}
|
@ -35,9 +35,8 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
/// Publishes ETW event when an action is triggered on
|
||||
/// </summary>
|
||||
public void WriteEvent<T>(T telemetryEvent)
|
||||
where T : IEvent
|
||||
{
|
||||
this.Write<T>(telemetryEvent.EventName, new EventSourceOptions()
|
||||
this.Write<T>(null, new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
|
@ -133,7 +133,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
|
||||
private void LogTelemetryEvent(bool value, [CallerMemberName] string moduleName = null )
|
||||
{
|
||||
var dataEvent = new EnabledModuleEvent()
|
||||
var dataEvent = new SettingsEnabledModuleEvent()
|
||||
{
|
||||
Value = value,
|
||||
ModuleName = moduleName,
|
||||
|
@ -1,10 +1,9 @@
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class EnabledModuleEvent : IEvent
|
||||
public class SettingsEnabledModuleEvent
|
||||
{
|
||||
public string EventName { get; } = "Settings_EnableModule";
|
||||
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class BootEvent : IEvent
|
||||
{
|
||||
public string EventName { get; } = "PowerLauncher_Boot_Event";
|
||||
|
||||
public double BootTimeMs { get; set; }
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class FirstDeleteEvent : IEvent
|
||||
{
|
||||
public string EventName { get; } = "PowerLauncher_FirstDelete_Event";
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class HideEvent : IEvent
|
||||
{
|
||||
public string EventName { get; } = "PowerLauncher_Hide_Event";
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class LauncherBootEvent
|
||||
{
|
||||
public double BootTimeMs { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class LauncherFirstDeleteEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class LauncherHideEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
@ -10,9 +6,8 @@ namespace Microsoft.PowerLauncher.Telemetry
|
||||
/// ETW Event for when the user initiates a query
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class QueryEvent : IEvent
|
||||
public class LauncherQueryEvent
|
||||
{
|
||||
public string EventName { get; } = "PowerLauncher_Query_Event";
|
||||
public double QueryTimeMs { get; set; }
|
||||
public int QueryLength { get; set; }
|
||||
public int NumResults { get; set; }
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
@ -10,9 +6,8 @@ namespace Microsoft.PowerLauncher.Telemetry
|
||||
/// ETW event for when a result is actioned.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class ResultActionEvent : IEvent
|
||||
public class LauncherResultActionEvent
|
||||
{
|
||||
public string EventName { get; } = "PowerLauncher_Result_ActionEvent";
|
||||
|
||||
public enum TriggerType
|
||||
{
|
||||
@ -20,7 +15,7 @@ namespace Microsoft.PowerLauncher.Telemetry
|
||||
KeyboardShortcut
|
||||
}
|
||||
|
||||
public TriggerType Trigger { get; set; }
|
||||
public string Trigger { get; set; }
|
||||
public string PluginName { get; set; }
|
||||
public string ActionName { get; set; }
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class LauncherShowEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerLauncher.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class ShowEvent : IEvent
|
||||
{
|
||||
public string EventName { get; } = "PowerLauncher_Show_Event";
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace PowerLauncher.UI
|
||||
{
|
||||
public sealed partial class ResultList : UserControl
|
||||
{
|
||||
private ResultActionEvent.TriggerType triggerType = ResultActionEvent.TriggerType.Click;
|
||||
private LauncherResultActionEvent.TriggerType triggerType = LauncherResultActionEvent.TriggerType.Click;
|
||||
public ResultList()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -20,7 +20,7 @@ namespace PowerLauncher.UI
|
||||
|
||||
private void ContextButton_OnAcceleratorInvoked(Windows.UI.Xaml.Input.KeyboardAccelerator sender, Windows.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs args)
|
||||
{
|
||||
this.triggerType = ResultActionEvent.TriggerType.KeyboardShortcut;
|
||||
this.triggerType = LauncherResultActionEvent.TriggerType.KeyboardShortcut;
|
||||
}
|
||||
|
||||
private void ContextButton_OnClick(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
@ -39,7 +39,7 @@ namespace PowerLauncher.UI
|
||||
}
|
||||
|
||||
//Restore the trigger type back to click
|
||||
triggerType = ResultActionEvent.TriggerType.Click;
|
||||
triggerType = LauncherResultActionEvent.TriggerType.Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ namespace PowerLauncher
|
||||
|
||||
bootTime.Stop();
|
||||
|
||||
PowerToysTelemetry.Log.WriteEvent(new BootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
|
||||
|
||||
//[Conditional("RELEASE")]
|
||||
// check udpate every 5 hours
|
||||
|
@ -67,7 +67,7 @@ namespace PowerLauncher
|
||||
_firstDeleteTimer.Stop();
|
||||
if (_deletePressed)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new FirstDeleteEvent());
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherFirstDeleteEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ namespace Wox.ViewModel
|
||||
public string AcceleratorModifiers { get; set; }
|
||||
public bool IsAcceleratorKeyEnabled { get; set; }
|
||||
|
||||
public void SendTelemetryEvent(ResultActionEvent.TriggerType triggerType)
|
||||
public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType)
|
||||
{
|
||||
var eventData = new ResultActionEvent()
|
||||
var eventData = new LauncherResultActionEvent()
|
||||
{
|
||||
PluginName = PluginName,
|
||||
Trigger = triggerType,
|
||||
Trigger = triggerType.ToString(),
|
||||
ActionName = Title
|
||||
|
||||
};
|
||||
|
@ -312,11 +312,11 @@ namespace Wox.ViewModel
|
||||
_visibility = value;
|
||||
if(value == Visibility.Visible)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new ShowEvent());
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherShowEvent());
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new HideEvent());
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherHideEvent());
|
||||
}
|
||||
|
||||
}
|
||||
@ -456,7 +456,7 @@ namespace Wox.ViewModel
|
||||
}
|
||||
|
||||
queryTimer.Stop();
|
||||
var queryEvent = new QueryEvent()
|
||||
var queryEvent = new LauncherQueryEvent()
|
||||
{
|
||||
QueryTimeMs = queryTimer.ElapsedMilliseconds,
|
||||
NumResults = Results.Results.Count,
|
||||
|
Loading…
Reference in New Issue
Block a user