Skip to content

Commit fd20fba

Browse files
authored
Merge pull request #6274 from praries880/update_telemetry
Fix for #4965,
2 parents bd69cc2 + 8f3b381 commit fd20fba

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/Common/Commands.Common/MetricHelper.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ private void LogExceptionEvent(AzurePSQoSEvent qos)
226226
eventProperties.Add("Message", "Message removed due to PII.");
227227
eventProperties.Add("StackTrace", qos.Exception.StackTrace);
228228
eventProperties.Add("ExceptionType", qos.Exception.GetType().ToString());
229+
Exception innerEx = qos.Exception.InnerException;
230+
int exceptionCount = 0;
231+
//keep goin till we get to the last inner exception
232+
while (innerEx != null)
233+
{
234+
//Increment the inner exception count so that we can tell which is the outermost
235+
//and which the innermost
236+
eventProperties.Add("InnerExceptionType-"+exceptionCount++, innerEx.GetType().ToString());
237+
innerEx = innerEx.InnerException;
238+
}
229239
client.TrackException(null, eventProperties, eventMetrics);
230240
}
231241
}
@@ -266,6 +276,9 @@ private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary<string,
266276
eventProperties.Add("HashMacAddress", HashMacAddress);
267277
eventProperties.Add("PowerShellVersion", PSVersion);
268278
eventProperties.Add("Version", AzurePowerShell.AssemblyVersion);
279+
eventProperties.Add("CommandParameterSetName", qos.ParameterSetName);
280+
eventProperties.Add("CommandInvocationName", qos.InvocationName);
281+
269282
if (qos.InputFromPipeline != null)
270283
{
271284
eventProperties.Add("InputFromPipeline", qos.InputFromPipeline.Value.ToString());
@@ -371,6 +384,8 @@ public class AzurePSQoSEvent
371384
public string Uid { get; set; }
372385
public string ClientRequestId { get; set; }
373386
public string SessionId { get; set; }
387+
public string ParameterSetName { get; set; }
388+
public string InvocationName { get; set; }
374389
public Dictionary<string, string> CustomProperties { get; private set; }
375390

376391
public AzurePSQoSEvent()

src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,14 @@ protected override void InitializeQosEvent()
204204
ClientRequestId = this._clientRequestId,
205205
SessionId = _sessionId,
206206
IsSuccess = true,
207+
ParameterSetName = this.ParameterSetName
207208
};
208209

210+
if (this.MyInvocation != null && !string.IsNullOrWhiteSpace(this.MyInvocation.InvocationName))
211+
{
212+
_qosEvent.InvocationName = this.MyInvocation.InvocationName;
213+
}
214+
209215
if (this.MyInvocation != null && this.MyInvocation.BoundParameters != null
210216
&& this.MyInvocation.BoundParameters.Keys != null)
211217
{

src/ResourceManager/Profile/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Added the following three values to the telemetry :
22+
- Inner exception types
23+
- ParameterSetName
24+
- InvocationName
2125
* Fix issue where version 10.0.3 of Newtonsoft.Json wasn't being loaded on module import
2226

2327
## Version 5.1.0

0 commit comments

Comments
 (0)