Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better tracking when candidates for PR assignment are filtered out #1895

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/handlers/assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,9 @@ pub(super) async fn handle_command(
let work_queue = has_user_capacity(&db_client, &name).await;
if work_queue.is_err() {
// NOTE: disabled for now, just log
log::info!(
"DB reported that user {} has no review capacity. Ignoring.",
log::warn!(
"[#{}] PR self-assign failed, DB reported that user {} has no review capacity. Ignoring.",
issue.number,
name
);
// issue
Expand Down Expand Up @@ -790,7 +791,11 @@ async fn find_reviewer_from_names(
// These are all ideas for improving the selection here. However, I'm not
// sure they are really worth the effort.

log::info!("Initial unfiltered list of candidates: {:?}", candidates);
log::info!(
"[#{}] Initial unfiltered list of candidates: {:?}",
issue.number,
candidates
);

// Special case user "ghost", we always skip filtering
if candidates.contains("ghost") {
Expand All @@ -804,14 +809,18 @@ async fn find_reviewer_from_names(

if filtered_candidates.is_empty() {
// NOTE: disabled for now, just log
log::info!("Filtered list of PR assignee is empty");
log::info!("[#{}] Filtered list of PR assignee is empty", issue.number);
// return Err(FindReviewerError::AllReviewersFiltered {
// initial: names.to_vec(),
// filtered: names.to_vec(),
// });
}

log::info!("Filtered list of candidates: {:?}", filtered_candidates);
log::info!(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should really migrate to tracing and use spans to get have proper log context :)

"[#{}] Filtered list of candidates: {:?}",
issue.number,
filtered_candidates
);

// Return unfiltered list of candidates
Ok(candidates
Expand Down Expand Up @@ -939,6 +948,12 @@ fn candidate_reviewers_from_names<'a>(
if filtered.is_empty() {
Err(FindReviewerError::NoReviewer { initial })
} else {
log::warn!(
"[#{}] Initial list of candidates {:?}, filtered-out with reasons: {:?}",
issue.number,
initial,
filtered_debug
);
Err(FindReviewerError::AllReviewersFiltered { initial, filtered })
}
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/handlers/pr_tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ pub(super) async fn handle_input<'a>(
// if user has no capacity, revert the PR assignment (GitHub has already assigned it)
// and post a comment suggesting what to do
if let Err(_) = work_queue {
log::info!(
"DB reported that user {} has no review capacity. Ignoring.",
log::warn!(
"[#{}] DB reported that user {} has no review capacity. Ignoring.",
event.issue.number,
&assignee.login
);

Expand Down