-
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
Changes from all commits
8b61bc8
41fd1c7
fdbcfb6
f0eac80
51448db
8f3b381
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
int exceptionCount = 0; | ||
//keep goin till we get to the last inner exception | ||
while (innerEx != null) | ||
{ | ||
//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 commentThe 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 commentThe 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. |
||
innerEx = innerEx.InnerException; | ||
} | ||
client.TrackException(null, eventProperties, eventMetrics); | ||
} | ||
} | ||
|
@@ -266,6 +276,9 @@ 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); | ||
eventProperties.Add("CommandInvocationName", qos.InvocationName); | ||
|
||
if (qos.InputFromPipeline != null) | ||
{ | ||
eventProperties.Add("InputFromPipeline", qos.InputFromPipeline.Value.ToString()); | ||
|
@@ -371,6 +384,8 @@ public class AzurePSQoSEvent | |
public string Uid { get; set; } | ||
public string ClientRequestId { get; set; } | ||
public string SessionId { get; set; } | ||
public string ParameterSetName { get; set; } | ||
public string InvocationName { get; set; } | ||
public Dictionary<string, string> CustomProperties { get; private set; } | ||
|
||
public AzurePSQoSEvent() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,8 +204,14 @@ protected override void InitializeQosEvent() | |
ClientRequestId = this._clientRequestId, | ||
SessionId = _sessionId, | ||
IsSuccess = true, | ||
ParameterSetName = this.ParameterSetName | ||
}; | ||
|
||
if (this.MyInvocation != null && !string.IsNullOrWhiteSpace(this.MyInvocation.InvocationName)) | ||
{ | ||
_qosEvent.InvocationName = this.MyInvocation.InvocationName; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not replace this whole thing (if-statement and all) with:
Or, can There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. @twitchax I don't believe that |
||
if (this.MyInvocation != null && this.MyInvocation.BoundParameters != null | ||
&& this.MyInvocation.BoundParameters.Keys != null) | ||
{ | ||
|
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.