diff --git a/src/Microsoft.DotNet.Cli.Utils/Telemetry.cs b/src/Microsoft.DotNet.Cli.Utils/Telemetry.cs index 230dcad6a..4a5bc518a 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Telemetry.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Telemetry.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using Microsoft.ApplicationInsights; using Microsoft.Extensions.PlatformAbstractions; +using System.Diagnostics; namespace Microsoft.DotNet.Cli.Utils { @@ -13,9 +14,7 @@ namespace Microsoft.DotNet.Cli.Utils private static Dictionary _commonProperties = null; private static Dictionary _commonMeasurements = null; - //readonly instead of const to to avoid inlining in case we need to change the instrumentation key - private static readonly string InstrumentationKey = "74cc1c9e-3e6e-4d05-b3fc-dde9101d0254"; - + private const string InstrumentationKey = "74cc1c9e-3e6e-4d05-b3fc-dde9101d0254"; private const string TelemetryOptout = "DOTNET_CLI_TELEMETRY_OPTOUT"; private const string OSVersion = "OS Version"; private const string OSPlatform = "OS Platform"; @@ -50,7 +49,11 @@ namespace Microsoft.DotNet.Cli.Utils _isInitialized = true; } - catch (Exception) { } + catch (Exception) + { + // we dont want to fail the tool if telemetry fais. We should be able to detect abnormalities from data + // at the server end + } } public void TrackCommand(string command, IDictionary properties = null, IDictionary measurements = null) @@ -69,6 +72,7 @@ namespace Microsoft.DotNet.Cli.Utils catch (Exception) { } } + private Dictionary GetEventMeasures(IDictionary measurements) { Dictionary eventMeasurements = new Dictionary(_commonMeasurements); diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index f9a6ec42d..220f6ca24 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -139,10 +139,6 @@ namespace Microsoft.DotNet.Cli telemetryClient.TrackCommand( command, - new Dictionary - { - ["Arguments"] = arguments - }, new Dictionary { ["ExitCode"] = exitCode