[Telemetry]Re-add preview handlers telemetry logs and add tracers (#35597)

This commit is contained in:
Stefan Markovic
2024-10-28 13:09:08 +01:00
committed by GitHub
parent 64845b7fd8
commit 515f2386d9
26 changed files with 488 additions and 4 deletions

View File

@@ -4,6 +4,8 @@
using Common;
using Microsoft.PowerToys.FilePreviewCommon;
using Microsoft.PowerToys.PreviewHandler.Gcode.Telemetry.Events;
using Microsoft.PowerToys.Telemetry;
namespace Microsoft.PowerToys.PreviewHandler.Gcode
{
@@ -84,6 +86,13 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
Resize += FormResized;
base.DoPreview(fs);
try
{
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewed());
}
catch
{ // Should not crash if sending telemetry is failing. Ignore the exception.
}
}
catch (Exception ex)
{
@@ -153,6 +162,14 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
/// <param name="dataSource">Stream reference to access source file.</param>
private void PreviewError<T>(Exception exception, T dataSource)
{
try
{
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewError { Message = exception.Message });
}
catch
{ // Should not crash if sending telemetry is failing. Ignore the exception.
}
Controls.Clear();
_infoBarAdded = true;
AddTextBoxControl(Properties.Resource.GcodeNotPreviewedError);