Skip to content

Commit 5d14505

Browse files
committed
trim telemetry recorded
1 parent 1423907 commit 5d14505

9 files changed

Lines changed: 46 additions & 202 deletions

File tree

src/client/telemetry/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ export enum EventName {
4242
// Python testing specific telemetry
4343
UNITTEST_CONFIGURING = 'UNITTEST.CONFIGURING',
4444
UNITTEST_CONFIGURE = 'UNITTEST.CONFIGURE',
45-
UNITTEST_DISCOVERY_TRIGGER = 'UNITTEST.DISCOVERY.TRIGGER',
4645
UNITTEST_DISCOVERING = 'UNITTEST.DISCOVERING',
4746
UNITTEST_DISCOVERING_STOP = 'UNITTEST.DISCOVERY.STOP',
4847
UNITTEST_DISCOVERY_DONE = 'UNITTEST.DISCOVERY.DONE',
4948
UNITTEST_RUN_STOP = 'UNITTEST.RUN.STOP',
5049
UNITTEST_RUN = 'UNITTEST.RUN',
5150
UNITTEST_RUN_DONE = 'UNITTEST.RUN.DONE',
5251
UNITTEST_RUN_ALL_FAILED = 'UNITTEST.RUN_ALL_FAILED',
53-
UNITTEST_TREE_UPDATE = 'UNITTEST.TREE.UPDATE',
5452
UNITTEST_DISABLED = 'UNITTEST.DISABLED',
5553

5654
PYTHON_EXPERIMENTS_INIT_PERFORMANCE = 'PYTHON_EXPERIMENTS_INIT_PERFORMANCE',

src/client/telemetry/index.ts

Lines changed: 7 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,39 +2122,6 @@ export interface IEventNamePropertyMapping {
21222122
*/
21232123
interpreterType?: EnvironmentType;
21242124
};
2125-
/**
2126-
* Telemetry event sent indicating the trigger source for discovery.
2127-
*/
2128-
/* __GDPR__
2129-
"unittest.discovery.trigger" : {
2130-
"trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2131-
"filekind" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2132-
"mssincelasttrigger" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
2133-
}
2134-
*/
2135-
[EventName.UNITTEST_DISCOVERY_TRIGGER]: {
2136-
/**
2137-
* Carries the source which triggered discovering of tests
2138-
*
2139-
* @type {('auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter')}
2140-
* auto : Triggered by VS Code editor.
2141-
* ui : Triggered by clicking a button.
2142-
* commandpalette : Triggered by running the command from the command palette.
2143-
* watching : Triggered by filesystem or content changes.
2144-
* interpreter : Triggered by interpreter change.
2145-
*/
2146-
trigger: 'auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter';
2147-
/**
2148-
* For 'auto' / 'watching' triggers, classifies the file whose change triggered discovery.
2149-
* Used to detect whether discovery is firing on non-test files (see #25866).
2150-
*/
2151-
fileKind?: 'test' | 'conftest' | 'non-test' | 'unknown';
2152-
/**
2153-
* Milliseconds since the previous discovery trigger fired (any source).
2154-
* Helps detect chatty re-trigger storms.
2155-
*/
2156-
msSinceLastTrigger?: number;
2157-
};
21582125
/**
21592126
* Telemetry event sent with details about discovering tests
21602127
*/
@@ -2180,10 +2147,9 @@ export interface IEventNamePropertyMapping {
21802147
"failed" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
21812148
"mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
21822149
"trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2183-
"failurecategory" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2184-
"totaldurationms" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2185-
"testcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2186-
"exitcode" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
2150+
"failureCategory" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2151+
"totalDurationMs" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2152+
"testCount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
21872153
}
21882154
*/
21892155
[EventName.UNITTEST_DISCOVERY_DONE]: {
@@ -2205,7 +2171,7 @@ export interface IEventNamePropertyMapping {
22052171
*/
22062172
mode?: 'project' | 'legacy';
22072173
/**
2208-
* Source that triggered the discovery (mirrors UNITTEST_DISCOVERY_TRIGGER.trigger).
2174+
* Source that triggered the discovery.
22092175
*/
22102176
trigger?: 'auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter';
22112177
/**
@@ -2228,10 +2194,6 @@ export interface IEventNamePropertyMapping {
22282194
* Number of test items discovered (leaf nodes).
22292195
*/
22302196
testCount?: number;
2231-
/**
2232-
* Subprocess exit code, when known (failed discoveries).
2233-
*/
2234-
exitCode?: number;
22352197
};
22362198
/**
22372199
* Telemetry event sent when cancelling discovering tests
@@ -2283,13 +2245,9 @@ export interface IEventNamePropertyMapping {
22832245
"debugging" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
22842246
"mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
22852247
"failed" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2286-
"failurecategory" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2287-
"pipeclosedearly" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2288-
"durationms" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2289-
"requestedcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2290-
"reportedcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2291-
"missingcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2292-
"exitcode" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
2248+
"failureCategory" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2249+
"durationMs" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2250+
"requestedCount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
22932251
}
22942252
*/
22952253
[EventName.UNITTEST_RUN_DONE]: {
@@ -2311,11 +2269,6 @@ export interface IEventNamePropertyMapping {
23112269
| 'env-mismatch'
23122270
| 'cancelled'
23132271
| 'unknown';
2314-
/**
2315-
* `true` if the result pipe was disposed before the subprocess fully
2316-
* reported all requested test results (see #25872).
2317-
*/
2318-
pipeClosedEarly?: boolean;
23192272
/**
23202273
* Wall-clock duration of the run in milliseconds.
23212274
*/
@@ -2324,48 +2277,6 @@ export interface IEventNamePropertyMapping {
23242277
* Number of test items the user asked to run.
23252278
*/
23262279
requestedCount?: number;
2327-
/**
2328-
* Number of distinct test results reported back over the pipe.
2329-
*/
2330-
reportedCount?: number;
2331-
/**
2332-
* requestedCount - reportedCount (signals #25892 "all skipped" pattern).
2333-
*/
2334-
missingCount?: number;
2335-
/**
2336-
* Subprocess exit code when known.
2337-
*/
2338-
exitCode?: number;
2339-
};
2340-
/**
2341-
* Telemetry event emitted after the test tree is updated with new discovery results.
2342-
* Used to detect full-rebuild-on-every-save pattern (see #25822, #25866).
2343-
*/
2344-
/* __GDPR__
2345-
"unittest.tree.update" : {
2346-
"tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2347-
"mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2348-
"rebuiltfromscratch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2349-
"beforecount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2350-
"aftercount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
2351-
}
2352-
*/
2353-
[EventName.UNITTEST_TREE_UPDATE]: {
2354-
tool: TestTool;
2355-
mode: 'project' | 'legacy';
2356-
/**
2357-
* `true` if the discovery handler cleared and rebuilt all test items rather
2358-
* than performing an incremental update.
2359-
*/
2360-
rebuiltFromScratch: boolean;
2361-
/**
2362-
* Number of root test items in the controller before this update.
2363-
*/
2364-
beforeCount: number;
2365-
/**
2366-
* Number of root test items in the controller after this update.
2367-
*/
2368-
afterCount: number;
23692280
};
23702281
/**
23712282
* Telemetry event sent when testing is disabled for a workspace.

src/client/testing/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ export class UnitTestManagementService implements IExtensionActivationService {
222222
}),
223223
interpreterService.onDidChangeInterpreter(async () => {
224224
traceVerbose('Testing: Triggered refresh due to interpreter change.');
225-
sendTelemetryEvent(EventName.UNITTEST_DISCOVERY_TRIGGER, undefined, { trigger: 'interpreter' });
226-
await this.testController?.refreshTestData(undefined, { forceRefresh: true });
225+
await this.testController?.refreshTestData(undefined, { forceRefresh: true, trigger: 'interpreter' });
227226
}),
228227
);
229228
}

src/client/testing/testController/common/projectTestExecution.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ export async function executeTestsForProjects(
6666

6767
traceInfo(`[test-by-project] Executing ${items.length} test item(s) for project: ${project.projectName}`);
6868

69-
sendTelemetryEvent(EventName.UNITTEST_RUN, undefined, {
70-
tool: project.testProvider,
71-
debugging: isDebugMode,
72-
});
73-
7469
const stopWatch = new StopWatch();
7570
let failed = false;
7671
let failureCategory:

src/client/testing/testController/common/resultResolver.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import { TestCoverageHandler } from './testCoverageHandler';
1515
import { DiscoveredTestNode, DiscoveredTestItem } from './types';
1616

1717
/**
18-
* Trigger source label for the current discovery cycle (matches
19-
* UNITTEST_DISCOVERY_TRIGGER.trigger values).
18+
* Trigger source label for the current discovery cycle.
2019
*/
2120
export type DiscoveryTriggerKind = 'auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter';
2221

src/client/testing/testController/common/testDiscoveryHandler.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import * as util from 'util';
66
import { DiscoveredTestPayload } from './types';
77
import { TestProvider } from '../../types';
88
import { traceError, traceWarn } from '../../../logging';
9-
import { sendTelemetryEvent } from '../../../telemetry';
10-
import { EventName } from '../../../telemetry/constants';
119
import { Testing } from '../../../common/utils/localize';
1210
import { createErrorTestItem } from './testItemUtilities';
1311
import { buildErrorNodeOptions, populateTestTree } from './utils';
@@ -56,9 +54,6 @@ export class TestDiscoveryHandler {
5654
// if any tests exist, they should be populated in the test tree, regardless of whether there were errors or not.
5755
// parse and insert test data.
5856

59-
// Snapshot root-item count before update for UNITTEST_TREE_UPDATE telemetry.
60-
const beforeCount = testController.items.size;
61-
6257
// Clear existing mappings before rebuilding test tree
6358
testItemIndex.clear();
6459

@@ -78,19 +73,6 @@ export class TestDiscoveryHandler {
7873
projectId,
7974
projectName,
8075
);
81-
82-
// Emit TREE_UPDATE so we can quantify how often the tree is being rebuilt
83-
// from scratch versus changing incrementally (see #25822, #25866).
84-
// populateTestTree currently always rebuilds the subtree under the workspace/project root,
85-
// so rebuiltFromScratch is true today; we keep the field so future incremental updates
86-
// can flip it to false without a schema change.
87-
sendTelemetryEvent(EventName.UNITTEST_TREE_UPDATE, undefined, {
88-
tool: testProvider,
89-
mode: projectId ? 'project' : 'legacy',
90-
rebuiltFromScratch: true,
91-
beforeCount,
92-
afterCount: testController.items.size,
93-
});
9476
}
9577
}
9678

src/client/testing/testController/common/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ export interface TestData {
3434
kind: TestDataKinds;
3535
}
3636

37-
export type TestRefreshOptions = { forceRefresh: boolean };
37+
export type TestRefreshOptions = {
38+
forceRefresh: boolean;
39+
trigger?: 'auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter';
40+
};
3841

3942
export const ITestController = Symbol('ITestController');
4043
export interface ITestController {

0 commit comments

Comments
 (0)