@@ -22,7 +22,7 @@ import {
22
22
import { sleep } from '../common/utils/async' ;
23
23
import { IServiceContainer } from '../ioc/types' ;
24
24
import { EnvironmentType , PythonEnvironment } from '../pythonEnvironments/info' ;
25
- import { captureTelemetry } from '../telemetry' ;
25
+ import { sendTelemetryEvent } from '../telemetry' ;
26
26
import { EventName } from '../telemetry/constants' ;
27
27
import {
28
28
GetInterpreterOptions ,
@@ -36,6 +36,7 @@ import {
36
36
import { IVirtualEnvironmentManager } from './virtualEnvs/types' ;
37
37
import { getInterpreterHash } from '../pythonEnvironments/discovery/locators/services/hashProvider' ;
38
38
import { inDiscoveryExperiment } from '../common/experiments/helpers' ;
39
+ import { StopWatch } from '../common/utils/stopWatch' ;
39
40
40
41
const EXPIRY_DURATION = 24 * 60 * 60 * 1000 ;
41
42
@@ -137,9 +138,9 @@ export class InterpreterService implements Disposable, IInterpreterService {
137
138
this . experimentsManager . sendTelemetryIfInExperiment ( DeprecatePythonPath . control ) ;
138
139
}
139
140
140
- @captureTelemetry ( EventName . PYTHON_INTERPRETER_DISCOVERY , { locator : 'all' } , true )
141
141
public async getInterpreters ( resource ?: Uri , options ?: GetInterpreterOptions ) : Promise < PythonEnvironment [ ] > {
142
142
let environments : PythonEnvironment [ ] = [ ] ;
143
+ const stopWatch = new StopWatch ( ) ;
143
144
if ( await inDiscoveryExperiment ( this . experimentService ) ) {
144
145
environments = await this . pyenvs . getInterpreters ( resource , options ) ;
145
146
} else {
@@ -150,6 +151,11 @@ export class InterpreterService implements Disposable, IInterpreterService {
150
151
environments = await locator . getInterpreters ( resource , options ) ;
151
152
}
152
153
154
+ sendTelemetryEvent ( EventName . PYTHON_INTERPRETER_DISCOVERY , stopWatch . elapsedTime , {
155
+ locator : 'all' ,
156
+ interpreters : environments ?. length ?? 0 ,
157
+ } ) ;
158
+
153
159
await Promise . all (
154
160
environments
155
161
. filter ( ( item ) => ! item . displayName )
0 commit comments