diff --git a/src/constants.ts b/src/constants.ts index 860bb9463..2dff4dabc 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -255,6 +255,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 33bb5aa41..37a6a3365 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -442,7 +442,7 @@ export async function activate(context: vscode.ExtensionContext) { case "print": console.log( `Process print statement output = ${ - messageToWebview.data + messageToWebview.data }` ); utils.logToOutputChannel( @@ -644,7 +644,10 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.selectSerialPort", () => { if (serialMonitor) { - serialMonitor.selectSerialPort(null, null); + telemetryAI.runWithLatencyMeasure( + () => { serialMonitor.selectSerialPort(null, null); }, + TelemetryEventName.COMMAND_SERIAL_MONITOR_CHOOSE_PORT + ); } else { vscode.window.showErrorMessage(CONSTANTS.ERROR.NO_FOLDER_OPENED); console.info("Serial monitor is not defined."); @@ -656,7 +659,10 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.openSerialMonitor", () => { if (serialMonitor) { - serialMonitor.openSerialMonitor(); + telemetryAI.runWithLatencyMeasure( + serialMonitor.openSerialMonitor.bind(serialMonitor), + TelemetryEventName.COMMAND_SERIAL_MONITOR_OPEN + ); } else { vscode.window.showErrorMessage(CONSTANTS.ERROR.NO_FOLDER_OPENED); console.info("Serial monitor is not defined."); @@ -668,7 +674,10 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.changeBaudRate", () => { if (serialMonitor) { - serialMonitor.changeBaudRate(); + telemetryAI.runWithLatencyMeasure( + serialMonitor.changeBaudRate.bind(serialMonitor), + TelemetryEventName.COMMAND_SERIAL_MONITOR_BAUD_RATE + ); } else { vscode.window.showErrorMessage(CONSTANTS.ERROR.NO_FOLDER_OPENED); console.info("Serial monitor is not defined."); @@ -680,7 +689,10 @@ export async function activate(context: vscode.ExtensionContext) { "pacifica.closeSerialMonitor", (port, showWarning = true) => { if (serialMonitor) { - serialMonitor.closeSerialMonitor(port, showWarning); + telemetryAI.runWithLatencyMeasure( + () => { serialMonitor.closeSerialMonitor(port, showWarning); }, + TelemetryEventName.COMMAND_SERIAL_MONITOR_CLOSE + ) } else { vscode.window.showErrorMessage(CONSTANTS.ERROR.NO_FOLDER_OPENED); console.info("Serial monitor is not defined.");