Skip to content
Draft
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
@@ -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