commit 28f2e563a46d233973a75967c759425039d3b6b3
parent 207630becc0739a818b4693d0c7924c915c6237a
Author: mapill-msft <58245272+mapill-msft@users.noreply.github.com>
Date: Tue, 28 Jan 2020 15:33:18 -0800
Adding some telemetry logs to get e2e data (#24)
Diffstat:
4 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/src/AppInstallerCLICore/Commands/InstallCommand.cpp b/src/AppInstallerCLICore/Commands/InstallCommand.cpp
@@ -38,6 +38,9 @@ namespace AppInstaller::CLI
{
std::string manifest = *(inv.GetArg(ARG_MANIFEST));
Manifest::Manifest packageManifest = Manifest::Manifest::CreateFromPath(manifest);
+
+ Logging::Telemetry().LogManifestFields(packageManifest.Name, packageManifest.Version);
+
InstallFlow packageInstall(packageManifest, out, in);
packageInstall.Install();
}
diff --git a/src/AppInstallerCLICore/Core.cpp b/src/AppInstallerCLICore/Core.cpp
@@ -53,7 +53,8 @@ namespace AppInstaller::CLI
{
commandToExecute = foundCommand.get();
}
- AICLI_LOG(CLI, Info, << "Leaf command to execute: " << commandToExecute->Name());
+
+ Logging::Telemetry().LogCommand(commandToExecute->Name());
commandToExecute->ParseArguments(invocation);
commandToExecute->ValidateArguments(invocation);
@@ -87,6 +88,7 @@ namespace AppInstaller::CLI
return APPINSTALLER_CLI_ERROR_COMMAND_FAILED;
}
+ Logging::Telemetry().LogCommandSuccess(commandToExecute->Name());
return 0;
}
// End of the line exceptions that are not ever expected.
diff --git a/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp b/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp
@@ -101,12 +101,62 @@ namespace AppInstaller::Logging
GetActivityId(),
nullptr,
TraceLoggingCountedString(version.c_str(), static_cast<ULONG>(version.size()), "version"),
+ TraceLoggingWideString(GetCommandLineW(), "commandlineargs"),
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES));
}
AICLI_LOG(CLI, Info, << "AppInstallerCLI, version [" << version << "], activity [" << *GetActivityId() << ']');
}
+
+ void TelemetryTraceLogger::LogCommand(std::string_view commandName) noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "CommandFound",
+ GetActivityId(),
+ nullptr,
+ TraceLoggingCountedString(commandName.data(), commandName.size(), "Command"),
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES));
+ }
+
+ AICLI_LOG(CLI, Info, << "Leaf command to execute: " << commandName);
+ }
+
+ void TelemetryTraceLogger::LogCommandSuccess(std::string_view commandName) noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "CommandSuccess",
+ GetActivityId(),
+ nullptr,
+ TraceLoggingCountedString(commandName.data(), commandName.size(), "Command"),
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES));
+ }
+
+ AICLI_LOG(CLI, Info, << "Leaf command succeeded: " << commandName);
+ }
+
+ void TelemetryTraceLogger::LogManifestFields(const std::string& name, const std::string& version) noexcept
+ {
+ if (g_IsTelemetryProviderEnabled)
+ {
+ TraceLoggingWriteActivity(g_hTelemetryProvider,
+ "ManifestFields",
+ GetActivityId(),
+ nullptr,
+ TraceLoggingCountedString(name.c_str(), name.size(),"Name"),
+ TraceLoggingCountedString(version.c_str(), version.size(), "Version"),
+ TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
+ TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES));
+ }
+
+ AICLI_LOG(CLI, Info, << "AppInstallerCLI, Name [" << name << "], Version [" << version << ']');
+ }
void EnableWilFailureTelemetry()
{
diff --git a/src/AppInstallerCommonCore/Public/AppInstallerTelemetry.h b/src/AppInstallerCommonCore/Public/AppInstallerTelemetry.h
@@ -31,6 +31,15 @@ namespace AppInstaller::Logging
// Logs the initial process startup.
void LogStartup() noexcept;
+ // Logs the invoked command.
+ void LogCommand(std::string_view commandName) noexcept;
+
+ // Logs the invoked command success.
+ void LogCommandSuccess(std::string_view commandName) noexcept;
+
+ // Logs the Manifest fields.
+ void LogManifestFields(const std::string& name, const std::string& version) noexcept;
+
private:
TelemetryTraceLogger();
};