Add testing performance telemetry#25980
Merged
eleanorjboyd merged 8 commits intoMay 29, 2026
Merged
Conversation
- Introduced new telemetry events: UNITTEST_RUN_DONE and UNITTEST_TREE_UPDATE. - Enhanced existing telemetry events to capture additional properties such as mode, trigger, and duration. - Updated the telemetry context for test discovery to include more detailed metrics. - Refactored telemetry emission to ensure accurate reporting during test execution and discovery processes.
There was a problem hiding this comment.
Pull request overview
This PR extends Python testing telemetry to better measure discovery/run performance and attribute outcomes to execution mode (legacy vs project-based) and trigger source, supporting the “Testing reliability & perf 2026” workstream in #25978.
Changes:
- Move success-path
UNITTEST_DISCOVERY_DONEemission toPythonResultResolver.resolveDiscovery()and add per-cycle context (mode,trigger,totalDurationMs,testCount). - Add new completion event
UNITTEST_RUN_DONEwith duration + outcome fields, emitted for both legacy and project-based runs. - Thread a discovery
triggerthrough controller → adapter to attribute discovery telemetry, and update unit tests + telemetry typings/GDPR annotations accordingly.
Show a summary per file
| File | Description |
|---|---|
| src/test/testing/testController/workspaceTestAdapter.unit.test.ts | Updates discovery telemetry expectations (success path now emitted by resolver). |
| src/test/testing/testController/common/projectTestExecution.unit.test.ts | Asserts new UNITTEST_RUN_DONE completion telemetry behavior. |
| src/client/testing/testController/workspaceTestAdapter.ts | Adds per-discovery cycle context + failure telemetry details; removes success-path DISCOVERY_DONE emission from adapter. |
| src/client/testing/testController/controller.ts | Tracks/forwards discovery trigger; emits UNITTEST_RUN_DONE for legacy runs; updates project-discovery failure telemetry. |
| src/client/testing/testController/common/types.ts | Extends TestRefreshOptions to include optional trigger. |
| src/client/testing/testController/common/resultResolver.ts | Adds discovery-cycle context and emits enriched UNITTEST_DISCOVERY_DONE on resolve. |
| src/client/testing/testController/common/projectTestExecution.ts | Emits UNITTEST_RUN_DONE per project execution with duration/outcome fields. |
| src/client/testing/main.ts | Routes interpreter-change refresh through refreshTestData(..., trigger: 'interpreter'). |
| src/client/telemetry/index.ts | Updates telemetry property mappings for enriched discovery-done + new run-done event. |
| src/client/telemetry/constants.ts | Removes UNITTEST_DISCOVERY_TRIGGER; adds UNITTEST_RUN_DONE. |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 2
roblourens
previously approved these changes
May 29, 2026
Yoyokrazy
approved these changes
May 29, 2026
eleanorjboyd
added a commit
that referenced
this pull request
Jul 24, 2026
## Problem The discovery/run testing telemetry added in #25980 emitted its numeric performance fields — `totalDurationMs`, `testCount` (`UNITTEST.DISCOVERY.DONE`) and `durationMs`, `requestedCount` (`UNITTEST.RUN.DONE`) — in the **properties** bag instead of the **measures** argument of `sendTelemetryEvent`. These fields are annotated `isMeasurement: true`, and telemetry ingestion drops measurement-annotated fields that arrive as properties. Verified against production telemetry: across ~46M `unittest.discovery.done` events in the last 14 days, **zero** carried `totalDurationMs` or `testCount` (in either `Properties` or `Measures`), while the string categoricals (`mode`, `trigger`, `failureCategory`) came through fine. The `mode`/`trigger` fields survive because they're strings; the numeric ones silently vanish. This means there is currently **no duration signal** to evaluate the recent pytest discovery performance work (#25974, #25982) — the measurements were never actually recorded. The correct pattern is confirmed by `NATIVE_FINDER_PERF`, which passes its numbers via the measures (2nd) argument and lands them cleanly in the `Measures` column. ## Fix Move the numeric measurement fields to the `measures` (2nd) argument of `sendTelemetryEvent` at all five emit sites: - `resultResolver.ts` — `DISCOVERY.DONE` success path (`totalDurationMs`, `testCount`) - `controller.ts` — `DISCOVERY.DONE` project-error path (`totalDurationMs`) and `RUN.DONE` legacy path (`durationMs`, `requestedCount`) - `workspaceTestAdapter.ts` — `DISCOVERY.DONE` legacy-error path (`totalDurationMs`) - `projectTestExecution.ts` — `RUN.DONE` project path (`durationMs`, `requestedCount`) Also removed these fields from the event **property** type definitions (the `__GDPR__` annotations are unchanged and already correctly mark them `isMeasurement: true`) and added notes so they aren't reintroduced as properties. ## Verification - `tsc`: no new type errors from these changes. - `eslint` + `prettier`: clean on all changed files. - Unit tests pass: `resolveDiscovery` (5), project `RUN.DONE` telemetry (2), and workspace discovery (5). ## Impact Once a build with this fix ships, `totalDurationMs`/`testCount`/`durationMs`/`requestedCount` will populate in the `Measures` column, enabling the before/after discovery-performance comparison (sliced by `testCount` bucket × `mode`). No user-facing behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
helps to measure: #25978