[AOT] add some mudole editor open time, timestamp telemetry code (#38008)

* add some mudole editor open time, timestamp telemetry code

* fix spelling error

* fix namespace warrning

---------

Co-authored-by: Zhaopeng Wang (from Dev Box) <zhaopengwang@microsoft.com>
This commit is contained in:
dreamstart
2025-03-18 21:52:24 +08:00
committed by GitHub
parent 1f81d14000
commit 4377de260f
16 changed files with 174 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ using System.IO.Abstractions;
using System.Threading;
using Common.UI;
using HostsEditor.Telemetry;
using HostsUILib.Helpers;
using HostsUILib.Settings;
using HostsUILib.ViewModels;
@@ -38,6 +39,8 @@ namespace Hosts
/// </summary>
public App()
{
PowerToysTelemetry.Log.WriteEvent(new HostEditorStartEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
string appLanguage = LanguageHelper.LoadLanguage();
if (!string.IsNullOrEmpty(appLanguage))
{

View File

@@ -2,10 +2,13 @@
// 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;
using Hosts.Helpers;
using HostsEditor.Telemetry;
using HostsUILib.Helpers;
using HostsUILib.Views;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
@@ -44,6 +47,8 @@ namespace Hosts
Activated += MainWindow_Activated;
MainPage = Host.GetService<HostsMainPage>();
PowerToysTelemetry.Log.WriteEvent(new HostEditorStartFinishEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
}
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace HostsEditor.Telemetry;
[EventData]
public class HostEditorStartEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace HostsEditor.Telemetry;
[EventData]
public class HostEditorStartFinishEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -6,10 +6,10 @@ using System;
using System.Globalization;
using System.Threading;
using System.Windows;
using Common.UI;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
using WorkspacesEditor.Telemetry;
using WorkspacesEditor.Utils;
using WorkspacesEditor.ViewModels;
@@ -36,6 +36,8 @@ namespace WorkspacesEditor
public App()
{
PowerToysTelemetry.Log.WriteEvent(new WorkspacesEditorStartEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
WorkspacesEditorIO = new WorkspacesEditorIO();
}

View File

@@ -10,6 +10,7 @@ using System.Windows;
using System.Windows.Interop;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
using WorkspacesEditor.Telemetry;
using WorkspacesEditor.Utils;
using WorkspacesEditor.ViewModels;
@@ -87,6 +88,8 @@ namespace WorkspacesEditor
},
Application.Current.Dispatcher,
cancellationToken.Token);
PowerToysTelemetry.Log.WriteEvent(new WorkspacesEditorStartFinishEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
}
private bool IsEditorInsideVisibleArea()

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace WorkspacesEditor.Telemetry;
[EventData]
public class WorkspacesEditorStartEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace WorkspacesEditor.Telemetry;
[EventData]
public class WorkspacesEditorStartFinishEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -5,13 +5,15 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Windows;
using System.Windows.Input;
using Common.UI;
using FancyZoneEditor.Telemetry;
using FancyZonesEditor.Utils;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
namespace FancyZonesEditor
{
@@ -56,6 +58,8 @@ namespace FancyZonesEditor
public App()
{
PowerToysTelemetry.Log.WriteEvent(new FancyZonesEditorStartEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
var languageTag = LanguageHelper.LoadLanguage();
if (!string.IsNullOrEmpty(languageTag))

View File

@@ -13,11 +13,12 @@ using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using Common.UI;
using FancyZoneEditor.Telemetry;
using FancyZonesEditor.Models;
using FancyZonesEditor.Utils;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
using ModernWpf.Controls;
namespace FancyZonesEditor
@@ -69,6 +70,8 @@ namespace FancyZonesEditor
// reinit considering work area rect
_settings.InitModels();
PowerToysTelemetry.Log.WriteEvent(new FancyZonesEditorStartFinishEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
}
private void BringToFront()

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace FancyZoneEditor.Telemetry;
[EventData]
public class FancyZonesEditorStartEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace FancyZoneEditor.Telemetry;
[EventData]
public class FancyZonesEditorStartFinishEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -4,11 +4,11 @@
using System;
using System.Web;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
using Microsoft.UI.Xaml;
using Microsoft.Windows.AppLifecycle;
using RegistryPreview.Telemetry;
using Windows.ApplicationModel.Activation;
// To learn more about WinUI, the WinUI project structure,
@@ -27,6 +27,8 @@ namespace RegistryPreview
/// </summary>
public App()
{
PowerToysTelemetry.Log.WriteEvent(new RegistryPreviewEditorStartEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
string appLanguage = LanguageHelper.LoadLanguage();
if (!string.IsNullOrEmpty(appLanguage))

View File

@@ -3,12 +3,13 @@
// See the LICENSE file in the project root for more information.
using System;
using ManagedCommon;
using Microsoft.PowerToys.Telemetry;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using RegistryPreview.Telemetry;
using RegistryPreviewUILib;
using Windows.Data.Json;
using Windows.Graphics;
@@ -87,6 +88,8 @@ namespace RegistryPreview
MainPage = new RegistryPreviewMainPage(this, this.UpdateWindowTitle, App.AppFilename);
WindowHelpers.BringToForeground(windowHandle);
PowerToysTelemetry.Log.WriteEvent(new RegistryPreviewEditorStartFinishEvent() { TimeStamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
}
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace RegistryPreview.Telemetry;
[EventData]
public class RegistryPreviewEditorStartEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}

View File

@@ -0,0 +1,18 @@
// 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 Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace RegistryPreview.Telemetry;
[EventData]
public class RegistryPreviewEditorStartFinishEvent() : EventBase, IEvent
{
public long TimeStamp { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}