Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find out how often are people actually using marks, Themes #14356

Merged
10 commits merged into from
Dec 1, 2022
56 changes: 56 additions & 0 deletions src/cascadia/TerminalApp/AppLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,62 @@ namespace winrt::TerminalApp::implementation
TraceLoggingBool(_settings.GlobalSettings().ShowTabsInTitlebar(), "TabsInTitlebar"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));

_onCreateResearch();
}

void AppLogic::_onCreateResearch()
{
// ----------------------------- RE: Themes ----------------------------
const auto numThemes = _settings.GlobalSettings().Themes().Size();
const auto themeInUse = _settings.GlobalSettings().CurrentTheme();
const auto usingDefaultTheme = themeInUse.Name() == L"light" ||
themeInUse.Name() == L"dark" ||
themeInUse.Name() == L"system";
zadjii-msft marked this conversation as resolved.
Show resolved Hide resolved

TraceLoggingWrite(
g_hTerminalAppProvider,
"ThemesInUse",
TraceLoggingDescription("Data about the themes in use"),
TraceLoggingBool(usingDefaultTheme, "UsingDefaultTheme"),
TraceLoggingInt32(numThemes, "NumThemes"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));

// --------------------------- RE: sendInput ---------------------------

auto totalSendInput = 0;
const auto& allActions = _settings.GlobalSettings().ActionMap().AvailableActions();
for (const auto&& [name, actionAndArgs] : allActions)
{
if (actionAndArgs.Action() == ShortcutAction::SendInput)
totalSendInput++;
}

TraceLoggingWrite(
g_hTerminalAppProvider,
"SendInputUsage",
TraceLoggingDescription("Data about usage of sendInput"),
TraceLoggingInt32(totalSendInput, "NumSendInputActions"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
zadjii-msft marked this conversation as resolved.
Show resolved Hide resolved

// ------------------------ RE: automarkPrompts ------------------------
auto totalAutoMark = 0;
auto totalShowMarks = 0;
for (const auto&& p : _settings.AllProfiles())
zadjii-msft marked this conversation as resolved.
Show resolved Hide resolved
{
totalAutoMark += p.AutoMarkPrompts() ? 1 : 0;
totalShowMarks += p.ShowMarks() ? 1 : 0;
}
TraceLoggingWrite(
g_hTerminalAppProvider,
"MarksProfilesUsage",
TraceLoggingDescription("Data about usage of scrollbar marks"),
TraceLoggingInt32(totalAutoMark, "NumProfilesAutoMarkPrompts"),
TraceLoggingInt32(totalShowMarks, "NumProfilesShowMarks"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}

void AppLogic::Quit()
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/AppLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ namespace winrt::TerminalApp::implementation
void _ReloadSettings();
void _OpenSettingsUI();

void _onCreateResearch();

bool _hasCommandLineArguments{ false };
bool _hasSettingsStartupActions{ false };
std::vector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings> _warnings;
Expand Down
26 changes: 26 additions & 0 deletions src/cascadia/TerminalCore/TerminalApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ void Terminal::SetTaskbarProgress(const ::Microsoft::Console::VirtualTerminal::D

void Terminal::SetWorkingDirectory(std::wstring_view uri)
{
static bool logged = false;
if (!logged)
{
TraceLoggingWrite(
g_hTerminalControlProvider,
"ShellIntegrationWorkingDirSet",
TraceLoggingDescription("A user set the CWD"),
zadjii-msft marked this conversation as resolved.
Show resolved Hide resolved
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));

logged = true;
}

_workingDirectory = uri;
}

Expand Down Expand Up @@ -300,6 +313,19 @@ void Terminal::UseMainScreenBuffer()

void Terminal::AddMark(const Microsoft::Console::VirtualTerminal::DispatchTypes::ScrollMark& mark)
{
static bool logged = false;
if (!logged)
{
TraceLoggingWrite(
g_hTerminalControlProvider,
"ShellIntegrationMarkAdded",
TraceLoggingDescription("A user added a mark via VT at least once"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));

logged = true;
}

const til::point cursorPos{ _activeBuffer().GetCursor().GetPosition() };
AddMark(mark, cursorPos, cursorPos);
}
Expand Down
9 changes: 9 additions & 0 deletions src/cascadia/TerminalCore/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
#include "winrt/Windows.Foundation.h"

#include "winrt/Microsoft.Terminal.Core.h"

// Including TraceLogging essentials for the binary
#include <TraceLoggingProvider.h>
#include <winmeta.h>
// We'll just use the one in TerminalControl, since that's what we'll get embedded in.
TRACELOGGING_DECLARE_PROVIDER(g_hTerminalControlProvider);
zadjii-msft marked this conversation as resolved.
Show resolved Hide resolved
#include <telemetry/ProjectTelemetry.h>
#include <TraceLoggingActivity.h>

#include <til.h>