2020-05-05 08:53:07 -07:00
|
|
|
|
// 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;
|
2020-07-30 12:17:08 -07:00
|
|
|
|
using Microsoft.PowerToys.Telemetry.Events;
|
2020-05-05 08:53:07 -07:00
|
|
|
|
|
2020-05-05 09:23:31 -07:00
|
|
|
|
namespace Microsoft.PowerToys.Telemetry
|
2020-05-05 08:53:07 -07:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2020-05-05 09:23:31 -07:00
|
|
|
|
/// Telemetry helper class for PowerToys.
|
2020-05-05 08:53:07 -07:00
|
|
|
|
/// </summary>
|
2020-05-05 09:23:31 -07:00
|
|
|
|
public class PowerToysTelemetry : TelemetryBase
|
2020-05-05 08:53:07 -07:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Name for ETW event.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private const string EventSourceName = "Microsoft.PowerToys";
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-05-05 09:23:31 -07:00
|
|
|
|
/// Initializes a new instance of the <see cref="PowerToysTelemetry"/> class.
|
2020-05-05 08:53:07 -07:00
|
|
|
|
/// </summary>
|
2020-05-05 09:23:31 -07:00
|
|
|
|
public PowerToysTelemetry()
|
2020-05-05 08:53:07 -07:00
|
|
|
|
: base(EventSourceName)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets an instance of the <see cref="PowerLauncherTelemetry"/> class.
|
|
|
|
|
|
/// </summary>
|
2020-07-30 12:17:08 -07:00
|
|
|
|
public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry();
|
2020-05-05 08:53:07 -07:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-30 12:17:08 -07:00
|
|
|
|
/// Publishes ETW event when an action is triggered on
|
2020-05-05 08:53:07 -07:00
|
|
|
|
/// </summary>
|
2020-05-15 09:08:39 -07:00
|
|
|
|
public void WriteEvent<T>(T telemetryEvent)
|
|
|
|
|
|
where T : EventBase, IEvent
|
2020-05-05 08:53:07 -07:00
|
|
|
|
{
|
2020-07-30 12:17:08 -07:00
|
|
|
|
this.Write<T>(
|
|
|
|
|
|
null,
|
|
|
|
|
|
new EventSourceOptions()
|
|
|
|
|
|
{
|
|
|
|
|
|
Keywords = ProjectKeywordMeasure,
|
|
|
|
|
|
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
|
|
|
|
|
},
|
|
|
|
|
|
telemetryEvent);
|
2020-05-05 08:53:07 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|