Add telemetry for all PET process events#1486
Conversation
…restart Add four new telemetry events inside nativePythonFinder.ts to provide visibility into PET process behavior: - PET.REFRESH: tracks each refresh attempt with envCount, unresolvedCount, workspaceDirCount, searchPathCount, and attempt number - PET.CONFIGURE: tracks the configure RPC with workspace/env dir counts and retry state (including 'skipped' when config is unchanged) - PET.PROCESS_RESTART: tracks crash recovery with attempt number and result - PET.RESOLVE: tracks single-env resolution for fast-path and standalone calls All events include duration measurements and use classifyError() for consistent error categorization. Addresses the telemetry gap between PET.INIT_DURATION (spawn) and ENVIRONMENT_DISCOVERY (final result).
f1d7927 to
da84bc2
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds new telemetry events to track PET (Python Environment Tools) operational outcomes (refresh/configure/resolve) and process recovery (restart), including basic success/error/timeout classification and a few lightweight counters to help diagnose failures.
Changes:
- Add new PET telemetry event names and GDPR property mappings (refresh/configure/process restart/resolve).
- Emit telemetry from PET resolve/refresh/configure paths with result + duration, and include error classification on failures.
- Emit telemetry for PET process restart attempts including attempt number and failure classification.
Show a summary per file
| File | Description |
|---|---|
src/managers/common/nativePythonFinder.ts |
Emits the new PET telemetry events from resolve/refresh/configure/restart flows. |
src/common/telemetry/constants.ts |
Defines new PET event names and their GDPR-compliant property mappings. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
| import { EventNames } from '../../common/telemetry/constants'; | ||
| import { classifyError } from '../../common/telemetry/errorClassifier'; | ||
| import { sendTelemetryEvent } from '../../common/telemetry/sender'; |
There was a problem hiding this comment.
Importing classifyError here introduces a circular dependency: nativePythonFinder.ts -> telemetry/errorClassifier.ts -> nativePythonFinder.ts (because errorClassifier imports RpcTimeoutError from this file). This can lead to partially-initialized exports at runtime (e.g., RpcTimeoutError checks failing or classifyError being undefined depending on load order). Please break the cycle by moving RpcTimeoutError into a small shared module (imported by both files) or by changing errorClassifier to detect timeouts without importing nativePythonFinder (e.g., via ex instanceof Error && ex.name === 'RpcTimeoutError' plus a shape check).
Add telemetry to help track all the PET events and their success, failure, errors etc