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

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

View File

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