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
6 changes: 6 additions & 0 deletions src/common/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@ export interface IEventNamePropertyMapping {
"pet.refresh": {
"result": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
"envCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "eleanorjboyd" },
"condaEnvCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true, "owner": "eleanorjboyd" },
"managerCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true, "owner": "eleanorjboyd" },
"unresolvedCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "eleanorjboyd" },
"workspaceDirCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "eleanorjboyd" },
"searchPathCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "eleanorjboyd" },
Expand All @@ -602,6 +604,10 @@ export interface IEventNamePropertyMapping {
[EventNames.PET_REFRESH]: {
result: 'success' | 'timeout' | 'error';
envCount?: number;
/** Number of discovered environments whose kind is Conda. Lets us slice refresh duration by conda footprint. */
condaEnvCount?: number;
/** Number of discovered environment managers (conda/pyenv/poetry/etc.). */
managerCount?: number;
unresolvedCount?: number;
workspaceDirCount?: number;
searchPathCount?: number;
Expand Down
30 changes: 28 additions & 2 deletions src/managers/common/nativePythonFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,32 @@ class NativePythonFinderImpl implements NativePythonFinder {
};
}

/**
* Computes environment-shape counts from a refresh result for telemetry. These let us slice
* refresh duration by how many environments (and how many conda environments) were discovered,
* to test whether the slow-refresh cohort is dominated by conda-heavy / many-env setups.
*/
private getEnvShapeProperties(nativeInfo: NativeInfo[]): {
envCount: number;
condaEnvCount: number;
managerCount: number;
} {
let envCount = 0;
let condaEnvCount = 0;
let managerCount = 0;
for (const info of nativeInfo) {
if (isNativeEnvInfo(info)) {
envCount++;
if (info.kind === NativePythonEnvironmentKind.conda) {
condaEnvCount++;
}
} else {
managerCount++;
}
}
return { envCount, condaEnvCount, managerCount };
}

private async doRefresh(options?: NativePythonEnvironmentKind | Uri[]): Promise<NativeInfo[]> {
let lastError: unknown;

Expand Down Expand Up @@ -933,7 +959,7 @@ class NativePythonFinderImpl implements NativePythonFinder {
},
{
result: 'success',
envCount: nativeInfo.filter((e) => isNativeEnvInfo(e)).length,
...this.getEnvShapeProperties(nativeInfo),
unresolvedCount,
workspaceDirCount,
searchPathCount,
Expand All @@ -949,7 +975,7 @@ class NativePythonFinderImpl implements NativePythonFinder {
sw.elapsedTime,
{
result: errorType === 'spawn_timeout' ? 'timeout' : 'error',
envCount: nativeInfo.filter((e) => isNativeEnvInfo(e)).length,
...this.getEnvShapeProperties(nativeInfo),
unresolvedCount,
attempt,
errorType,
Expand Down
Loading