Log number of interactive sessions (#17682)

This sends a telemetry event if a session is interacted with.
Specifically, key events are essential to have an interactive session in
Windows Terminal, so we're tracking sessions that have had a key down
event.

(cherry picked from commit ac865e6666d16e436bd3df4f62697557990ce652)
Service-Card-Id: 93498660
Service-Version: 1.21
This commit is contained in:
Carlos Zamora 2024-08-08 06:52:07 -07:00 committed by Dustin L. Howett
parent 3ab8921aa7
commit 8f4775df96
2 changed files with 13 additions and 0 deletions

View File

@ -6,6 +6,8 @@
using namespace winrt::Microsoft::Terminal::Remoting;
bool WindowThread::_loggedInteraction = false;
WindowThread::WindowThread(winrt::TerminalApp::AppLogic logic,
winrt::Microsoft::Terminal::Remoting::WindowRequestedArgs args,
winrt::Microsoft::Terminal::Remoting::WindowManager manager,
@ -191,6 +193,16 @@ int WindowThread::_messagePump()
break;
}
if (!_loggedInteraction && (message.message == WM_KEYDOWN || message.message == WM_SYSKEYDOWN))
{
TraceLoggingWrite(
g_hWindowsTerminalProvider,
"SessionBecameInteractive",
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
_loggedInteraction = true;
}
// GH#638 (Pressing F7 brings up both the history AND a caret browsing message)
// The Xaml input stack doesn't allow an application to suppress the "caret browsing"
// dialog experience triggered when you press F7. Official recommendation from the Xaml

View File

@ -42,6 +42,7 @@ private:
winrt::event_token _UpdateSettingsRequestedToken;
std::unique_ptr<::IslandWindow> _warmWindow{ nullptr };
static bool _loggedInteraction;
int _messagePump();
void _pumpRemainingXamlMessages();