Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5470d60

Browse filesBrowse files
authored
Handle & track conda envs not found (#23753)
1 parent a5c42b2 commit 5470d60
Copy full SHA for 5470d60

File tree

Expand file treeCollapse file tree

4 files changed

+83
-0
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+83
-0
lines changed

‎src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts

Copy file name to clipboardExpand all lines: src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { VENVFOLDERS_SETTING_KEY, VENVPATH_SETTING_KEY } from '../lowLevel/custo
1717
import { getUserHomeDir } from '../../../../common/utils/platform';
1818
import { createLogOutputChannel } from '../../../../common/vscodeApis/windowApis';
1919
import { PythonEnvKind } from '../../info';
20+
import { sendNativeTelemetry, NativePythonTelemetry } from './nativePythonTelemetry';
2021

2122
const untildify = require('untildify');
2223

@@ -253,6 +254,7 @@ class NativeGlobalPythonFinderImpl extends DisposableBase implements NativeGloba
253254
this.outputChannel.trace(data.message);
254255
}
255256
}),
257+
connection.onNotification('telemetry', (data: NativePythonTelemetry) => sendNativeTelemetry(data)),
256258
connection.onClose(() => {
257259
disposables.forEach((d) => d.dispose());
258260
}),
+40Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
import { traceError } from '../../../../logging';
5+
import { sendTelemetryEvent } from '../../../../telemetry';
6+
import { EventName } from '../../../../telemetry/constants';
7+
8+
export type NativePythonTelemetry = MissingCondaEnvironments;
9+
10+
export type MissingCondaEnvironments = {
11+
event: 'MissingCondaEnvironments';
12+
data: {
13+
missing: number;
14+
userProvidedCondaExe?: boolean;
15+
rootPrefixNotFound?: boolean;
16+
condaPrefixNotFound?: boolean;
17+
condaManagerNotFound?: boolean;
18+
sysRcNotFound?: boolean;
19+
userRcNotFound?: boolean;
20+
otherRcNotFound?: boolean;
21+
missingEnvDirsFromSysRc?: number;
22+
missingEnvDirsFromUserRc?: number;
23+
missingEnvDirsFromOtherRc?: number;
24+
missingFromSysRcEnvDirs?: number;
25+
missingFromUserRcEnvDirs?: number;
26+
missingFromOtherRcEnvDirs?: number;
27+
};
28+
};
29+
30+
export function sendNativeTelemetry(data: NativePythonTelemetry): void {
31+
switch (data.event) {
32+
case 'MissingCondaEnvironments': {
33+
sendTelemetryEvent(EventName.NATIVE_FINDER_MISSING_CONDA_ENVS, undefined, data.data);
34+
break;
35+
}
36+
default: {
37+
traceError(`Unhandled Telemetry Event type ${data.event}`);
38+
}
39+
}
40+
}

‎src/client/telemetry/constants.ts

Copy file name to clipboardExpand all lines: src/client/telemetry/constants.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export enum EventName {
1919
ENVIRONMENT_WITHOUT_PYTHON_SELECTED = 'ENVIRONMENT_WITHOUT_PYTHON_SELECTED',
2020
PYTHON_ENVIRONMENTS_API = 'PYTHON_ENVIRONMENTS_API',
2121
PYTHON_INTERPRETER_DISCOVERY = 'PYTHON_INTERPRETER_DISCOVERY',
22+
NATIVE_FINDER_MISSING_CONDA_ENVS = 'NATIVE_FINDER_MISSING_CONDA_ENVS',
2223
PYTHON_INTERPRETER_DISCOVERY_INVALID_NATIVE = 'PYTHON_INTERPRETER_DISCOVERY_INVALID_NATIVE',
2324
PYTHON_INTERPRETER_AUTO_SELECTION = 'PYTHON_INTERPRETER_AUTO_SELECTION',
2425
PYTHON_INTERPRETER_ACTIVATION_ENVIRONMENT_VARIABLES = 'PYTHON_INTERPRETER.ACTIVATION_ENVIRONMENT_VARIABLES',

‎src/client/telemetry/index.ts

Copy file name to clipboardExpand all lines: src/client/telemetry/index.ts
+40Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,46 @@ export interface IEventNamePropertyMapping {
13961396
*/
13971397
missingNativeOtherGlobalEnvs?: number;
13981398
};
1399+
/**
1400+
* Telemetry event sent when Native finder fails to find some conda envs.
1401+
*/
1402+
/* __GDPR__
1403+
"native_finder_missing_conda_envs" : {
1404+
"missing" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1405+
"userProvidedCondaExe" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
1406+
"rootPrefixNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
1407+
"condaPrefixNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
1408+
"condaManagerNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
1409+
"missingEnvDirsFromSysRc" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1410+
"missingEnvDirsFromUserRc" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1411+
"missingEnvDirsFromOtherRc" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1412+
"missingFromSysRcEnvDirs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1413+
"missingFromUserRcEnvDirs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1414+
"missingFromOtherRcEnvDirs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
1415+
}
1416+
*/
1417+
[EventName.NATIVE_FINDER_MISSING_CONDA_ENVS]: {
1418+
/**
1419+
* Number of missing conda environments.
1420+
*/
1421+
missing: number;
1422+
/**
1423+
* Whether a conda exe was provided by the user.
1424+
*/
1425+
userProvidedCondaExe?: boolean;
1426+
rootPrefixNotFound?: boolean;
1427+
condaPrefixNotFound?: boolean;
1428+
condaManagerNotFound?: boolean;
1429+
sysRcNotFound?: boolean;
1430+
userRcNotFound?: boolean;
1431+
otherRcNotFound?: boolean;
1432+
missingEnvDirsFromSysRc?: number;
1433+
missingEnvDirsFromUserRc?: number;
1434+
missingEnvDirsFromOtherRc?: number;
1435+
missingFromSysRcEnvDirs?: number;
1436+
missingFromUserRcEnvDirs?: number;
1437+
missingFromOtherRcEnvDirs?: number;
1438+
};
13991439
/**
14001440
* Telemetry event sent when discovery of all python environments using the native locator(virtualenv, conda, pipenv etc.) finishes.
14011441
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.