Metrics

Pull Request Metrics

Essential analytics for understanding and optimizing your team's code review workflow.

Definition

Pull Request Metrics are quantitative measurements that track the efficiency and quality of your code review process. They include PR size, review timing, merge rates, and rework patterns—providing visibility into bottlenecks that slow down software delivery.

Key Pull Request Metrics

PR Size

Lines of code changed (additions + deletions)

Smaller PRs get faster, higher-quality reviews

Good
< 200 lines
Warning
200-400 lines
Bad
> 400 lines

Time to First Review

Time from PR opened to first review comment

Fast initial feedback keeps developers unblocked

Good
< 4 hours
Warning
4-24 hours
Bad
> 24 hours

Review Cycle Time

Time from PR opened to approved

Long review cycles slow deployment frequency

Good
< 24 hours
Warning
1-3 days
Bad
> 3 days

Merge Rate

Percentage of PRs that get merged vs closed

Low merge rates indicate wasted effort or unclear requirements

Good
> 90%
Warning
75-90%
Bad
< 75%

Rework Rate

PRs requiring changes after initial review

High rework indicates quality issues or misalignment

Good
< 20%
Warning
20-40%
Bad
> 40%

Review Depth

Comments per PR and reviewers per PR

Balanced review depth catches issues without slowing delivery

Good
2-5 comments, 2 reviewers
Warning
Too few or too many
Bad
0 comments (rubber stamping)

Why PR Size Matters Most

< 200 LOC
Optimal Size
15% defect rate
200-400 LOC
Acceptable
25% defect rate
> 400 LOC
Too Large
40%+ defect rate

Research from SmartBear and Microsoft shows a strong correlation between PR size and defect rates. Smaller PRs receive more thorough reviews and catch more issues before they reach production.

Why PR Metrics Matter

Pull requests are the heartbeat of modern software development. Every feature, bug fix, and improvement flows through PRs:

  • Velocity indicator: PR throughput directly correlates with delivery speed
  • Quality gate: Review metrics predict code quality and defect rates
  • Collaboration health: Review patterns reveal team dynamics and knowledge sharing
  • Bottleneck detector: Long review times expose process and capacity issues

Common PR Workflow Problems

Review Bottlenecks

  • • Single-reviewer dependencies
  • • PRs waiting days for review
  • • Timezone mismatches
  • • Unclear reviewer assignment

Size Problems

  • • Monster PRs (1000+ lines)
  • • Multiple features per PR
  • • Refactoring mixed with features
  • • "Just one more thing" commits

Best Practices for PR Metrics

  • Set PR size limits: Configure linters to warn on large PRs (> 400 lines)
  • Establish review SLAs: First review within 4 hours, approval within 24 hours
  • Use PR templates: Standardize descriptions, test plans, and screenshots
  • Automate where possible: CI/CD checks, auto-assign reviewers, auto-merge
  • Track trends: Monitor metrics weekly, not per-PR
  • Celebrate improvements: Recognize teams that improve their metrics

Frequently Asked Questions

What are the most important pull request metrics?

The most important PR metrics are: PR Size (lines changed), Time to First Review, Review Cycle Time, Merge Rate, and Rework Rate. Together, these metrics reveal bottlenecks in your code review process.

What is a good PR size?

Research shows PRs under 200 lines of code have the highest review quality and fastest merge times. PRs over 400 lines have significantly higher defect rates and review times. Aim for small, focused PRs.

How long should code review take?

Best-in-class teams achieve first review within 4 hours and complete review cycles within 24 hours. If PRs regularly wait more than a day for review, it indicates a bottleneck that should be addressed.

What is PR throughput?

PR throughput measures how many pull requests a team merges per time period (usually per week). It indicates development velocity but should be balanced against PR quality metrics.

How do you reduce PR review time?

Key strategies include: smaller PRs, clear PR descriptions, automated testing, designated reviewers, review SLAs, async-first review culture, and using PR templates to standardize information.

Track Your PR Metrics Automatically

DevSpy analyzes pull requests across GitHub, GitLab, and Bitbucket to surface PR size, review time, and merge patterns.

Start Free Trial