Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine reasons for Poetry find failures #23771

Merged
merged 1 commit into from
Jul 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { traceError } from '../../../../logging';
import { sendTelemetryEvent } from '../../../../telemetry';
import { EventName } from '../../../../telemetry/constants';

export type NativePythonTelemetry = MissingCondaEnvironments;
export type NativePythonTelemetry = MissingCondaEnvironments | MissingPoetryEnvironments;

export type MissingCondaEnvironments = {
event: 'MissingCondaEnvironments';
Expand All @@ -30,6 +30,24 @@ export type MissingCondaEnvironments = {
};
};

export type MissingPoetryEnvironments = {
event: 'MissingPoetryEnvironments';
data: {
missingPoetryEnvironments: {
missing: number;
missingInPath: number;
userProvidedPoetryExe?: boolean;
poetryExeNotFound?: boolean;
globalConfigNotFound?: boolean;
cacheDirNotFound?: boolean;
cacheDirIsDifferent?: boolean;
virtualenvsPathNotFound?: boolean;
virtualenvsPathIsDifferent?: boolean;
inProjectIsDifferent?: boolean;
};
};
};

export function sendNativeTelemetry(data: NativePythonTelemetry): void {
switch (data.event) {
case 'MissingCondaEnvironments': {
Expand All @@ -40,8 +58,16 @@ export function sendNativeTelemetry(data: NativePythonTelemetry): void {
);
break;
}
case 'MissingPoetryEnvironments': {
sendTelemetryEvent(
EventName.NATIVE_FINDER_MISSING_POETRY_ENVS,
undefined,
data.data.missingPoetryEnvironments,
);
break;
}
default: {
traceError(`Unhandled Telemetry Event type ${data.event}`);
traceError(`Unhandled Telemetry Event type ${JSON.stringify(data)}`);
}
}
}
1 change: 1 addition & 0 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum EventName {
PYTHON_ENVIRONMENTS_API = 'PYTHON_ENVIRONMENTS_API',
PYTHON_INTERPRETER_DISCOVERY = 'PYTHON_INTERPRETER_DISCOVERY',
NATIVE_FINDER_MISSING_CONDA_ENVS = 'NATIVE_FINDER_MISSING_CONDA_ENVS',
NATIVE_FINDER_MISSING_POETRY_ENVS = 'NATIVE_FINDER_MISSING_POETRY_ENVS',
PYTHON_INTERPRETER_DISCOVERY_INVALID_NATIVE = 'PYTHON_INTERPRETER_DISCOVERY_INVALID_NATIVE',
PYTHON_INTERPRETER_AUTO_SELECTION = 'PYTHON_INTERPRETER_AUTO_SELECTION',
PYTHON_INTERPRETER_ACTIVATION_ENVIRONMENT_VARIABLES = 'PYTHON_INTERPRETER.ACTIVATION_ENVIRONMENT_VARIABLES',
Expand Down
59 changes: 59 additions & 0 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,65 @@ export interface IEventNamePropertyMapping {
*/
missingFromOtherRcEnvDirs?: number;
};
/**
* Telemetry event sent when Native finder fails to find some conda envs.
*/
/* __GDPR__
"native_finder_missing_poetry_envs" : {
"missing" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"missingInPath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"userProvidedPoetryExe" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"poetryExeNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"globalConfigNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"cacheDirNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"cacheDirIsDifferent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"virtualenvsPathNotFound" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"virtualenvsPathIsDifferent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"inProjectIsDifferent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
}
*/
[EventName.NATIVE_FINDER_MISSING_POETRY_ENVS]: {
/**
* Number of missing poetry environments.
*/
missing: number;
/**
* Total number of missing envs, where the envs are created in the virtualenvs_path directory.
*/
missingInPath: number;
/**
* Whether a poetry exe was provided by the user.
*/
userProvidedPoetryExe?: boolean;
/**
* Whether poetry exe was not found.
*/
poetryExeNotFound?: boolean;
/**
* Whether poetry config was not found.
*/
globalConfigNotFound?: boolean;
/**
* Whether cache_dir was not found.
*/
cacheDirNotFound?: boolean;
/**
* Whether cache_dir found was different from that returned by poetry exe.
*/
cacheDirIsDifferent?: boolean;
/**
* Whether virtualenvs.path was not found.
*/
virtualenvsPathNotFound?: boolean;
/**
* Whether virtualenvs.path found was different from that returned by poetry exe.
*/
virtualenvsPathIsDifferent?: boolean;
/**
* Whether virtualenvs.in-project found was different from that returned by poetry exe.
*/
inProjectIsDifferent?: boolean;
};
/**
* Telemetry event sent when discovery of all python environments using the native locator(virtualenv, conda, pipenv etc.) finishes.
*/
Expand Down
Loading