mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Add Telemetry for History Item
This commit is contained in:
parent
d9685856b6
commit
4790946061
3 changed files with 20 additions and 2 deletions
|
@ -77,6 +77,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
constexpr auto EVENT_NAME_MODE_CHANGED = L"ModeChanged";
|
constexpr auto EVENT_NAME_MODE_CHANGED = L"ModeChanged";
|
||||||
constexpr auto EVENT_NAME_DATE_CALCULATION_MODE_USED = L"DateCalculationModeUsed";
|
constexpr auto EVENT_NAME_DATE_CALCULATION_MODE_USED = L"DateCalculationModeUsed";
|
||||||
|
constexpr auto EVENT_NAME_HISTORY_ITEM_LOAD = L"HistoryItemLoad";
|
||||||
|
|
||||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||||
|
|
||||||
|
@ -87,8 +88,8 @@ namespace CalculatorApp
|
||||||
// c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords
|
// c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords
|
||||||
// c.f. WINEVENT_KEYWORD_* 0x00FF000000000000 // Bits 55-48 - system-reserved keywords
|
// c.f. WINEVENT_KEYWORD_* 0x00FF000000000000 // Bits 55-48 - system-reserved keywords
|
||||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0x0000800000000000; // Bit 47
|
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0x0000800000000000; // Bit 47
|
||||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0x0000400000000000; // Bit 46
|
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0x0000400000000000; // Bit 46
|
||||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0x0000200000000000; // Bit 45
|
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0x0000200000000000; // Bit 45
|
||||||
#else
|
#else
|
||||||
// define all Keyword options as 0 when we do not want to upload app telemetry
|
// define all Keyword options as 0 when we do not want to upload app telemetry
|
||||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0;
|
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0;
|
||||||
|
@ -541,6 +542,20 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraceLogger::LogHistoryItemLoad(ViewMode mode, int historyListSize) const
|
||||||
|
{
|
||||||
|
if (!GetTraceLoggingProviderEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoggingFields fields{};
|
||||||
|
// cast mode to an int for telemetry
|
||||||
|
fields.AddInt32(L"CalcMode", NavCategory::Serialize(mode));
|
||||||
|
fields.AddInt32(L"HistoryListSize", historyListSize);
|
||||||
|
LogLevel2Event(EVENT_NAME_HISTORY_ITEM_LOAD, fields);
|
||||||
|
}
|
||||||
|
|
||||||
void TraceLogger::LogHistoryItemLoadBegin() const
|
void TraceLogger::LogHistoryItemLoadBegin() const
|
||||||
{
|
{
|
||||||
if (!GetTraceLoggingProviderEnabled())
|
if (!GetTraceLoggingProviderEnabled())
|
||||||
|
|
|
@ -65,6 +65,7 @@ namespace CalculatorApp
|
||||||
void LogSharedMemoryUsed(std::wstring_view, std::wstring_view, unsigned int) const;
|
void LogSharedMemoryUsed(std::wstring_view, std::wstring_view, unsigned int) const;
|
||||||
void LogMemoryBodyOpened() const;
|
void LogMemoryBodyOpened() const;
|
||||||
void LogModeChange(CalculatorApp::Common::ViewMode mode) const;
|
void LogModeChange(CalculatorApp::Common::ViewMode mode) const;
|
||||||
|
void LogHistoryItemLoad(CalculatorApp::Common::ViewMode mode, int historyListSize) const;
|
||||||
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
||||||
void LogDebug(std::wstring_view debugData);
|
void LogDebug(std::wstring_view debugData);
|
||||||
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
||||||
|
|
|
@ -457,6 +457,8 @@ void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel ^ e)
|
||||||
Model->IsFToEEnabled = false;
|
Model->IsFToEEnabled = false;
|
||||||
|
|
||||||
TraceLogger::GetInstance().LogHistoryItemLoadEnd(tokenSize);
|
TraceLogger::GetInstance().LogHistoryItemLoadEnd(tokenSize);
|
||||||
|
auto mode = IsScientific ? ViewMode::Scientific : ViewMode::Standard;
|
||||||
|
TraceLogger::GetInstance().LogHistoryItemLoad(mode, tokenSize);
|
||||||
CloseHistoryFlyout();
|
CloseHistoryFlyout();
|
||||||
this->Focus(::FocusState::Programmatic);
|
this->Focus(::FocusState::Programmatic);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue