feat: add triggerReason to pet.process_restart and globalScopeDeferred to setup.hang_detected#1508
Open
eleanorjboyd wants to merge 5 commits into
Open
feat: add triggerReason to pet.process_restart and globalScopeDeferred to setup.hang_detected#1508eleanorjboyd wants to merge 5 commits into
eleanorjboyd wants to merge 5 commits into
Conversation
…d to setup.hang_detected - pet.process_restart now emits triggerReason (process_exit:<code>:<signal>, process_error, rpc_connection_error, rpc_refresh_timeout, rpc_resolve_timeout, rpc_configure_timeout, start_failed, unknown) so we can distinguish crash restarts from timeout restarts in Kusto - setup.hang_detected now emits globalScopeDeferred (true/false/undefined) so we can tell whether a watchdog trip was a real foreground hang or a background global-scope scan running past 120s after the user already had an env selected - Updated GDPR declarations and TypeScript types in constants.ts for both events - Thread globalScopeDeferredRef through applyInitialEnvironmentSelection so the hang watchdog can read the deferred flag before envSelection returns Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… pet.refresh telemetry PET already sends a 'telemetry' JSON-RPC notification with RefreshPerformance data after each refresh call. We were discarding it. Now we listen for it and include the per-phase and per-locator timings in our pet.refresh event. New fields on pet.refresh: - breakdownLocators / breakdownPath / breakdownGlobalVirtualEnvs / breakdownWorkspaces (isMeasurement, ms) — the 4 parallel discovery phases from PET's breakdown map - locatorsJson (string) — JSON-serialized per-locator durations (Conda, WindowsRegistry, WindowsStore, etc.); query in Kusto with parse_json(Properties.locatorsJson) This lets us slice slow-cohort p90s by locator/phase to answer which Windows discovery path is responsible for the 11% slowdown (WindowsRegistry, WindowsStore, Conda, etc.) without any changes on PET's side. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances telemetry around PET restarts and activation hang detection to better attribute why PET restarted and whether setup hangs are related to deferred global-scope environment resolution.
Changes:
- Add
triggerReasontopet.process_restarttelemetry to distinguish restarts caused by exit vs RPC timeouts/errors. - Track whether global-scope resolution was deferred during initial environment selection and include it in
setup.hang_detectedtelemetry. - Extend telemetry schema (
constants.ts) to include the new properties in GDPR mappings and typings.
Show a summary per file
| File | Description |
|---|---|
src/managers/common/nativePythonFinder.ts |
Tracks PET exit/restart reasons and includes triggerReason in restart telemetry. |
src/features/interpreterSelection.ts |
Adds a mutable ref to record whether global-scope resolution was deferred vs awaited. |
src/extension.ts |
Plumbs globalScopeDeferred into hang watchdog telemetry via a shared ref. |
src/common/telemetry/constants.ts |
Updates telemetry schema/GDPR mapping for globalScopeDeferred and triggerReason. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/managers/common/nativePythonFinder.ts:545
- The
errorhandler setsprocessExitReason = 'process_error'unconditionally; if a more-specific reason was already recorded (e.g., an RPC timeout/connection error followed by a kill), this will overwrite it and reduce the fidelity oftriggerReasontelemetry. Consider only setting this whenprocessExitReasonis still undefined.
// Handle process errors (e.g., ENOENT if executable not found)
this.proc.on('error', (err) => {
this.processExited = true;
this.processExitReason = 'process_error';
this.outputChannel.error('[pet] Process error:', err);
- Files reviewed: 4/4 changed files
- Comments generated: 5
bhavyaus
approved these changes
May 11, 2026
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.
:, process_error, rpc_connection_error, rpc_refresh_timeout, rpc_resolve_timeout, rpc_configure_timeout, start_failed, unknown) so we can distinguish crash restarts from timeout restarts.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com