Skip to content

Commit

Permalink
Exclude other workspace envs when comparing envs
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Jun 27, 2024
1 parent e9fbc7e commit 3f9bc82
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { Event, EventEmitter } from 'vscode';
import { Event, EventEmitter, workspace } from 'vscode';
import '../../../../common/extensions';
import { createDeferred, Deferred } from '../../../../common/utils/async';
import { StopWatch } from '../../../../common/utils/stopWatch';
Expand Down Expand Up @@ -277,7 +277,14 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
}
this.telemetrySentOnce = true;
const { elapsedTime } = stopWatch;
const envs = this.cache.getAllEnvs();
const workspaceFolders = workspace.workspaceFolders || [];
const query: PythonLocatorQuery = {
searchLocations: {
roots: workspaceFolders.map((w) => w.uri),
},
};
//
const envs = this.getEnvs(workspaceFolders.length ? query : undefined);

const nativeEnvs = [];
const executablesFoundByNativeLocator = new Set<string>();
Expand Down Expand Up @@ -485,6 +492,7 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
// Intent is to capture time taken for discovery of all envs to complete the first time.
sendTelemetryEvent(EventName.PYTHON_INTERPRETER_DISCOVERY, elapsedTime, {
nativeDuration,
workspaceFolderCount: (workspace.workspaceFolders || []).length,
interpreters: this.cache.getAllEnvs().length,
environmentsWithoutPython,
activeStateEnvs,
Expand Down
7 changes: 6 additions & 1 deletion src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ export interface IEventNamePropertyMapping {
*/
/* __GDPR__
"python_interpreter_discovery" : {
"workspaceFolderCount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"nativeDuration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "donjayamanne" },
"interpreters" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true , "owner": "donjayamanne"},
Expand Down Expand Up @@ -1195,7 +1196,11 @@ export interface IEventNamePropertyMapping {
*/
[EventName.PYTHON_INTERPRETER_DISCOVERY]: {
/**
* Time taken to discover using native lcoator.
* Number of workspaces.
*/
workspaceFolderCount?: number;
/**
* Time taken to discover using native locator.
*/
nativeDuration?: number;
/**
Expand Down

0 comments on commit 3f9bc82

Please sign in to comment.