Skip to content

Commit 9b89180

Browse files
authored
fix bugs in telemetry for envs ext (#25232)
- wasn't sending `EventName == "ms-python.python/execution_code"&&Properties["trigger"]=="icon` when I run a python file using the play button - when opening the editor and have a venv selected in the panel, telemetry event is sending the editor.load event with InterpreterType as System instead of venv
1 parent 81ee4de commit 9b89180

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/client/startupTelemetry.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { sendTelemetryEvent } from './telemetry';
1616
import { EventName } from './telemetry/constants';
1717
import { EditorLoadTelemetry } from './telemetry/types';
1818
import { IStartupDurations } from './types';
19+
import { useEnvExtension } from './envExt/api.internal';
1920

2021
export async function sendStartupTelemetry(
2122
activatedPromise: Promise<any>,
@@ -105,9 +106,19 @@ async function getActivationTelemetryProps(
105106
// finish. API getActiveInterpreter() does not block on windows registry by default as
106107
// it is slow.
107108
await interpreterService.refreshPromise;
108-
const interpreter = await interpreterService
109-
.getActiveInterpreter()
110-
.catch<PythonEnvironment | undefined>(() => undefined);
109+
let interpreter: PythonEnvironment | undefined;
110+
111+
// include main workspace uri if using env extension
112+
if (useEnvExtension()) {
113+
interpreter = await interpreterService
114+
.getActiveInterpreter(mainWorkspaceUri)
115+
.catch<PythonEnvironment | undefined>(() => undefined);
116+
} else {
117+
interpreter = await interpreterService
118+
.getActiveInterpreter()
119+
.catch<PythonEnvironment | undefined>(() => undefined);
120+
}
121+
111122
const pythonVersion = interpreter && interpreter.version ? interpreter.version.raw : undefined;
112123
const interpreterType = interpreter ? interpreter.envType : undefined;
113124
if (interpreterType === EnvironmentType.Unknown) {

src/client/terminals/codeExecution/codeExecutionManager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export class CodeExecutionManager implements ICodeExecutionManager {
4848
} catch (ex) {
4949
traceError('Failed to execute file in terminal', ex);
5050
}
51+
sendTelemetryEvent(EventName.ENVIRONMENT_CHECK_TRIGGER, undefined, {
52+
trigger: 'run-in-terminal',
53+
});
5154
return;
5255
}
5356

0 commit comments

Comments
 (0)