Skip to content

Commit 94f04b3

Browse files
committed
Telemetry
1 parent d7f954d commit 94f04b3

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/client/pythonEnvironments/creation/provider/venvUtils.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { Commands } from '../../../common/constants';
1919
import { isWindows } from '../../../common/platform/platformService';
2020
import { getVenvPath, hasVenv } from '../common/commonUtils';
2121
import { deleteEnvironmentNonWindows, deleteEnvironmentWindows } from './venvDeleteUtils';
22+
import { sendTelemetryEvent } from '../../../telemetry';
23+
import { EventName } from '../../../telemetry/constants';
2224

2325
const exclude = '**/{.venv*,.git,.nox,.tox,.conda,site-packages,__pypackages__}/**';
2426
async function getPipRequirementsFiles(
@@ -287,12 +289,23 @@ export async function pickExistingVenvAction(
287289

288290
if (selection.label === CreateEnv.Venv.recreate) {
289291
if (await deleteEnvironment(workspaceFolder, interpreter)) {
292+
sendTelemetryEvent(EventName.ENVIRONMENT_DELETE, undefined, {
293+
environmentType: 'venv',
294+
status: 'deleted',
295+
});
290296
return MultiStepAction.Continue;
291297
}
298+
sendTelemetryEvent(EventName.ENVIRONMENT_DELETE, undefined, {
299+
environmentType: 'venv',
300+
status: 'failed',
301+
});
292302
return MultiStepAction.Cancel;
293303
}
294304

295305
if (selection.label === CreateEnv.Venv.useExisting) {
306+
sendTelemetryEvent(EventName.ENVIRONMENT_REUSE, undefined, {
307+
environmentType: 'venv',
308+
});
296309
return MultiStepAction.Continue;
297310
}
298311
} else if (context === MultiStepAction.Back) {

src/client/telemetry/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ export enum EventName {
112112
ENVIRONMENT_INSTALLED_PACKAGES = 'ENVIRONMENT.INSTALLED_PACKAGES',
113113
ENVIRONMENT_INSTALLING_PACKAGES_FAILED = 'ENVIRONMENT.INSTALLING_PACKAGES_FAILED',
114114
ENVIRONMENT_BUTTON = 'ENVIRONMENT.BUTTON',
115+
ENVIRONMENT_DELETE = 'ENVIRONMENT.DELETE',
116+
ENVIRONMENT_REUSE = 'ENVIRONMENT.REUSE',
115117

116118
TOOLS_EXTENSIONS_ALREADY_INSTALLED = 'TOOLS_EXTENSIONS.ALREADY_INSTALLED',
117119
TOOLS_EXTENSIONS_PROMPT_SHOWN = 'TOOLS_EXTENSIONS.PROMPT_SHOWN',

src/client/telemetry/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,6 +2120,30 @@ export interface IEventNamePropertyMapping {
21202120
"environment.button" : {"owner": "karthiknadig" }
21212121
*/
21222122
[EventName.ENVIRONMENT_BUTTON]: never | undefined;
2123+
/**
2124+
* Telemetry event if user selected to delete the existing environment.
2125+
*/
2126+
/* __GDPR__
2127+
"environment.delete" : {
2128+
"environmentType" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
2129+
"status" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" }
2130+
}
2131+
*/
2132+
[EventName.ENVIRONMENT_DELETE]: {
2133+
environmentType: 'venv' | 'conda';
2134+
status: 'deleted' | 'failed';
2135+
};
2136+
/**
2137+
* Telemetry event if user selected to re-use the existing environment.
2138+
*/
2139+
/* __GDPR__
2140+
"environment.reuse" : {
2141+
"environmentType" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" }
2142+
}
2143+
*/
2144+
[EventName.ENVIRONMENT_REUSE]: {
2145+
environmentType: 'venv' | 'conda';
2146+
};
21232147
/**
21242148
* Telemetry event sent when a linter or formatter extension is already installed.
21252149
*/

0 commit comments

Comments
 (0)