Skip to content

Commit 008ac08

Browse files
committed
Fix other telemetry call points
1 parent 8b32981 commit 008ac08

6 files changed

Lines changed: 22 additions & 13 deletions

File tree

‎src/common/telemetry/helpers.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ export function sendManagerSelectionTelemetry(pm: PythonProjectManager) {
6969
});
7070

7171
ems.forEach((em) => {
72-
sendTelemetryEvent(EventNames.ENVIRONMENT_MANAGER_SELECTED, undefined, { managerId: em });
72+
sendTelemetryEvent(EventNames.ENVIRONMENT_MANAGER_SELECTED, undefined, {
73+
managerId: getKnownManagerId(em),
74+
});
7375
});
7476

7577
ps.forEach((pkg) => {
76-
sendTelemetryEvent(EventNames.PACKAGE_MANAGER_SELECTED, undefined, { managerId: pkg });
78+
sendTelemetryEvent(EventNames.PACKAGE_MANAGER_SELECTED, undefined, {
79+
managerId: getKnownManagerId(pkg),
80+
});
7781
});
7882
}
7983

‎src/extension.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { EventNames } from './common/telemetry/constants';
2121
import { classifyError } from './common/telemetry/errorClassifier';
2222
import {
2323
logDiscoverySummary,
24+
getKnownManagerId,
2425
sendEnvironmentToolUsageTelemetry,
2526
sendManagerSelectionTelemetry,
2627
sendProjectStructureTelemetry,
@@ -297,7 +298,7 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
297298
managerId = item.manager.id;
298299
}
299300
sendTelemetryEvent(EventNames.CREATE_ENVIRONMENT, undefined, {
300-
manager: managerId,
301+
manager: getKnownManagerId(managerId),
301302
triggeredLocation: 'createSpecifiedCommand',
302303
});
303304
return await withProgress(

‎src/features/common/managerReady.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getExtension } from '../../common/extension.apis';
33
import { WorkbenchStrings } from '../../common/localize';
44
import { traceError, traceInfo, traceWarn } from '../../common/logging';
55
import { EventNames } from '../../common/telemetry/constants';
6+
import { getKnownManagerId } from '../../common/telemetry/helpers';
67
import { sendTelemetryEvent } from '../../common/telemetry/sender';
78
import { createDeferred, Deferred } from '../../common/utils/deferred';
89
import { showErrorMessage } from '../../common/window.apis';
@@ -52,7 +53,7 @@ export function withManagerTimeout(
5253
`To prevent this, check your "python-envs.defaultEnvManager" and "python-envs.pythonProjects" settings.`,
5354
);
5455
sendTelemetryEvent(EventNames.MANAGER_READY_TIMEOUT, undefined, {
55-
managerId,
56+
managerId: getKnownManagerId(managerId),
5657
managerKind: kind,
5758
});
5859
deferred.resolve();

