[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

@@ -168,6 +168,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
string etwDirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\etw");
DeleteDiagnosticDataOlderThan28Days(etwDirPath);
string localLowEtwDirPath = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw");
DeleteDiagnosticDataOlderThan28Days(localLowEtwDirPath);
InitializeLanguages();
}
@@ -1253,7 +1256,26 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
internal void ViewDiagnosticData()
{
string localLowEtwDirPath = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw");
string etwDirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\etw");
string[] localLowEtlFiles = Directory.GetFiles(localLowEtwDirPath, "*.etl");
foreach (string file in localLowEtlFiles)
{
string fileName = Path.GetFileName(file);
string destFile = Path.Combine(etwDirPath, fileName);
try
{
File.Copy(file, destFile, overwrite: true);
}
catch (Exception ex)
{
Logger.LogError($"Failed to copy etl file: {fileName}. Error: {ex.Message}");
}
}
string tracerptPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "system32");
ETLConverter converter = new ETLConverter(etwDirPath, tracerptPath);