From ea3220dd49d6ab0d8244f34a8dbff1d12fe2b0e4 Mon Sep 17 00:00:00 2001 From: Rajkumar Janakiraman Date: Wed, 7 Oct 2015 12:06:44 -0700 Subject: [PATCH 1/2] Adding telemetry for Engine. --- src/AndroidDebugLauncher/Launcher.cs | 8 +++++--- src/AndroidDebugLauncher/Telemetry.cs | 8 ++++++-- src/MICore/LaunchOptions.cs | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/AndroidDebugLauncher/Launcher.cs b/src/AndroidDebugLauncher/Launcher.cs index c7210ebd9f..7a6f4f1a1f 100644 --- a/src/AndroidDebugLauncher/Launcher.cs +++ b/src/AndroidDebugLauncher/Launcher.cs @@ -86,6 +86,7 @@ void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result) var cancellationTokenSource = new CancellationTokenSource(); ExceptionDispatchInfo exceptionDispatchInfo = null; LaunchOptions localLaunchOptions = null; + TargetEngine targetEngine = TargetEngine.Unknown; _waitLoop = new MICore.WaitLoop(LauncherResources.WaitDialogText); @@ -97,7 +98,7 @@ void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result) try { - localLaunchOptions = SetupForDebuggingWorker(cancellationTokenSource.Token); + localLaunchOptions = SetupForDebuggingWorker(cancellationTokenSource.Token, out targetEngine); launchErrorTelemetryResult = "None"; } catch (Exception e) @@ -113,7 +114,7 @@ void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result) if (launchErrorTelemetryResult != null) { - Telemetry.SendLaunchError(launchErrorTelemetryResult); + Telemetry.SendLaunchError(launchErrorTelemetryResult, targetEngine.ToString()); } } ); @@ -145,7 +146,7 @@ public NamedAction(string name, Action action) } } - private LaunchOptions SetupForDebuggingWorker(CancellationToken token) + private LaunchOptions SetupForDebuggingWorker(CancellationToken token, out TargetEngine targetEngine) { CancellationTokenRegistration onCancelRegistration = token.Register(() => { @@ -439,6 +440,7 @@ private LaunchOptions SetupForDebuggingWorker(CancellationToken token) launchOptions.VisualizerFile = "Microsoft.Android.natvis"; + targetEngine = _targetEngine; return launchOptions; } } diff --git a/src/AndroidDebugLauncher/Telemetry.cs b/src/AndroidDebugLauncher/Telemetry.cs index 18f9a8d935..152ca51ea1 100644 --- a/src/AndroidDebugLauncher/Telemetry.cs +++ b/src/AndroidDebugLauncher/Telemetry.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using MICore; using Microsoft.Internal.VisualStudio.Shell; using Microsoft.Internal.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Shell; @@ -21,6 +22,7 @@ internal static class Telemetry private const string Event_LaunchError = @"VS/Diagnostics/Debugger/Android/LaunchFailure"; private const string Property_LaunchErrorResult = @"VS.Diagnostics.Debugger.Android.FailureResult"; + private const string Property_LaunchTargetEngine = @"VS.Diagnostics.Debugger.Android.TargetEngine"; #region LaunchFailure support @@ -101,9 +103,11 @@ public static string GetLaunchErrorResultValue(Exception exception) return exception.GetType().FullName; } } - public static void SendLaunchError(string launchErrorTelemetryResult) + public static void SendLaunchError(string launchErrorTelemetryResult, string targetEngine) { - SendEvent(Event_LaunchError, new KeyValuePair(Property_LaunchErrorResult, launchErrorTelemetryResult)); + SendEvent(Event_LaunchError, + new KeyValuePair(Property_LaunchErrorResult, launchErrorTelemetryResult), + new KeyValuePair(Property_LaunchTargetEngine, targetEngine)); } #endregion diff --git a/src/MICore/LaunchOptions.cs b/src/MICore/LaunchOptions.cs index c451d24a41..53ada1b14d 100644 --- a/src/MICore/LaunchOptions.cs +++ b/src/MICore/LaunchOptions.cs @@ -29,8 +29,9 @@ public enum TargetArchitecture public enum TargetEngine { + Unknown, Native, - Java + Java, } public enum LaunchCompleteCommand From 59193e2b396758eb4969339a011612917ed5e279 Mon Sep 17 00:00:00 2001 From: Rajkumar Janakiraman Date: Wed, 7 Oct 2015 12:37:46 -0700 Subject: [PATCH 2/2] Gets target engine telemetry, even when failure happens. --- src/AndroidDebugLauncher/Launcher.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/AndroidDebugLauncher/Launcher.cs b/src/AndroidDebugLauncher/Launcher.cs index 7a6f4f1a1f..c1174b0884 100644 --- a/src/AndroidDebugLauncher/Launcher.cs +++ b/src/AndroidDebugLauncher/Launcher.cs @@ -86,7 +86,6 @@ void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result) var cancellationTokenSource = new CancellationTokenSource(); ExceptionDispatchInfo exceptionDispatchInfo = null; LaunchOptions localLaunchOptions = null; - TargetEngine targetEngine = TargetEngine.Unknown; _waitLoop = new MICore.WaitLoop(LauncherResources.WaitDialogText); @@ -98,7 +97,7 @@ void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result) try { - localLaunchOptions = SetupForDebuggingWorker(cancellationTokenSource.Token, out targetEngine); + localLaunchOptions = SetupForDebuggingWorker(cancellationTokenSource.Token); launchErrorTelemetryResult = "None"; } catch (Exception e) @@ -114,7 +113,7 @@ void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result) if (launchErrorTelemetryResult != null) { - Telemetry.SendLaunchError(launchErrorTelemetryResult, targetEngine.ToString()); + Telemetry.SendLaunchError(launchErrorTelemetryResult, _targetEngine.ToString()); } } ); @@ -146,7 +145,7 @@ public NamedAction(string name, Action action) } } - private LaunchOptions SetupForDebuggingWorker(CancellationToken token, out TargetEngine targetEngine) + private LaunchOptions SetupForDebuggingWorker(CancellationToken token) { CancellationTokenRegistration onCancelRegistration = token.Register(() => { @@ -440,7 +439,6 @@ private LaunchOptions SetupForDebuggingWorker(CancellationToken token, out Targe launchOptions.VisualizerFile = "Microsoft.Android.natvis"; - targetEngine = _targetEngine; return launchOptions; } }