public static void TrackCustomEventWithCustomMetrics(this TelemetryWrapper client, string eventName, MetricData data) { if (Debugger.IsAttached) { return; } var metrics = Metrics(client.UserInfo); var eventData = new EventTelemetry(eventName); eventData.Timestamp = DateTime.UtcNow; eventData.Properties.Add(data.Key, data.Value); foreach (var itemMetric in metrics) { eventData.Properties.Add(itemMetric.Key, itemMetric.Value); } if (client != null) { eventData.Properties.Add("Visual Studio Version", client.VisualStudioVersion); eventData.Properties.Add("Toolkit Version", client.VsxVersion); } client.Instance.TrackEvent(eventData); }
public static void TrackExceptionWithCustomMetrics(this TelemetryWrapper client, Exception ex) { if (Debugger.IsAttached) { return; } var metrics = Metrics(client.UserInfo); if (client != null) { metrics.Add("Visual Studio Version", client.VisualStudioVersion); metrics.Add("Toolkit Version", client.VsxVersion); } client.Instance.TrackException(ex, metrics); }