Skip to content

Fix for #4965, #6274

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

Merged
merged 6 commits into from
May 30, 2018
Merged

Fix for #4965, #6274

merged 6 commits into from
May 30, 2018

Conversation

praries880
Copy link
Contributor

@praries880 praries880 commented May 22, 2018

Added InvocationName, InnerExceptionTypie and ParameterSetName to the telemetry emitted.

Issue #4965

Copy link
Member

@cormacpayne cormacpayne left a comment

Choose a reason for hiding this comment

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

@praries880 two minor comments, otherwise LGTM

Also, would you mind updating the change log for Profile to reflect the changes being made in this PR?

@@ -266,6 +270,12 @@ private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary<string,
eventProperties.Add("HashMacAddress", HashMacAddress);
eventProperties.Add("PowerShellVersion", PSVersion);
eventProperties.Add("Version", AzurePowerShell.AssemblyVersion);
eventProperties.Add("CommandParameterSetName", qos.ParameterSetName);
if (!string.IsNullOrWhiteSpace(qos.InvocationName))
Copy link
Member

Choose a reason for hiding this comment

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

@praries880 why do we need this if-statement? I didn't think it was possible for InvocationName to be null or empty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, now I know!!!

@@ -214,6 +219,11 @@ protected override void InitializeQosEvent()
s => string.Format(CultureInfo.InvariantCulture, "-{0} ***", s)));
}

if (!string.IsNullOrWhiteSpace(this.ParameterSetName))
Copy link
Member

Choose a reason for hiding this comment

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

@praries880 since we don't need to do any additional checks (like we do with this.MyInvocation in the if-statements above), is there any reason we can't move the initialization of this property into the instantiation of the AzurePSQoSEvent object above?

_qosEvent = new AzurePSQoSEvent()
{
    CommandName = commandAlias,
    ...
    ParameterSetName = this.ParameterSetName
}

Also, I don't believe ParameterSetName can ever be null or empty (unless the cmdlet creator gives an empty set name, which doesn't happen in our cmdlets 😀 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

didnt know that either ;)

Added InnerExceptionTypie and ParameterSetName to the telemetry emitted.

Please enter the commit message for your changes. Lines starting
{
//Increment the inner exception count so that we can tell which is the outermost
//and which the innermost
eventProperties.Add("InnerExceptionType-"+exceptionCount++, innerEx.GetType().ToString());
Copy link
Member

Choose a reason for hiding this comment

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

@praries880 do we need to return all of the inner exceptions? I want to make sure we're not cluttering the telemetry with information that may or may not be relevant to us

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cormacpayne I had initially missed this piece in the linked issue :"InnerExceptionType (shouls contain a list of inner exception types)"

Hence I am adding all the inner exceptions. I can create a comma separated list of exceptions and add it to the dictionary, but I thought it might be better to return each one as a separate item in the dictionary.

@@ -204,7 +204,13 @@ protected override void InitializeQosEvent()
ClientRequestId = this._clientRequestId,
SessionId = _sessionId,
IsSuccess = true,
};
ParameterSetName = this.ParameterSetName
};
Copy link
Member

Choose a reason for hiding this comment

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

@praries880 nit: the indentation for this curly brace is off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will fix it

cormacpayne
cormacpayne previously approved these changes May 25, 2018
Copy link
Member

@cormacpayne cormacpayne left a comment

Choose a reason for hiding this comment

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

@praries880 LGTM

@twitchax would you mind checking this PR out when you get the chance?

@cormacpayne cormacpayne assigned twitchax and unassigned cormacpayne May 25, 2018
twitchax
twitchax previously approved these changes May 29, 2018
Copy link
Contributor

@twitchax twitchax left a comment

Choose a reason for hiding this comment

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

A few comments; otherwise, LGTM.

@@ -226,6 +226,16 @@ private void LogExceptionEvent(AzurePSQoSEvent qos)
eventProperties.Add("Message", "Message removed due to PII.");
eventProperties.Add("StackTrace", qos.Exception.StackTrace);
eventProperties.Add("ExceptionType", qos.Exception.GetType().ToString());
Exception innerEx = qos.Exception.InnerException;
Copy link
Contributor

Choose a reason for hiding this comment

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

I forget, how do we feel about var?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure :)
Having said that... i would use a var when dealing with anonymous types.. in this case i odnt foresee it changeing from Exception, so i explicitly use the type.

{
_qosEvent.InvocationName = this.MyInvocation.InvocationName;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not replace this whole thing (if-statement and all) with:

_qosEvent.InvocationName = this.MyInvocation?.InvocationName;

Or, can this.MyInvocation.InvocationName actually be whitespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure... What about the exception scenarios? Just wanted to play on the safer side and pass along only valid values.

Copy link
Member

Choose a reason for hiding this comment

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

@twitchax I don't believe that this.MyInvocation.InvocationName can be whitespace, but it never hurts to make the check 😀

@praries880 praries880 dismissed stale reviews from twitchax and cormacpayne via 8f3b381 May 29, 2018 22:54
@praries880
Copy link
Contributor Author

@cormacpayne can you kindly sign off again, took care of a merge conflict.

@praries880
Copy link
Contributor Author

@cormacpayne cormacpayne changed the base branch from preview to release-6.2.0 May 30, 2018 16:50
@praries880 praries880 merged commit fd20fba into Azure:release-6.2.0 May 30, 2018
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.

5 participants