Skip to content

Add telemetry for all PET process events#1486

Merged
eleanorjboyd merged 1 commit intomicrosoft:mainfrom
eleanorjboyd:prepared-harrier
Apr 27, 2026
Merged

Add telemetry for all PET process events#1486
eleanorjboyd merged 1 commit intomicrosoft:mainfrom
eleanorjboyd:prepared-harrier

Conversation

@eleanorjboyd
Copy link
Copy Markdown
Member

Add telemetry to help track all the PET events and their success, failure, errors etc

@eleanorjboyd eleanorjboyd self-assigned this Apr 27, 2026
@eleanorjboyd eleanorjboyd added the debt Code quality issues label Apr 27, 2026
…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).
@eleanorjboyd eleanorjboyd merged commit f415f07 into microsoft:main Apr 27, 2026
48 of 49 checks passed
@eleanorjboyd eleanorjboyd deleted the prepared-harrier branch April 27, 2026 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 13 to 15
import { EventNames } from '../../common/telemetry/constants';
import { classifyError } from '../../common/telemetry/errorClassifier';
import { sendTelemetryEvent } from '../../common/telemetry/sender';
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Code quality issues skip tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants