Skip to main content
Version: Next

PR Review Depth

What is this metric?

The average number of comments of PRs in the selected time range.

Why is it important?

PR Review Depth (in Comments per RR) is related to the quality of code review, indicating how thorough your team reviews PRs.

Which dashboard(s) does it exist in?

How is it calculated?

This metric is calculated by counting the total number of PR comments divided by the total number of PRs in the selected time range.

Data Sources Required

This metric relies on PRs/MRs collected from GitHub, GitLab, BitBucket, Gitee or other code review tools.

Data Transformation Required


SQL Queries

If you want to measure the monthly trend of PR review time in the screenshot below, please run the following SQL in Grafana.

DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,
count(distinct as "PR Review Depth"
pull_requests pr
left join pull_request_comments prc on = prc.pull_request_id
and pr.base_repo_id in ($repo_id)
and pr.merged_date is not null

How to improve?

  1. Encourage multiple reviewers to review a PR;
  2. Review Depth is an indicator for generally how thorough your PRs are reviewed, but it does not mean the deeper the better. In some cases, spending an excessive amount of resources on reviewing PRs is also not recommended.