Skip to content

Commit 9e61b67

Browse files
eleanorjboydCopilot
andcommitted
fix: pass numeric measurements via measures arg in env_selection.completed
workspaceFolderCount, resolvedFolderCount, and settingErrorCount were passed as string properties but are numeric measurements. Passing them as string properties causes them to be silently dropped by the telemetry pipeline. Move them to the measures argument so they are recorded. globalScopeDeferred remains a string property (boolean serialized as 'true'/'false') and is unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c5a1430 commit 9e61b67

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/common/telemetry/constants.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export enum EventNames {
106106
* Duration measures the blocking time (excludes deferred global scope).
107107
* Properties:
108108
* - globalScopeDeferred: boolean (true = global scope fired in background, false = awaited)
109+
* Measures (sent in the `measures` arg because of `isMeasurement: true` in GDPR):
110+
* - duration: number (ms)
109111
* - workspaceFolderCount: number (total workspace folders)
110112
* - resolvedFolderCount: number (folders that resolved with a non-undefined env)
111113
* - settingErrorCount: number (user-configured settings that could not be applied)
@@ -451,9 +453,6 @@ export interface IEventNamePropertyMapping {
451453
*/
452454
[EventNames.ENV_SELECTION_COMPLETED]: {
453455
globalScopeDeferred: boolean;
454-
workspaceFolderCount: number;
455-
resolvedFolderCount: number;
456-
settingErrorCount: number;
457456
};
458457

459458
/* __GDPR__

src/features/interpreterSelection.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,20 @@ export async function applyInitialEnvironmentSelection(
396396
}
397397

398398
// Duration measures blocking time only (excludes deferred global scope).
399-
sendTelemetryEvent(EventNames.ENV_SELECTION_COMPLETED, selectionStopWatch.elapsedTime, {
400-
globalScopeDeferred: workspaceFolderResolved,
401-
workspaceFolderCount: folders.length,
402-
resolvedFolderCount,
403-
settingErrorCount: allErrors.length,
404-
});
399+
// Numeric values are sent via the measures argument; pass them as properties
400+
// causes them to be dropped by the telemetry pipeline.
401+
sendTelemetryEvent(
402+
EventNames.ENV_SELECTION_COMPLETED,
403+
{
404+
duration: selectionStopWatch.elapsedTime,
405+
workspaceFolderCount: folders.length,
406+
resolvedFolderCount,
407+
settingErrorCount: allErrors.length,
408+
},
409+
{
410+
globalScopeDeferred: workspaceFolderResolved,
411+
},
412+
);
405413
}
406414

407415
/**

0 commit comments

Comments
 (0)