Add telemetry for settings UI traffic (#19156)

## Summary of the Pull Request
Adds a telemetry provider to the Terminal.Settings.Editor project as
well as new telemetry events to track traffic through the settings UI.
Specifically, the following events were added:
- `NavigatedToPage`: Event emitted when the user navigates to a page in
the settings UI
- Has a `PageId` parameter that includes the identifier of the page that
was navigated to
- (conditionally added when PageId = `page.editColorScheme`)
`SchemeName` parameter tracks the name of the color scheme that's being
edited
   - conditionally added when PageId = `page.extensions`:
- `ExtensionPackageCount`: The number of extension packages displayed
- `ProfilesModifiedCount`: The number of profiles modified by enabled
extensions
- `ProfilesAddedCount`: The number of profiles added by enabled
extensions
- `ColorSchemesAddedCount`: The number of color schemes added by enabled
extensions
   - conditionally added when PageId = `page.extensions.extensionView`:
- `FragmentSource`: The source of the fragment included in this
extension package
- `FragmentCount`: The number of fragments included in this extension
package
      - `Enabled`: The enabled status of the extension
- (conditionally added when PageID = `page.newTabMenu`) if the page is
representing a folder view
   - conditionally added when PageID = `page.profile.*`:
- `IsProfileDefaults`: if the modified profile is the profile.defaults
object
      - `ProfileGuid`: the guid of the profile that was navigated to
      - `ProfileSource`: the source of the profile that was navigated to
- conditionally added when PageID = `page.profile` (aka the base profile
page):
         - `Orphaned`: tracks if the profile was orphaned
         - `Hidden`: tracks if the profile is hidden
- (conditionally added when PageID = `page.profile.appearance`)
`HasBackgroundImage`: `if the profile has a background image defined`
- (conditionally added when PageID = `page.profile.appearance`)
`HasUnfocusedAppearance`: `if the profile has an unfocused appearance
defined`
- `AddNewProfile`: Event emitted when the user adds a new profile
`IsExtensionView` parameter tracks if the page is representing a view of
an extension
- Has a `Type` parameter that represents the type of the creation method
(i.e. empty profile, duplicate)
- `ResetApplicationState`: Event emitted when the user resets their
application state (via the UI)
- `ResetToDefaultSettings`: Event emitted when the user resets their
settings to their default value (via the UI)
- `OpenJson`: Event emitted when the user clicks the Open JSON button in
the settings UI
- Has a `SettingsTarget` parameter that represents the target settings
file (i.e. settings.json vs defaults.json)
- `CreateUnfocusedAppearance`: Event emitted when the user creates an
unfocused appearance for a profile
- `IsProfileDefaults`: if the modified profile is the profile.defaults
object
   - `ProfileGuid`: the guid of the profile that was navigated to
   - `ProfileSource`: the source of the profile that was navigated to
- `DeleteProfile`: Event emitted when the user deletes a profile
- also includes `ProfileGuid`, `ProfileSource`, `Orphaned` from the
`NavigatedToPage` section above

The page ids can be reused later as a serialized reference to the page.
We already use the one for the extensions page for the "new" badge.
This commit is contained in:
Carlos Zamora 2025-08-21 17:06:20 -07:00 committed by GitHub
parent 2c666aa292
commit 7578209be5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 279 additions and 8 deletions

View File

@ -66,6 +66,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
} }
} }
}); });
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("actions", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Actions::AddNew_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*eventArgs*/) void Actions::AddNew_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*eventArgs*/)

View File

@ -29,11 +29,27 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void AddProfile::OnNavigatedTo(const NavigationEventArgs& e) void AddProfile::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_State = e.Parameter().as<Editor::AddProfilePageNavigationState>(); _State = e.Parameter().as<Editor::AddProfilePageNavigationState>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("addProfile", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void AddProfile::AddNewClick(const IInspectable& /*sender*/, void AddProfile::AddNewClick(const IInspectable& /*sender*/,
const Windows::UI::Xaml::RoutedEventArgs& /*eventArgs*/) const Windows::UI::Xaml::RoutedEventArgs& /*eventArgs*/)
{ {
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"AddNewProfile",
TraceLoggingDescription("Event emitted when the user adds a new profile"),
TraceLoggingValue("EmptyProfile", "Type", "The type of the creation method (i.e. empty profile, duplicate)"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
_State.RequestAddNew(); _State.RequestAddNew();
} }
@ -42,7 +58,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{ {
if (const auto selected = Profiles().SelectedItem()) if (const auto selected = Profiles().SelectedItem())
{ {
_State.RequestDuplicate(selected.try_as<Model::Profile>().Guid()); const auto selectedProfile = selected.as<Model::Profile>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"AddNewProfile",
TraceLoggingDescription("Event emitted when the user adds a new profile"),
TraceLoggingValue("Duplicate", "Type", "The type of the creation method (i.e. empty profile, duplicate)"),
TraceLoggingValue(!selectedProfile.Source().empty(), "SourceProfileHasSource", "True, if the source profile has a source (i.e. dynamic profile generator namespace, fragment). Otherwise, False, indicating it's based on a custom profile."),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
_State.RequestDuplicate(selectedProfile.Guid());
} }
} }

View File

@ -44,6 +44,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
ColorSchemeListView().Focus(FocusState::Programmatic); ColorSchemeListView().Focus(FocusState::Programmatic);
}); });
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("colorSchemes", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void ColorSchemes::AddNew_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/) void ColorSchemes::AddNew_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)

