commit ca9101a8f9f0638de66fd76dc99cc33278a4c8e0
parent 08c06dc1a8e3f12b48b286d7cf577929d4cce8ea
Author: mapill-msft <58245272+mapill-msft@users.noreply.github.com>
Date: Fri, 13 Mar 2020 13:07:35 -0700
Adding additional instrumentation for the install and search flows. (#55)
* Adding additional instumentation for the install and search flows.
* Fixing PR comment.
Diffstat:
6 files changed, 108 insertions(+), 10 deletions(-)
diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp
@@ -50,7 +50,7 @@ namespace AppInstaller::Workflow
{
auto app = m_searchResult.Matches.at(0).Application.get();
- AICLI_LOG(CLI, Info, << "Found one app. App id: " << app->GetId() << " App name: " << app->GetName());
+ Logging::Telemetry().LogManifestFields(app->GetName(), app->GetId());
m_reporterRef.ShowMsg("Found app: " + app->GetName());
// Todo: handle failure if necessary after real search is in place
diff --git a/src/AppInstallerCLICore/Workflows/ManifestComparator.cpp b/src/AppInstallerCLICore/Workflows/ManifestComparator.cpp
@@ -54,12 +54,7 @@ namespace AppInstaller::Workflow
ManifestInstaller selectedInstaller = m_manifestRef.Installers[0];
- AICLI_LOG(CLI, Info, << "Completed installer selection.");
- AICLI_LOG(CLI, Verbose, << "Selected installer arch: " << (int)selectedInstaller.Arch);
- AICLI_LOG(CLI, Verbose, << "Selected installer url: " << selectedInstaller.Url);
- AICLI_LOG(CLI, Verbose, << "Selected installer InstallerType: " << Manifest::ManifestInstaller::InstallerTypeToString(selectedInstaller.InstallerType));
- AICLI_LOG(CLI, Verbose, << "Selected installer scope: " << selectedInstaller.Scope);
- AICLI_LOG(CLI, Verbose, << "Selected installer language: " << selectedInstaller.Language);
+ Logging::Telemetry().LogSelectedInstaller((int)selectedInstaller.Arch, selectedInstaller.Url, Manifest::ManifestInstaller::InstallerTypeToString(selectedInstaller.InstallerType), selectedInstaller.Scope, selectedInstaller.Language);
return selectedInstaller;
}
diff --git a/src/AppInstallerCLICore/Workflows/SearchFlow.cpp b/src/AppInstallerCLICore/Workflows/SearchFlow.cpp
@@ -19,7 +19,7 @@ namespace AppInstaller::Workflow
{
if (m_searchResult.Matches.size() == 0)
{
- AICLI_LOG(CLI, Info, << "No app found matching input criteria");
+ Logging::Telemetry().LogNoAppMatch();
m_reporterRef.ShowMsg("No app found matching input criteria.");
}
else
diff --git a/src/AppInstallerCLICore/Workflows/WorkflowBase.cpp b/src/AppInstallerCLICore/Workflows/WorkflowBase.cpp
@@ -76,14 +76,14 @@ namespace AppInstaller::Workflow
{
if (m_searchResult.Matches.size() == 0)
{
- AICLI_LOG(CLI, Info, << "No app found matching input criteria");
+ Logging::Telemetry().LogNoAppMatch();
m_reporterRef.ShowMsg("No app found matching input criteria.");
return false;
}
if (m_searchResult.Matches.size() > 1)
{
- AICLI_LOG(CLI, Info, << "Multiple apps found matching input criteria");
+ Logging::Telemetry().LogMultiAppMatch();
m_reporterRef.ShowMsg("Multiple apps found matching input criteria. Please refine the input.");
ReportSearchResult();
return false;
@@ -110,6 +110,7 @@ namespace AppInstaller::Workflow
msg += ": " + match.MatchCriteria.Value + "]";
}
+ Logging::Telemetry().LogSearchResultCount(m_searchResult.Matches.size());
m_reporterRef.ShowMsg(msg);
}
}
diff --git a/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp b/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp
@@ -158,6 +158,93 @@ namespace AppInstaller::Logging
AICLI_LOG(CLI, Info, << "AppInstallerCLI, Name [" << name << "], Version [" << version << ']');
}
+ void TelemetryTraceLogger::LogNoAppMatch() noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "NoAppMatch",
+ GetActivityId(),
+ nullptr,
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance | PDT_ProductAndServiceUsage),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA));
+ }
+
+ AICLI_LOG(CLI, Info, << "No app found matching input criteria");
+ }
+
+ void TelemetryTraceLogger::LogMultiAppMatch() noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "MultiAppMatch",
+ GetActivityId(),
+ nullptr,
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance | PDT_ProductAndServiceUsage),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA));
+ }
+
+ AICLI_LOG(CLI, Info, << "Multiple apps found matching input criteria");
+ }
+
+ void TelemetryTraceLogger::LogAppFound(const std::string& name, const std::string& id) noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "AppFound",
+ GetActivityId(),
+ nullptr,
+ TraceLoggingCountedString(name.c_str(), static_cast<ULONG>(name.size()), "AppName"),
+ TraceLoggingCountedString(id.c_str(), static_cast<ULONG>(id.size()), "id"),
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance | PDT_ProductAndServiceUsage),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA));
+ }
+
+ AICLI_LOG(CLI, Info, << "Found one app. App id: " << id << " App name: " << name);
+ }
+
+ void TelemetryTraceLogger::LogSelectedInstaller(int arch, const std::string& url, const std::string& installerType, const std::string& scope, const std::string& language) noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "SelectedInstaller",
+ GetActivityId(),
+ nullptr,
+ TraceLoggingInt32(arch, "Arch"),
+ TraceLoggingCountedString(url.c_str(), static_cast<ULONG>(url.size()), "URL"),
+ TraceLoggingCountedString(installerType.c_str(), static_cast<ULONG>(installerType.size()), "InstallerType"),
+ TraceLoggingCountedString(scope.c_str(), static_cast<ULONG>(scope.size()), "Scope"),
+ TraceLoggingCountedString(language.c_str(), static_cast<ULONG>(language.size()), "Language"),
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance | PDT_ProductAndServiceUsage),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA));
+ }
+
+ AICLI_LOG(CLI, Info, << "Completed installer selection.");
+ AICLI_LOG(CLI, Verbose, << "Selected installer arch: " << arch);
+ AICLI_LOG(CLI, Verbose, << "Selected installer url: " << url);
+ AICLI_LOG(CLI, Verbose, << "Selected installer InstallerType: " << installerType);
+ AICLI_LOG(CLI, Verbose, << "Selected installer scope: " << scope);
+ AICLI_LOG(CLI, Verbose, << "Selected installer language: " << language);
+
+ }
+
+ void TelemetryTraceLogger::LogSearchResultCount(ULONG resultCount) noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "SearchResultCount",
+ GetActivityId(),
+ nullptr,
+ TraceLoggingUInt64(resultCount, "ResultCount"),
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance | PDT_ProductAndServiceUsage),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA));
+ }
+ }
+
void EnableWilFailureTelemetry()
{
wil::SetResultLoggingCallback(wilResultLoggingCallback);
diff --git a/src/AppInstallerCommonCore/Public/AppInstallerTelemetry.h b/src/AppInstallerCommonCore/Public/AppInstallerTelemetry.h
@@ -39,6 +39,21 @@ namespace AppInstaller::Logging
// Logs the Manifest fields.
void LogManifestFields(const std::string& name, const std::string& version) noexcept;
+
+ //Logs when there is no matching App found for search
+ void LogNoAppMatch() noexcept;
+
+ //Logs when there is multiple matching Apps found for search
+ void LogMultiAppMatch() noexcept;
+
+ //Logs the name and Id of app found
+ void LogAppFound(const std::string& name, const std::string& id) noexcept;
+
+ //Logs the selected installer details
+ void LogSelectedInstaller(int arch, const std::string& url, const std::string& installerType, const std::string& scope, const std::string& language) noexcept;
+
+ //Logs the Search Result
+ void LogSearchResultCount(ULONG resultCount) noexcept;
private:
TelemetryTraceLogger();