public void SafeTrackProjectVsTelemetry(Dictionary <string, string> properties, Dictionary <string, double> metrics, bool success = true) { try { VsTelem.TelemetryResult result = success ? VsTelem.TelemetryResult.Success : VsTelem.TelemetryResult.Failure; VsTelem.UserTaskEvent e = new VsTelem.UserTaskEvent(VsTelemetryEvents.ProjectGen, result, "Project generated"); foreach (var key in properties.Keys) { string renamedKey = key.Replace(TelemetryEvents.Prefix, VsTelemetryEvents.Prefix); if (!string.IsNullOrEmpty(properties[key])) { e.Properties[renamedKey] = properties[key]; } } foreach (var key in metrics.Keys) { string renamedKey = key.Replace(TelemetryEvents.Prefix, TelemetryEvents.Prefix.ToUpper() + "."); e.Properties[renamedKey] = new VsTelem.TelemetryMetricProperty(metrics[key]); } VsTelem.TelemetryService.DefaultSession.PostEvent(e); } catch (Exception ex) { Trace.TraceInformation($"Exception tracking Project Creation in VsTelemetry:\r\n" + ex.ToString()); } }
private void TrackNewItemVsTelemetry(Dictionary <string, string> properties, string pageIdentities, string featureIdentities, Dictionary <string, double> metrics, bool success = true) { VsTelem.TelemetryResult result = success ? VsTelem.TelemetryResult.Success : VsTelem.TelemetryResult.Failure; VsTelem.UserTaskEvent e = new VsTelem.UserTaskEvent(VsTelemetryEvents.WtsGen, result, "New Item generated"); foreach (var key in properties.Keys) { string renamedKey = key.Replace(TelemetryEvents.Prefix, VsTelemetryEvents.Prefix); if (!string.IsNullOrEmpty(properties[key])) { e.Properties[renamedKey] = properties[key]; } } e.Properties.Add(VsTelemetryProperties.Pages, pageIdentities); e.Properties.Add(VsTelemetryProperties.Features, featureIdentities); foreach (var key in metrics.Keys) { string renamedKey = key.Replace(TelemetryEvents.Prefix, TelemetryEvents.Prefix.ToUpper() + "."); e.Properties[renamedKey] = new VsTelem.TelemetryMetricProperty(metrics[key]); } VsTelem.TelemetryService.DefaultSession.PostEvent(e); }
private void TrackWizardCancelledVsTelemetry(Dictionary <string, string> properties, bool success) { VsTelem.TelemetryResult result = success ? VsTelem.TelemetryResult.Success : VsTelem.TelemetryResult.Failure; VsTelem.UserTaskEvent e = new VsTelem.UserTaskEvent(VsTelemetryEvents.WtsWizard, result, "Wizard cancelled"); foreach (var key in properties.Keys) { string renamedKey = key.Replace(TelemetryEvents.Prefix, VsTelemetryEvents.Prefix); if (!string.IsNullOrEmpty(properties[key])) { e.Properties[renamedKey] = properties[key]; } } VsTelem.TelemetryService.DefaultSession.PostEvent(e); }