Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telemetry reporting improvements #617

Merged
merged 4 commits into from Oct 21, 2020

Conversation

yao-msft
Copy link
Contributor

@yao-msft yao-msft commented Oct 20, 2020

Change

  • Move the reporting of IsManifestLocal upfront to filter out some noises
  • Added execution stage info when failures or exceptions occur.
  • Add sub execution telemetry support (for upgrade --all)

Validation

This should not change the client behavior. Also manually validated basic install and search.

Microsoft Reviewers: Open in CodeFlow

@yao-msft yao-msft requested a review from a team as a code owner October 20, 2020 06:08
// Values are ordered in a typical workflow stages
enum class ExecutionStage
{
None,
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None [](start = 8, length = 4)

The first phase should probably be something about command line parsing. #Closed

void operator()(Execution::Context& context) const override;

private:
mutable ExecutionStage m_stage;
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutable [](start = 8, length = 7)

This doesn't need mutable; you aren't writing to it in a const context. (And the move you are doing is completely unnecessary) #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, but the compiler is not happy if I don't use std::move() since the context.Add() only takes rvalue.


In reply to: 508324457 [](ancestors = 508324457)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then fix Add to have an lvalue version.


In reply to: 508751833 [](ancestors = 508751833,508324457)

@@ -35,6 +35,10 @@ namespace AppInstaller::Logging
// Used to disable telemetry on the fly.
std::atomic_bool s_isTelemetryEnabled{ true };

std::string s_executionStage;
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string s_executionStage; [](start = 8, length = 29)

I think that while logging a string will be more flexible for adding new stages, it will make processing that data far harder. Instead, we should just log an integer, and the current stages can be ParseArgs = 1000, Discovery = 2000, etc. #Closed

@@ -117,6 +123,7 @@ namespace AppInstaller::Logging
"ClientVersion",
GetActivityId(),
nullptr,
TraceLoggingGuid(s_subExecutionId, "SubExecutionId"),
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. #Closed

@@ -140,6 +147,7 @@ namespace AppInstaller::Logging
"CommandFound",
GetActivityId(),
nullptr,
TraceLoggingGuid(s_subExecutionId, "SubExecutionId"),
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed #Closed

@@ -156,6 +164,7 @@ namespace AppInstaller::Logging
"CommandSuccess",
GetActivityId(),
nullptr,
TraceLoggingGuid(s_subExecutionId, "SubExecutionId"),
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed #Closed

@@ -35,6 +35,10 @@ namespace AppInstaller::Logging
// Used to disable telemetry on the fly.
std::atomic_bool s_isTelemetryEnabled{ true };

std::string s_executionStage;

std::atomic<GUID> s_subExecutionId{ GUID_NULL };
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::atomic s_subExecutionId{ GUID_NULL }; [](start = 8, length = 48)

Could we instead just use an integer? These don't need to be unique across sessions, so for the same ActivityId, 0 can be the root (like GUID_NULL), and 1+ can be a subexecution. That way we also get an order that might be useful. #Closed

Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@ghost ghost added the Needs-Author-Feedback Issue needs attention from issue or PR author label Oct 20, 2020
@@ -197,6 +207,24 @@ namespace AppInstaller::CLI::Workflow
// Inputs: SearchResult
// Outputs: InstalledPackageVersion
void GetInstalledPackageVersion(Execution::Context& context);

// Searches the source for the specific field as a completion.
Copy link
Contributor Author

@yao-msft yao-msft Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ Searches the source fo [](start = 5, length = 24)

update comments #Closed

@ghost ghost removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Oct 20, 2020

SubExecutionTelemetryScope::SubExecutionTelemetryScope()
{
THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_INVALID_STATE), s_subExecutionId.exchange(++m_sessionId) != s_RootExecutionId,
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exchange [](start = 82, length = 8)

Use compare_exchange to not actually change the value if it is not root. #Resolved

void Add(const typename details::DataMapping<D>::value_t& v)
{
auto copy = v;
m_data[D].emplace<details::DataIndex(D)>(std::forward<typename details::DataMapping<D>::value_t>(std::move(copy)));
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::move(copy) [](start = 109, length = 15)

You shouldn't need to move a copy; why can't you just emplace v and have it do the copy? #Resolved

Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@yao-msft yao-msft merged commit 7ee6784 into microsoft:master Oct 21, 2020
@yao-msft yao-msft deleted the telemetryimprovements branch October 21, 2020 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants