How to track pull request review times

Sara Verdi
Sara Verdi
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Tracking pull request (PR) review times is a key part of optimizing your development workflow. By understanding how long it takes for PRs to be reviewed, teams can identify bottlenecks and improve their review processes. This guide will explore methods for tracking PR review times in GitHub, focusing on metrics, tools, and best practices, including the use of Graphite Insights for in-depth analysis.

Pull request review time metrics help teams assess the efficiency of their code review processes. Key metrics you should track include:

  • Time to first review: The time taken from when a PR is created until the first review begins. This metric helps identify how quickly reviewers start looking at new code.
  • Total review time: The total time a PR spends in review, from creation to merging. This metric provides insight into how long code changes take to get approved.
  • Time to merge: The time taken from PR approval to merging into the main branch. This metric indicates how quickly changes are integrated after approval.

By monitoring these metrics, teams can make data-driven decisions to improve their code review practices.

GitHub offers some built-in features for tracking pull request review times:

  1. Pull request timeline: Each PR has a timeline that logs key events, including when the PR was opened, when reviews started, and when it was merged. This timeline can give you an initial sense of the review process.

  2. Review comments: By analyzing the timestamps of review comments, you can calculate how long it took for reviewers to provide feedback.

To track PR review times in GitHub, follow these steps:

  1. Open a pull request: When you create a PR, note the timestamp.
  2. Monitor reviews: Keep track of when the first review starts. You can do this by checking the PR timeline.
  3. Calculate total review time: Subtract the PR creation time from the time it was merged to get the total review time.

Here’s what you might see from the terminal when checking the PR timeline:

Terminal
$ git log --merges --since="1 week ago"
commit abcdef1234567890 (HEAD -> main)
Author: Your Name <you@example.com>
Date: Wed Oct 10 12:34:56 2024 -0700
Merge pull request #42 from feature/some-feature
$ git show abcdef1234567890

Here, you can see when the PR was merged. Then by analyzing the PR's activity in GitHub, you can manually calculate the review time.

While GitHub provides basic tracking capabilities, many teams opt for more robust solutions. Tools like Graphite Insights offer advanced analytics and reporting capabilities for tracking pull request review times.

Graphite Insights can help teams track PR review times more effectively by providing:

  • Detailed analytics: Gain insights into PR review times and identify patterns in your review processes.
  • Custom metrics: Track metrics that matter most to your team, such as time to first review or review turnaround times.
  • Visualization: Graphite provides visual dashboards that allow teams to see trends in their PR review times over time.
  • Total PRs merged
  • Average number of PRs merged per person
  • Average number of PRs reviewed per person
  • Median publish to merge time
  • Median review response time
  • Median wait time to first review
  • Average number of review cycles until merge
  • (Graph) Number of PRs reviewed per person over a time period
  • (Graph) Number of PRs reviewed by Graphite users vs. non-Graphite users over a time period
  • (Graph) Number of PRs merged per person over a time period
  • (Graph) Number of PRs merged by Graphite users vs. non-Graphite users over a time period
  1. Set clear expectations: Establish guidelines for how quickly reviews should be conducted to promote accountability among team members.
  2. Regularly analyze metrics: Periodically review your PR time tracking metrics to identify trends and areas for improvement.
  3. Use automation: Implement tools like Graphite Insights to automate the collection and analysis of PR review time data, freeing up time for your team to focus on coding.

By consistently tracking PR review times and utilizing tools like Graphite Insights, teams can accelerate their review processes and enhance overall productivity.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2