Skip to content

Commit

Permalink
Add telemetry for deactivate prompt (#22274)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj authored Oct 21, 2023
1 parent f57be20 commit d758741
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum EventName {
PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT = 'PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT',
PYTHON_NOT_INSTALLED_PROMPT = 'PYTHON_NOT_INSTALLED_PROMPT',
CONDA_INHERIT_ENV_PROMPT = 'CONDA_INHERIT_ENV_PROMPT',
TERMINAL_DEACTIVATE_PROMPT = 'TERMINAL_DEACTIVATE_PROMPT',
REQUIRE_JUPYTER_PROMPT = 'REQUIRE_JUPYTER_PROMPT',
ACTIVATED_CONDA_ENV_LAUNCH = 'ACTIVATED_CONDA_ENV_LAUNCH',
ENVFILE_VARIABLE_SUBSTITUTION = 'ENVFILE_VARIABLE_SUBSTITUTION',
Expand Down
19 changes: 18 additions & 1 deletion src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1226,13 +1226,30 @@ export interface IEventNamePropertyMapping {
selection: 'Allow' | 'Close' | undefined;
};
/**
* Telemetry event sent with details when user attempts to run in interactive window when Jupyter is not installed.
* Telemetry event sent with details when user clicks the prompt with the following message:
*
* '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?'
*/
/* __GDPR__
"conda_inherit_env_prompt" : {
"selection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
}
*/
[EventName.TERMINAL_DEACTIVATE_PROMPT]: {
/**
* `Yes` When 'Allow' option is selected
* `Close` When 'Close' option is selected
*/
selection: 'Edit script' | "Don't show again" | undefined;
};
/**
* Telemetry event sent with details when user attempts to run in interactive window when Jupyter is not installed.
*/
/* __GDPR__
"require_jupyter_prompt" : {
"selection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
}
*/
[EventName.REQUIRE_JUPYTER_PROMPT]: {
/**
* `Yes` When 'Yes' option is selected
Expand Down
10 changes: 10 additions & 0 deletions src/client/terminals/envCollectionActivation/deactivatePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import { isTestExecution } from '../../common/constants';
import { ProgressService } from '../../common/application/progressService';
import { copyFile, createFile, pathExists } from '../../common/platform/fs-paths';
import { getOSType, OSType } from '../../common/utils/platform';
import { sendTelemetryEvent } from '../../telemetry';
import { EventName } from '../../telemetry/constants';

export const terminalDeactivationPromptKey = 'TERMINAL_DEACTIVATION_PROMPT_KEY';
@injectable()
Expand Down Expand Up @@ -115,12 +117,20 @@ export class TerminalDeactivateLimitationPrompt implements IExtensionSingleActiv
// Shell integration is not supported for these shells, in which case this workaround won't work.
return;
}
const telemetrySelections: ['Edit script', "Don't show again"] = ['Edit script', "Don't show again"];
const { initScript, source, destination } = scriptInfo;
const prompts = [Common.editSomething.format(initScript.displayName), Common.doNotShowAgain];
const selection = await this.appShell.showWarningMessage(
Interpreters.terminalDeactivatePrompt.format(initScript.displayName),
...prompts,
);
let index = selection ? prompts.indexOf(selection) : 0;
if (selection === prompts[0]) {
index = 0;
}
sendTelemetryEvent(EventName.TERMINAL_DEACTIVATE_PROMPT, undefined, {
selection: selection ? telemetrySelections[index] : undefined,
});
if (!selection) {
return;
}
Expand Down

0 comments on commit d758741

Please sign in to comment.