-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fix for #4965, #6274
Conversation
There was a problem hiding this 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)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 😀 )
There was a problem hiding this comment.
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
ef94dc9
to
fdbcfb6
Compare
{ | ||
//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()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | |||
}; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix it
There was a problem hiding this 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?
There was a problem hiding this 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; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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; | ||
} | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😀
@cormacpayne can you kindly sign off again, took care of a merge conflict. |
Added InvocationName, InnerExceptionTypie and ParameterSetName to the telemetry emitted.
Issue #4965