Skip to content

Commit d758741

Browse files
author
Kartik Raj
authored
Add telemetry for deactivate prompt (microsoft#22274)
1 parent f57be20 commit d758741

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/client/telemetry/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export enum EventName {
2727
PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT = 'PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT',
2828
PYTHON_NOT_INSTALLED_PROMPT = 'PYTHON_NOT_INSTALLED_PROMPT',
2929
CONDA_INHERIT_ENV_PROMPT = 'CONDA_INHERIT_ENV_PROMPT',
30+
TERMINAL_DEACTIVATE_PROMPT = 'TERMINAL_DEACTIVATE_PROMPT',
3031
REQUIRE_JUPYTER_PROMPT = 'REQUIRE_JUPYTER_PROMPT',
3132
ACTIVATED_CONDA_ENV_LAUNCH = 'ACTIVATED_CONDA_ENV_LAUNCH',
3233
ENVFILE_VARIABLE_SUBSTITUTION = 'ENVFILE_VARIABLE_SUBSTITUTION',

src/client/telemetry/index.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,13 +1226,30 @@ export interface IEventNamePropertyMapping {
12261226
selection: 'Allow' | 'Close' | undefined;
12271227
};
12281228
/**
1229-
* Telemetry event sent with details when user attempts to run in interactive window when Jupyter is not installed.
1229+
* Telemetry event sent with details when user clicks the prompt with the following message:
1230+
*
1231+
* 'We noticed you're using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we suggest the "terminal.integrated.inheritEnv" setting to be changed to false. Would you like to update this setting?'
12301232
*/
12311233
/* __GDPR__
12321234
"conda_inherit_env_prompt" : {
12331235
"selection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
12341236
}
12351237
*/
1238+
[EventName.TERMINAL_DEACTIVATE_PROMPT]: {
1239+
/**
1240+
* `Yes` When 'Allow' option is selected
1241+
* `Close` When 'Close' option is selected
1242+
*/
1243+
selection: 'Edit script' | "Don't show again" | undefined;
1244+
};
1245+
/**
1246+
* Telemetry event sent with details when user attempts to run in interactive window when Jupyter is not installed.
1247+
*/
1248+
/* __GDPR__
1249+
"require_jupyter_prompt" : {
1250+
"selection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
1251+
}
1252+
*/
12361253
[EventName.REQUIRE_JUPYTER_PROMPT]: {
12371254
/**
12381255
* `Yes` When 'Yes' option is selected

src/client/terminals/envCollectionActivation/deactivatePrompt.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import { isTestExecution } from '../../common/constants';
3434
import { ProgressService } from '../../common/application/progressService';
3535
import { copyFile, createFile, pathExists } from '../../common/platform/fs-paths';
3636
import { getOSType, OSType } from '../../common/utils/platform';
37+
import { sendTelemetryEvent } from '../../telemetry';
38+
import { EventName } from '../../telemetry/constants';
3739

3840
export const terminalDeactivationPromptKey = 'TERMINAL_DEACTIVATION_PROMPT_KEY';
3941
@injectable()
@@ -115,12 +117,20 @@ export class TerminalDeactivateLimitationPrompt implements IExtensionSingleActiv
115117
// Shell integration is not supported for these shells, in which case this workaround won't work.
116118
return;
117119
}
120+
const telemetrySelections: ['Edit script', "Don't show again"] = ['Edit script', "Don't show again"];
118121
const { initScript, source, destination } = scriptInfo;
119122
const prompts = [Common.editSomething.format(initScript.displayName), Common.doNotShowAgain];
120123
const selection = await this.appShell.showWarningMessage(
121124
Interpreters.terminalDeactivatePrompt.format(initScript.displayName),
122125
...prompts,
123126
);
127+
let index = selection ? prompts.indexOf(selection) : 0;
128+
if (selection === prompts[0]) {
129+
index = 0;
130+
}
131+
sendTelemetryEvent(EventName.TERMINAL_DEACTIVATE_PROMPT, undefined, {
132+
selection: selection ? telemetrySelections[index] : undefined,
133+
});
124134
if (!selection) {
125135
return;
126136
}

0 commit comments

Comments
 (0)