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_DATE_CALCULATION_MODE_USED = L"DateCalculationModeUsed";
|
||||
constexpr auto EVENT_NAME_HISTORY_ITEM_LOAD = L"HistoryItemLoad";
|
||||
|
||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled())
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace CalculatorApp
|
|||
void LogSharedMemoryUsed(std::wstring_view, std::wstring_view, unsigned int) const;
|
||||
void LogMemoryBodyOpened() const;
|
||||
void LogModeChange(CalculatorApp::Common::ViewMode mode) const;
|
||||
void LogHistoryItemLoad(CalculatorApp::Common::ViewMode mode, int historyListSize) const;
|
||||
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
||||
void LogDebug(std::wstring_view debugData);
|
||||
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
||||
|
|
|
@ -457,6 +457,8 @@ void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel ^ e)
|
|||
Model->IsFToEEnabled = false;
|
||||
|
||||
TraceLogger::GetInstance().LogHistoryItemLoadEnd(tokenSize);
|
||||
auto mode = IsScientific ? ViewMode::Scientific : ViewMode::Standard;
|
||||
TraceLogger::GetInstance().LogHistoryItemLoad(mode, tokenSize);
|
||||
CloseHistoryFlyout();
|
||||
this->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue