[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

@@ -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;
}