From 5c2e6b74cfa0260c3e7f9cd18c23ad06bae81d07 Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Mon, 12 Dec 2016 15:50:08 -0800 Subject: [PATCH] Catch exceptions raised sending telemetry events (#182) --- .../Connection/ConnectionService.cs | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs index 0ace6c92..1b28daba 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs @@ -360,19 +360,26 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection if (ServiceHost != null) { - // Send a telemetry notification for intellisense performance metrics - ServiceHost.SendEvent(TelemetryNotification.Type, new TelemetryParams() + try { - Params = new TelemetryProperties + // Send a telemetry notification for intellisense performance metrics + ServiceHost.SendEvent(TelemetryNotification.Type, new TelemetryParams() { - Properties = new Dictionary - { - { "IsAzure", info.IsAzure ? "1" : "0" } - }, - EventName = TelemetryEventNames.IntellisenseQuantile, - Measures = info.IntellisenseMetrics.Quantile - } - }); + Params = new TelemetryProperties + { + Properties = new Dictionary + { + { "IsAzure", info.IsAzure ? "1" : "0" } + }, + EventName = TelemetryEventNames.IntellisenseQuantile, + Measures = info.IntellisenseMetrics.Quantile + } + }); + } + catch (Exception ex) + { + Logger.Write(LogLevel.Verbose, "Could not send Connection telemetry event " + ex.ToString()); + } } // Close the connection