Skip to content
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 | MissingPoetryEnvironments;
export type NativePythonTelemetry = MissingCondaEnvironments | MissingPoetryEnvironments | RefreshPerformance;

export type MissingCondaEnvironments = {
event: 'MissingCondaEnvironments';
Expand Down Expand Up @@ -48,6 +48,37 @@ export type MissingPoetryEnvironments = {
};
};

export type RefreshPerformance = {
event: 'RefreshPerformance';
data: {
refreshPerformance: {
total: number;
breakdown: {
Locators: number;
Path: number;
GlobalVirtualEnvs: number;
Workspaces: number;
};
locators: {
Conda?: number;
Homebrew?: number;
LinuxGlobalPython?: number;
MacCmdLineTools?: number;
MacPythonOrg?: number;
MacXCode?: number;
PipEnv?: number;
Poetry?: number;
PyEnv?: number;
Venv?: number;
VirtualEnv?: number;
VirtualEnvWrapper?: number;
WindowsRegistry?: number;
WindowsStore?: number;
};
};
};
};

export function sendNativeTelemetry(data: NativePythonTelemetry): void {
switch (data.event) {
case 'MissingCondaEnvironments': {
Expand All @@ -66,6 +97,30 @@ export function sendNativeTelemetry(data: NativePythonTelemetry): void {
);
break;
}
case 'RefreshPerformance': {
sendTelemetryEvent(EventName.NATIVE_FINDER_PERF, undefined, {
duration: data.data.refreshPerformance.total,
breakdownGlobalVirtualEnvs: data.data.refreshPerformance.breakdown.GlobalVirtualEnvs,
breakdownLocators: data.data.refreshPerformance.breakdown.Locators,
breakdownPath: data.data.refreshPerformance.breakdown.Path,
breakdownWorkspaces: data.data.refreshPerformance.breakdown.Workspaces,
locatorConda: data.data.refreshPerformance.locators.Conda,
locatorHomebrew: data.data.refreshPerformance.locators.Homebrew,
locatorLinuxGlobalPython: data.data.refreshPerformance.locators.LinuxGlobalPython,
locatorMacCmdLineTools: data.data.refreshPerformance.locators.MacCmdLineTools,
locatorMacPythonOrg: data.data.refreshPerformance.locators.MacPythonOrg,
locatorMacXCode: data.data.refreshPerformance.locators.MacXCode,
locatorPipEnv: data.data.refreshPerformance.locators.PipEnv,
locatorPoetry: data.data.refreshPerformance.locators.Poetry,
locatorPyEnv: data.data.refreshPerformance.locators.PyEnv,
locatorVenv: data.data.refreshPerformance.locators.Venv,
locatorVirtualEnv: data.data.refreshPerformance.locators.VirtualEnv,
locatorVirtualEnvWrapper: data.data.refreshPerformance.locators.VirtualEnvWrapper,
locatorWindowsRegistry: data.data.refreshPerformance.locators.WindowsRegistry,
locatorWindowsStore: data.data.refreshPerformance.locators.WindowsStore,
});
break;
}
default: {
traceError(`Unhandled Telemetry Event type ${JSON.stringify(data)}`);
}
Expand Down
1 change: 1 addition & 0 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export enum EventName {
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',
NATIVE_FINDER_PERF = 'NATIVE_FINDER_PERF',
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
50 changes: 50 additions & 0 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,56 @@ export interface IEventNamePropertyMapping {
*/
inProjectIsDifferent?: boolean;
};
/**
* Telemetry containing performance metrics for Native Finder.
*/
/* __GDPR__
"native_finder_perf" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"breakdownLocators" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"breakdownPath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"breakdownGlobalVirtualEnvs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"breakdownWorkspaces" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorConda" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorHomebrew" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorLinuxGlobalPython" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorMacCmdLineTools" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorMacPythonOrg" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorMacXCode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorPipEnv" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorPoetry" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorPyEnv" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorVenv" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorVirtualEnv" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorVirtualEnvWrapper" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorWindowsRegistry" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"locatorWindowsStore" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
}
*/
[EventName.NATIVE_FINDER_PERF]: {
/**
* Total duration to find envs using native locator.
*/
duration: number;
breakdownLocators?: number;
breakdownPath?: number;
breakdownGlobalVirtualEnvs?: number;
breakdownWorkspaces?: number;
locatorConda?: number;
locatorHomebrew?: number;
locatorLinuxGlobalPython?: number;
locatorMacCmdLineTools?: number;
locatorMacPythonOrg?: number;
locatorMacXCode?: number;
locatorPipEnv?: number;
locatorPoetry?: number;
locatorPyEnv?: number;
locatorVenv?: number;
locatorVirtualEnv?: number;
locatorVirtualEnvWrapper?: number;
locatorWindowsRegistry?: number;
locatorWindowsStore?: number;
};
/**
* Telemetry event sent when discovery of all python environments using the native locator(virtualenv, conda, pipenv etc.) finishes.
*/
Expand Down