View File

@ -25,11 +25,25 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void CompatibilityViewModel::ResetApplicationState() void CompatibilityViewModel::ResetApplicationState()
{ {
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"ResetApplicationState",
TraceLoggingDescription("Event emitted when the user resets their application state"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
_settings.ResetApplicationState(); _settings.ResetApplicationState();
} }
void CompatibilityViewModel::ResetToDefaultSettings() void CompatibilityViewModel::ResetToDefaultSettings()
{ {
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"ResetToDefaultSettings",
TraceLoggingDescription("Event emitted when the user resets their settings to their default value"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
_settings.ResetToDefaultSettings(); _settings.ResetToDefaultSettings();
} }
@ -41,6 +55,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Compatibility::OnNavigatedTo(const NavigationEventArgs& e) void Compatibility::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>(); _ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("compatibility", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Compatibility::ResetApplicationStateButton_Click(const Windows::Foundation::IInspectable& /*sender*/, const Windows::UI::Xaml::RoutedEventArgs& /*e*/) void Compatibility::ResetApplicationStateButton_Click(const Windows::Foundation::IInspectable& /*sender*/, const Windows::UI::Xaml::RoutedEventArgs& /*e*/)

View File

@ -42,7 +42,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{ {
_ViewModel = e.Parameter().as<Editor::ColorSchemeViewModel>(); _ViewModel = e.Parameter().as<Editor::ColorSchemeViewModel>();
NameBox().Text(_ViewModel.Name()); const auto schemeName = _ViewModel.Name();
NameBox().Text(schemeName);
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("colorSchemes.editColorScheme", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(schemeName.data(), "SchemeName", "The name of the color scheme that's being edited"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void EditColorScheme::ColorPickerChanged(const IInspectable& sender, void EditColorScheme::ColorPickerChanged(const IInspectable& sender,

View File

@ -20,8 +20,6 @@ using namespace winrt::Windows::UI::Xaml::Navigation;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{ {
static constexpr std::wstring_view ExtensionPageId{ L"page.extensions" };
Extensions::Extensions() Extensions::Extensions()
{ {
InitializeComponent(); InitializeComponent();
@ -41,6 +39,36 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
vmImpl->ExtensionPackageIdentifierTemplateSelector(_extensionPackageIdentifierTemplateSelector); vmImpl->ExtensionPackageIdentifierTemplateSelector(_extensionPackageIdentifierTemplateSelector);
vmImpl->LazyLoadExtensions(); vmImpl->LazyLoadExtensions();
vmImpl->MarkAsVisited(); vmImpl->MarkAsVisited();
if (vmImpl->IsExtensionView())
{
const auto currentPkgVM = vmImpl->CurrentExtensionPackage();
const auto currentPkg = currentPkgVM.Package();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("extensions.extensionView", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(currentPkg.Source().c_str(), "FragmentSource", "The source of the fragment included in this extension package"),
TraceLoggingValue(currentPkgVM.FragmentExtensions().Size(), "FragmentCount", "The number of fragments included in this extension package"),
TraceLoggingValue(currentPkgVM.Enabled(), "Enabled", "The enabled status of the extension"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}
else
{
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("extensions", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(vmImpl->ExtensionPackages().Size(), "ExtensionPackageCount", "The number of extension packages displayed"),
TraceLoggingValue(vmImpl->ProfilesModified().Size(), "ProfilesModifiedCount", "The number of profiles modified by enabled extensions"),
TraceLoggingValue(vmImpl->ProfilesAdded().Size(), "ProfilesAddedCount", "The number of profiles added by enabled extensions"),
TraceLoggingValue(vmImpl->ColorSchemesAdded().Size(), "ColorSchemesAddedCount", "The number of color schemes added by enabled extensions"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}
} }
void Extensions::ExtensionNavigator_Click(const IInspectable& sender, const RoutedEventArgs& /*args*/) void Extensions::ExtensionNavigator_Click(const IInspectable& sender, const RoutedEventArgs& /*args*/)
@ -338,7 +366,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
bool ExtensionsViewModel::DisplayBadge() const noexcept bool ExtensionsViewModel::DisplayBadge() const noexcept
{ {
return !Model::ApplicationState::SharedInstance().BadgeDismissed(ExtensionPageId); return !Model::ApplicationState::SharedInstance().BadgeDismissed(L"page.extensions");
} }
// Returns true if the extension is enabled, false otherwise // Returns true if the extension is enabled, false otherwise
@ -411,7 +439,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void ExtensionsViewModel::MarkAsVisited() void ExtensionsViewModel::MarkAsVisited()
{ {
Model::ApplicationState::SharedInstance().DismissBadge(ExtensionPageId); Model::ApplicationState::SharedInstance().DismissBadge(L"page.extensions");
_NotifyChanges(L"DisplayBadge"); _NotifyChanges(L"DisplayBadge");
} }

View File

@ -25,5 +25,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void GlobalAppearance::OnNavigatedTo(const NavigationEventArgs& e) void GlobalAppearance::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_ViewModel = e.Parameter().as<Editor::GlobalAppearanceViewModel>(); _ViewModel = e.Parameter().as<Editor::GlobalAppearanceViewModel>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("globalAppearance", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
} }

View File

@ -22,5 +22,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Interaction::OnNavigatedTo(const NavigationEventArgs& e) void Interaction::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_ViewModel = e.Parameter().as<Editor::InteractionViewModel>(); _ViewModel = e.Parameter().as<Editor::InteractionViewModel>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("interaction", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
} }

View File

@ -43,5 +43,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_ViewModel = e.Parameter().as<Editor::LaunchViewModel>(); _ViewModel = e.Parameter().as<Editor::LaunchViewModel>();
auto innerViewModel{ winrt::get_self<Editor::implementation::LaunchViewModel>(_ViewModel) }; auto innerViewModel{ winrt::get_self<Editor::implementation::LaunchViewModel>(_ViewModel) };
/* coroutine dispatch */ innerViewModel->PrepareStartOnUserLoginSettings(); /* coroutine dispatch */ innerViewModel->PrepareStartOnUserLoginSettings();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("startup", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
} }

View File

@ -374,6 +374,15 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
const auto altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) || const auto altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down); WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
const auto target = altPressed ? SettingsTarget::DefaultsFile : SettingsTarget::SettingsFile; const auto target = altPressed ? SettingsTarget::DefaultsFile : SettingsTarget::SettingsFile;
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"OpenJson",
TraceLoggingDescription("Event emitted when the user clicks the Open JSON button in the settings UI"),
TraceLoggingValue(target == SettingsTarget::DefaultsFile ? "DefaultsFile" : "SettingsFile", "SettingsTarget", "The target settings file"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
OpenJson.raise(nullptr, target); OpenJson.raise(nullptr, target);
return; return;
} }

View File

@ -234,6 +234,7 @@
</ItemGroup> </ItemGroup>
<!-- ========================= Cpp Files ======================== --> <!-- ========================= Cpp Files ======================== -->
<ItemGroup> <ItemGroup>
<ClCompile Include="init.cpp" />
<ClCompile Include="Actions.cpp"> <ClCompile Include="Actions.cpp">
<DependentUpon>Actions.xaml</DependentUpon> <DependentUpon>Actions.xaml</DependentUpon>
</ClCompile> </ClCompile>

View File

@ -9,6 +9,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="pch.cpp" /> <ClCompile Include="pch.cpp" />
<ClCompile Include="init.cpp" />
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" /> <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
<ClCompile Include="Utils.cpp" /> <ClCompile Include="Utils.cpp" />
</ItemGroup> </ItemGroup>

View File

@ -44,6 +44,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void NewTabMenu::OnNavigatedTo(const NavigationEventArgs& e) void NewTabMenu::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_ViewModel = e.Parameter().as<Editor::NewTabMenuViewModel>(); _ViewModel = e.Parameter().as<Editor::NewTabMenuViewModel>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue(_ViewModel.IsFolderView() ? "newTabMenu.folderView" : "newTabMenu", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void NewTabMenu::FolderPickerDialog_Opened(const IInspectable& /*sender*/, const Controls::ContentDialogOpenedEventArgs& /*e*/) void NewTabMenu::FolderPickerDialog_Opened(const IInspectable& /*sender*/, const Controls::ContentDialogOpenedEventArgs& /*e*/)

View File

@ -29,6 +29,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
const auto args = e.Parameter().as<Editor::NavigateToProfileArgs>(); const auto args = e.Parameter().as<Editor::NavigateToProfileArgs>();
_Profile = args.Profile(); _Profile = args.Profile();
_windowRoot = args.WindowRoot(); _windowRoot = args.WindowRoot();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("profile.advanced", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(_Profile.IsBaseLayer(), "IsProfileDefaults", "If the modified profile is the profile.defaults object"),
TraceLoggingValue(static_cast<GUID>(_Profile.Guid()), "ProfileGuid", "The guid of the profile that was navigated to"),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Profiles_Advanced::OnNavigatedFrom(const NavigationEventArgs& /*e*/) void Profiles_Advanced::OnNavigatedFrom(const NavigationEventArgs& /*e*/)

View File

@ -44,6 +44,19 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// The Appearances object handles updating the values in the settings UI, but // The Appearances object handles updating the values in the settings UI, but
// we still need to listen to the changes here just to update the preview control // we still need to listen to the changes here just to update the preview control
_AppearanceViewModelChangedRevoker = _Profile.DefaultAppearance().PropertyChanged(winrt::auto_revoke, { this, &Profiles_Appearance::_onProfilePropertyChanged }); _AppearanceViewModelChangedRevoker = _Profile.DefaultAppearance().PropertyChanged(winrt::auto_revoke, { this, &Profiles_Appearance::_onProfilePropertyChanged });
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("profile.appearance", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(_Profile.IsBaseLayer(), "IsProfileDefaults", "If the modified profile is the profile.defaults object"),
TraceLoggingValue(static_cast<GUID>(_Profile.Guid()), "ProfileGuid", "The guid of the profile that was navigated to"),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingValue(_Profile.DefaultAppearance().BackgroundImageSettingsVisible(), "HasBackgroundImage", "If the profile has a background image defined"),
TraceLoggingValue(_Profile.HasUnfocusedAppearance(), "HasUnfocusedAppearance", "If the profile has an unfocused appearance defined"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Profiles_Appearance::OnNavigatedFrom(const NavigationEventArgs& /*e*/) void Profiles_Appearance::OnNavigatedFrom(const NavigationEventArgs& /*e*/)
@ -54,6 +67,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Appearance::CreateUnfocusedAppearance_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/) void Profiles_Appearance::CreateUnfocusedAppearance_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)
{ {
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"CreateUnfocusedAppearance",
TraceLoggingDescription("Event emitted when the user creates an unfocused appearance for a profile"),
TraceLoggingValue(_Profile.IsBaseLayer(), "IsProfileDefaults", "If the modified profile is the profile.defaults object"),
TraceLoggingValue(static_cast<GUID>(_Profile.Guid()), "ProfileGuid", "The guid of the profile that was navigated to"),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
_Profile.CreateUnfocusedAppearance(); _Profile.CreateUnfocusedAppearance();
} }

View File

@ -55,6 +55,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_Profile.FocusDeleteButton(false); _Profile.FocusDeleteButton(false);
} }
}); });
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("profile", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(_Profile.IsBaseLayer(), "IsProfileDefaults", "If the modified profile is the profile.defaults object"),
TraceLoggingValue(static_cast<GUID>(_Profile.Guid()), "ProfileGuid", "The guid of the profile that was navigated to. Set to {3ad42e7b-e073-5f3e-ac57-1c259ffa86a8} if the profiles.defaults object is being modified."),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Profiles_Base::OnNavigatedFrom(const NavigationEventArgs& /*e*/) void Profiles_Base::OnNavigatedFrom(const NavigationEventArgs& /*e*/)
@ -79,6 +90,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Base::DeleteConfirmation_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/) void Profiles_Base::DeleteConfirmation_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)
{ {
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"DeleteProfile",
TraceLoggingDescription("Event emitted when the user deletes a profile"),
TraceLoggingValue(to_hstring(_Profile.Guid()).c_str(), "ProfileGuid", "The guid of the profile that was navigated to"),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingValue(false, "Orphaned", "Tracks if the profile is orphaned"),
TraceLoggingValue(_Profile.Hidden(), "Hidden", "Tracks if the profile is hidden"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
winrt::get_self<ProfileViewModel>(_Profile)->DeleteProfile(); winrt::get_self<ProfileViewModel>(_Profile)->DeleteProfile();
} }

View File

@ -41,6 +41,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_Profile.FocusDeleteButton(false); _Profile.FocusDeleteButton(false);
} }
}); });
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("profileOrphaned", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(static_cast<GUID>(_Profile.Guid()), "ProfileGuid", "The guid of the profile that was navigated to"),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Profiles_Base_Orphaned::DeleteConfirmation_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/) void Profiles_Base_Orphaned::DeleteConfirmation_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)

