Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ export enum CONFIG_KEYS {

export enum TelemetryEventName {
FAILED_TO_OPEN_SIMULATOR = "SIMULATOR.FAILED_TO_OPEN",
DEBUGGER_INIT_SUCCESS = "DEBUGGER.INIT.SUCCESS",
DEBUGGER_INIT_FAIL = "DEBUGGER.INIT.FAIL",

// Debugger
CPX_DEBUGGER_INIT_SUCCESS = "CPX.DEBUGGER.INIT.SUCCESS",
CPX_DEBUGGER_INIT_FAIL = "CPX.DEBUGGER.INIT.FAIL",
MICROBIT_DEBUGGER_INIT_SUCCESS = "MICROBIT.DEBUGGER.INIT.SUCCESS",
MICROBIT_DEBUGGER_INIT_FAIL = "MICROBIT.DEBUGGER.INIT.FAIL",

// Extension commands
COMMAND_RUN_SIMULATOR_BUTTON = "COMMAND.RUN.SIMULATOR_BUTTON",
Expand Down
42 changes: 36 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,9 +934,7 @@ export async function activate(context: vscode.ExtensionContext) {
utils.getServerPortConfig()
);

telemetryAI.trackFeatureUsage(
TelemetryEventName.DEBUGGER_INIT_SUCCESS
);
handleDebuggerTelemetry();

openWebview();
if (currentPanel) {
Expand All @@ -952,9 +950,7 @@ export async function activate(context: vscode.ExtensionContext) {
`Error trying to init the server on port ${utils.getServerPortConfig()}`
);

telemetryAI.trackFeatureUsage(
TelemetryEventName.DEBUGGER_INIT_FAIL
);
handleDebuggerFailTelemetry();

vscode.window.showErrorMessage(
CONSTANTS.ERROR.DEBUGGER_SERVER_INIT_FAILED(
Expand Down Expand Up @@ -1039,6 +1035,40 @@ const updateCurrentFileIfPython = async (
}
};

const handleDebuggerTelemetry = () => {
switch (currentActiveDevice) {
case CONSTANTS.DEVICE_NAME.CPX:
telemetryAI.trackFeatureUsage(
TelemetryEventName.CPX_DEBUGGER_INIT_SUCCESS
);
break;
case CONSTANTS.DEVICE_NAME.MICROBIT:
telemetryAI.trackFeatureUsage(
TelemetryEventName.MICROBIT_DEBUGGER_INIT_SUCCESS
);
break;
default:
break;
}
};

const handleDebuggerFailTelemetry = () => {
switch (currentActiveDevice) {
case CONSTANTS.DEVICE_NAME.CPX:
telemetryAI.trackFeatureUsage(
TelemetryEventName.CPX_DEBUGGER_INIT_FAIL
);
break;
case CONSTANTS.DEVICE_NAME.MICROBIT:
telemetryAI.trackFeatureUsage(
TelemetryEventName.MICROBIT_DEBUGGER_INIT_FAIL
);
break;
default:
break;
}
};

const handleButtonPressTelemetry = (buttonState: any) => {
switch (currentActiveDevice) {
case CONSTANTS.DEVICE_NAME.CPX:
Expand Down