Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp (C++)

Code before:
            size_t enabled[2]{};
            for (const auto& profile : _activeProfiles)
            {
                enabled[profile.UseAtlasEngine()]++;
            }

            TraceLoggingWrite(
                g_hSettingsModelProvider,
                "AtlasEngine_Usage",
                TraceLoggingDescription("Event emitted upon settings load, containing the number of profiles opted-in/out of useAtlasEngine"),
                TraceLoggingUIntPtr(enabled[0], "UseAtlasEngineDisabled", "Number of profiles for which AtlasEngine is disabled"),
                TraceLoggingUIntPtr(enabled[1], "UseAtlasEngineEnabled", "Number of profiles for which AtlasEngine is enabled"),
                TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
                TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
        }

        // ----------------------------- RE: Themes ----------------------------
        const auto numThemes = GlobalSettings().Themes().Size();
        const auto themeInUse = GlobalSettings().CurrentTheme().Name();

        // system: 0
        // light: 1
        // dark: 2
        // a custom theme: 3
        const auto themeChoice = themeInUse == L"system" ? 0 :
                                 themeInUse == L"light"  ? 1 :
                                 themeInUse == L"dark"   ? 2 :
                                                           3;

        TraceLoggingWrite(
            g_hSettingsModelProvider,
            "ThemesInUse",
            TraceLoggingDescription("Data about the themes in use"),
            TraceLoggingBool(themeChoice, "Identifier for the theme chosen. 0 is system, 1 is light, 2 is dark, and 3 indicates any custom theme."),
            TraceLoggingInt32(numThemes, "Number of themes in the user's settings"),
            TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
            TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));

        // --------------------------- RE: sendInput ---------------------------
        auto collectSendInput = [&]() {
            auto totalSendInput = 0;
            const auto& allActions = GlobalSettings().ActionMap().AvailableActions();
            for (const auto&& [name, actionAndArgs] : allActions)
            {
                if (actionAndArgs.Action() == ShortcutAction::SendInput)
                {
                    totalSendInput++;
                }
            }
            return totalSendInput;
        };

Review comment (suggestion):
By and large, our data will show that users are using the theme from defaults.json.

Should we only log this if the user has overridden the default theme? `GlobalAppSettings` supports all the Inheritable stuff, so we should be able to detect that.

Code after:
            size_t enabled[2]{};
            for (const auto& profile : _activeProfiles)
            {
                enabled[profile.UseAtlasEngine()]++;
            }

            TraceLoggingWrite(
                g_hSettingsModelProvider,
                "AtlasEngine_Usage",
                TraceLoggingDescription("Event emitted upon settings load, containing the number of profiles opted-in/out of useAtlasEngine"),
                TraceLoggingUIntPtr(enabled[0], "UseAtlasEngineDisabled", "Number of profiles for which AtlasEngine is disabled"),
                TraceLoggingUIntPtr(enabled[1], "UseAtlasEngineEnabled", "Number of profiles for which AtlasEngine is enabled"),
                TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
                TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
        }

        // ----------------------------- RE: Themes ----------------------------
        const auto numThemes = GlobalSettings().Themes().Size();
        const auto themeInUse = GlobalSettings().CurrentTheme().Name();
        const auto changedTheme = GlobalSettings().HasTheme();

        // system: 0
        // light: 1
        // dark: 2
        // a custom theme: 3
        const auto themeChoice = themeInUse == L"system" ? 0 :
                                 themeInUse == L"light"  ? 1 :
                                 themeInUse == L"dark"   ? 2 :
                                                           3;

        TraceLoggingWrite(
            g_hSettingsModelProvider,
            "ThemesInUse",
            TraceLoggingDescription("Data about the themes in use"),
            TraceLoggingBool(themeChoice, "Identifier for the theme chosen. 0 is system, 1 is light, 2 is dark, and 3 indicates any custom theme."),
            TraceLoggingBool(changedTheme, "True if the user actually changed the theme from the default theme"),
            TraceLoggingInt32(numThemes, "Number of themes in the user's settings"),
            TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
            TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));

        // --------------------------- RE: sendInput ---------------------------
        auto collectSendInput = [&]() {
            auto totalSendInput = 0;
            const auto& allActions = GlobalSettings().ActionMap().AvailableActions();
            for (const auto&& [name, actionAndArgs] : allActions)
            {
                if (actionAndArgs.Action() == ShortcutAction::SendInput)
                {
                    totalSendInput++;
                }
            }