From cae7a2739f58e299c16484ebcc40c08bb48190fc Mon Sep 17 00:00:00 2001 From: Luke Slevinsky Date: Wed, 21 Aug 2019 16:00:30 -0700 Subject: [PATCH 1/2] Add telemetry to serial monitor commands --- src/constants.ts | 4 ++++ src/extension.ts | 20 ++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index e946ce048..acb5f20b1 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -237,6 +237,10 @@ export enum TelemetryEventName { COMMAND_RUN_SIMULATOR_BUTTON = "COMMAND.RUN.SIMULATOR_BUTTON", COMMAND_RUN_PALETTE = "COMMAND.RUN.PALETTE", COMMAND_RUN_EDITOR_ICON = "COMMAND.RUN.EDITOR_ICON", + COMMAND_SERIAL_MONITOR_CHOOSE_PORT = "COMMAND.SERIAL_MONITOR.CHOOSE_PORT", + COMMAND_SERIAL_MONITOR_OPEN = "COMMAND.SERIAL_MONITOR.OPEN", + COMMAND_SERIAL_MONITOR_BAUD_RATE = "COMMAND.SERIAL_MONITOR.BAUD_RATE", + COMMAND_SERIAL_MONITOR_CLOSE = "COMMAND.SERIAL_MONITOR.CLOSE", // Simulator interaction SIMULATOR_BUTTON_A = "SIMULATOR.BUTTON.A", diff --git a/src/extension.ts b/src/extension.ts index 5e620a585..4acb71136 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -601,28 +601,40 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.selectSerialPort", () => { // todo add telemetry after - serialMonitor.selectSerialPort(null, null); + telemetryAI.runWithLatencyMeasure( + () => { serialMonitor.selectSerialPort(null, null); }, + TelemetryEventName.COMMAND_SERIAL_MONITOR_CHOOSE_PORT + ); } ); const openSerialMonitor: vscode.Disposable = vscode.commands.registerCommand( "pacifica.openSerialMonitor", () => { - serialMonitor.openSerialMonitor(); + telemetryAI.runWithLatencyMeasure( + serialMonitor.openSerialMonitor, + TelemetryEventName.COMMAND_SERIAL_MONITOR_OPEN + ); } ); const changeBaudRate: vscode.Disposable = vscode.commands.registerCommand( "pacifica.changeBaudRate", () => { - serialMonitor.changeBaudRate(); + telemetryAI.runWithLatencyMeasure( + serialMonitor.changeBaudRate, + TelemetryEventName.COMMAND_SERIAL_MONITOR_BAUD_RATE + ); } ); const closeSerialMonitor: vscode.Disposable = vscode.commands.registerCommand( "pacifica.closeSerialMonitor", (port, showWarning = true) => { - serialMonitor.closeSerialMonitor(port, showWarning); + telemetryAI.runWithLatencyMeasure( + () => { serialMonitor.closeSerialMonitor(port, showWarning); }, + TelemetryEventName.COMMAND_SERIAL_MONITOR_CLOSE + ) } ); From 364ca320dfa46a32b6f98a555beca575b72b1266 Mon Sep 17 00:00:00 2001 From: Luke Slevinsky Date: Thu, 22 Aug 2019 11:29:17 -0700 Subject: [PATCH 2/2] fix missing this issue --- src/extension.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 4acb71136..9f9050cfc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -612,7 +612,7 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.openSerialMonitor", () => { telemetryAI.runWithLatencyMeasure( - serialMonitor.openSerialMonitor, + serialMonitor.openSerialMonitor.bind(serialMonitor), TelemetryEventName.COMMAND_SERIAL_MONITOR_OPEN ); } @@ -622,7 +622,7 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.changeBaudRate", () => { telemetryAI.runWithLatencyMeasure( - serialMonitor.changeBaudRate, + serialMonitor.changeBaudRate.bind(serialMonitor), TelemetryEventName.COMMAND_SERIAL_MONITOR_BAUD_RATE ); }