View File

@ -22,6 +22,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Terminal::OnNavigatedTo(const NavigationEventArgs& e) void Profiles_Terminal::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_Profile = e.Parameter().as<Editor::ProfileViewModel>(); _Profile = e.Parameter().as<Editor::ProfileViewModel>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("profile.terminal", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingValue(_Profile.IsBaseLayer(), "IsProfileDefaults", "If the modified profile is the profile.defaults object"),
TraceLoggingValue(static_cast<GUID>(_Profile.Guid()), "ProfileGuid", "The guid of the profile that was navigated to"),
TraceLoggingValue(_Profile.Source().c_str(), "ProfileSource", "The source of the profile that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
void Profiles_Terminal::OnNavigatedFrom(const NavigationEventArgs& /*e*/) void Profiles_Terminal::OnNavigatedFrom(const NavigationEventArgs& /*e*/)

View File

@ -17,5 +17,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Rendering::OnNavigatedTo(const NavigationEventArgs& e) void Rendering::OnNavigatedTo(const NavigationEventArgs& e)
{ {
_ViewModel = e.Parameter().as<Editor::RenderingViewModel>(); _ViewModel = e.Parameter().as<Editor::RenderingViewModel>();
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,
"NavigatedToPage",
TraceLoggingDescription("Event emitted when the user navigates to a page in the settings UI"),
TraceLoggingValue("rendering", "PageId", "The identifier of the page that was navigated to"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
} }
} }

View File

@ -13,8 +13,6 @@ using namespace winrt::Windows::System;
using namespace winrt::Windows::Foundation; using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::UI::Xaml; using namespace winrt::Windows::UI::Xaml;
UTILS_DEFINE_LIBRARY_RESOURCE_SCOPE(L"Microsoft.Terminal.Settings.Editor/Resources");
namespace winrt::Microsoft::Terminal::Settings namespace winrt::Microsoft::Terminal::Settings
{ {
hstring GetSelectedItemTag(const winrt::Windows::Foundation::IInspectable& comboBoxAsInspectable) hstring GetSelectedItemTag(const winrt::Windows::Foundation::IInspectable& comboBoxAsInspectable)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license.
#include "pch.h"
#include <LibraryResources.h>
#include <WilErrorReporting.h>
// Note: Generate GUID using TlgGuid.exe tool
TRACELOGGING_DEFINE_PROVIDER(
g_hTerminalSettingsEditorProvider,
"Microsoft.Windows.Terminal.Settings.Editor",
// {1b16317d-b594-51f8-c552-5d50572b5efc}
(0x1b16317d, 0xb594, 0x51f8, 0xc5, 0x52, 0x5d, 0x50, 0x57, 0x2b, 0x5e, 0xfc),
TraceLoggingOptionMicrosoftTelemetry());
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD reason, LPVOID /*reserved*/)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDll);
TraceLoggingRegister(g_hTerminalSettingsEditorProvider);
Microsoft::Console::ErrorReporting::EnableFallbackFailureReporting(g_hTerminalSettingsEditorProvider);
break;
case DLL_PROCESS_DETACH:
if (g_hTerminalSettingsEditorProvider)
{
TraceLoggingUnregister(g_hTerminalSettingsEditorProvider);
}
break;
}
return TRUE;
}
UTILS_DEFINE_LIBRARY_RESOURCE_SCOPE(L"Microsoft.Terminal.Settings.Editor/Resources");

View File

@ -56,6 +56,13 @@
#include <winrt/Microsoft.Terminal.Settings.Model.h> #include <winrt/Microsoft.Terminal.Settings.Model.h>
#include <winrt/Microsoft.Terminal.UI.h> #include <winrt/Microsoft.Terminal.UI.h>
// Including TraceLogging essentials for the binary
#include <TraceLoggingProvider.h>
#include <winmeta.h>
TRACELOGGING_DECLARE_PROVIDER(g_hTerminalSettingsEditorProvider);
#include <telemetry/ProjectTelemetry.h>
#include <TraceLoggingActivity.h>
#include <shlobj.h> #include <shlobj.h>
#include <shobjidl_core.h> #include <shobjidl_core.h>
#include <dwrite_3.h> #include <dwrite_3.h>