chore: add diagnostic logging to JSONRPC handlers (Fixes #360)#361
Merged
karthiknadig merged 2 commits intomainfrom Feb 25, 2026
Merged
chore: add diagnostic logging to JSONRPC handlers (Fixes #360)#361karthiknadig merged 2 commits intomainfrom
karthiknadig merged 2 commits intomainfrom
Conversation
Test Coverage Report (Linux)
Coverage decreased. Please add tests for new code. |
Performance Report (Linux) ✅
Legend
|
Performance Report (Windows) ✅
Legend
|
Test Coverage Report (Windows)
Coverage decreased. Please add tests for new code. |
There was a problem hiding this comment.
Pull request overview
Adds diagnostic logging around JSONRPC request handlers (notably configure) to improve observability when requests are slow (e.g., expensive glob expansion), and reduces lock contention by moving glob expansion outside the configuration write lock.
Changes:
- Add entry/exit timing logs for
handle_configure, plus tracing around glob expansion and a warning when expansion is slow. - Add timing/result-count trace logging to
handle_find. - Add trace logging around conda telemetry collection.
Comments suppressed due to low confidence (1)
crates/pet/src/jsonrpc.rs:458
- Same timing note as
handle_configure:SystemTime::elapsed()isn’t monotonic and can produce an error if the clock moves backwards. UsingInstantavoids that and makes the logged durations reliable.
let now = SystemTime::now();
trace!("Finding environments in {:?}", find_options.search_path);
let global_env_search_paths: Vec<PathBuf> =
get_search_paths_from_env_variables(context.os_environment.as_ref());
let collect_reporter = Arc::new(collect::create_reporter());
let reporter = CacheReporter::new(collect_reporter.clone());
if find_options.search_path.is_file() {
identify_python_executables_using_locators(
vec![find_options.search_path.clone()],
&context.locators,
&reporter,
&global_env_search_paths,
);
} else {
find_python_environments_in_workspace_folder_recursive(
&find_options.search_path,
&reporter,
&context.locators,
&global_env_search_paths,
context
.configuration
.read()
.unwrap()
.clone()
.environment_directories
.as_deref()
.unwrap_or(&[]),
);
}
let envs = collect_reporter
.environments
.lock()
.expect("environments mutex poisoned")
.clone();
trace!(
"Find completed in {:?}, found {} environments in {:?}",
now.elapsed().unwrap_or_default(),
envs.len(),
find_options.search_path
);
dmitrivMS
approved these changes
Feb 25, 2026
Performance Report (macOS)
Legend
|
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.
Add diagnostic logging to JSONRPC handlers that were missing visibility, particularly
handle_configurewhich can hang during glob expansion.info!on entry/exit with elapsed time,trace!for each glob pattern being expanded,warn!if glob expansion exceeds 5 seconds (client timeout is 30s). Also moved glob expansion outside the write lock to avoid blocking configuration readers during slow filesystem traversal.trace!on entry/exit with elapsed time and result counttrace!on entry/exitThis addresses the diagnostic gap where PET produces zero output during a configure request that times out (e.g., when
environmentDirectoriescontains recursive patterns like**/.venvon large directory trees).Fixes #360
Related: #357