‎src/features/envManagers.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
import { traceError, traceVerbose } from '../common/logging';
2727
import { StopWatch } from '../common/stopWatch';
2828
import { EventNames } from '../common/telemetry/constants';
29+
import { getKnownManagerId } from '../common/telemetry/helpers';
2930
import { sendTelemetryEvent } from '../common/telemetry/sender';
3031
import { getCallingExtension } from '../common/utils/frameUtils';
3132
import { normalizePath } from '../common/utils/pathUtils';
@@ -307,7 +308,7 @@ export class PythonEnvironmentManagers implements EnvironmentManagers {
307308

308309
if (!managerId.toLowerCase().startsWith('undefined_publisher.')) {
309310
sendTelemetryEvent(EventNames.ENVIRONMENT_MANAGER_REGISTERED, registrationStopWatch.elapsedTime, {
310-
managerId,
311+
managerId: getKnownManagerId(managerId),
311312
});
312313
}
313314

@@ -336,7 +337,7 @@ export class PythonEnvironmentManagers implements EnvironmentManagers {
336337

337338
if (!managerId.toLowerCase().startsWith('undefined_publisher.')) {
338339
sendTelemetryEvent(EventNames.PACKAGE_MANAGER_REGISTERED, undefined, {
339-
managerId,
340+
managerId: getKnownManagerId(managerId),
340341
});
341342
}
342343

‎src/features/interpreterSelection.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { SYSTEM_MANAGER_ID, VENV_MANAGER_ID } from '../common/constants';
99
import { traceError, traceInfo, traceVerbose, traceWarn } from '../common/logging';
1010
import { StopWatch } from '../common/stopWatch';
1111
import { EventNames } from '../common/telemetry/constants';
12+
import { getKnownManagerId } from '../common/telemetry/helpers';
1213
import { sendTelemetryEvent } from '../common/telemetry/sender';
1314
import { resolveVariables } from '../common/utils/internalVariables';
1415
import { normalizePath } from '../common/utils/pathUtils';
@@ -318,7 +319,7 @@ export async function applyInitialEnvironmentSelection(
318319
sendTelemetryEvent(EventNames.ENV_SELECTION_RESULT, scopeStopWatch.elapsedTime, {
319320
scope: 'workspace',
320321
prioritySource: result.source,
321-
managerId: result.manager.id,
322+
managerId: getKnownManagerId(result.manager.id),
322323
resolutionPath: result.environment ? 'envPreResolved' : 'managerDiscovery',
323324
hasPersistedSelection: env !== undefined,
324325
});
@@ -357,7 +358,7 @@ export async function applyInitialEnvironmentSelection(
357358
sendTelemetryEvent(EventNames.ENV_SELECTION_RESULT, globalStopWatch.elapsedTime, {
358359
scope: 'global',
359360
prioritySource: result.source,
360-
managerId: result.manager.id,
361+
managerId: getKnownManagerId(result.manager.id),
361362
resolutionPath: result.environment ? 'envPreResolved' : 'managerDiscovery',
362363
hasPersistedSelection: env !== undefined,
363364
});

‎src/managers/common/registeredManagers.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { traceWarn } from '../../common/logging';
1515
import { StopWatch } from '../../common/stopWatch';
1616
import { EventNames } from '../../common/telemetry/constants';
1717
import { classifyError, isTimeoutErrorType } from '../../common/telemetry/errorClassifier';
18+
import { getKnownManagerId } from '../../common/telemetry/helpers';
1819
import { sendTelemetryEvent } from '../../common/telemetry/sender';
1920
import {
2021
EnvironmentToolSupport,
@@ -143,7 +144,7 @@ export class InternalEnvironmentManager implements EnvironmentManager {
143144
const envs = await this.manager.getEnvironments('all').catch(() => []);
144145
const duration = sw.elapsedTime;
145146
sendTelemetryEvent(EventNames.ENVIRONMENT_DISCOVERY, duration, {
146-
managerId: this.id,
147+
managerId: getKnownManagerId(this.id),
147148
result: 'success',
148149
envCount: envs.length,
149150
});
@@ -162,7 +163,7 @@ export class InternalEnvironmentManager implements EnvironmentManager {
162163
EventNames.ENVIRONMENT_DISCOVERY,
163164
duration,
164165
{
165-
managerId: this.id,
166+
managerId: getKnownManagerId(this.id),
166167
result: errorType === 'canceled' || isTimeoutErrorType(errorType) ? 'timeout' : 'error',
167168
errorType,
168169
},
@@ -323,21 +324,21 @@ export class InternalPackageManager implements PackageManager {
323324
try {
324325
await this.manager.manage(environment, options);
325326
sendTelemetryEvent(EventNames.PACKAGE_MANAGEMENT, stopWatch.elapsedTime, {
326-
managerId: this.id,
327+
managerId: getKnownManagerId(this.id),
327328
result: 'success',
328329
triggerSource,
329330
});
330331
} catch (error) {
331332
if (error instanceof CancellationError) {
332333
sendTelemetryEvent(EventNames.PACKAGE_MANAGEMENT, stopWatch.elapsedTime, {
333-
managerId: this.id,
334+
managerId: getKnownManagerId(this.id),
334335
result: 'cancelled',
335336
triggerSource,
336337
});
337338
throw error;
338339
}
339340
sendTelemetryEvent(EventNames.PACKAGE_MANAGEMENT, stopWatch.elapsedTime, {
340-
managerId: this.id,
341+
managerId: getKnownManagerId(this.id),
341342
result: 'error',
342343
errorType: error instanceof Error ? error.name : 'unknown',
343344
triggerSource,

0 commit comments

Comments
 (0)