惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
量子位
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
A
About on SuperTechFans
腾讯CDC
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
Last Week in AI
Last Week in AI
H
Help Net Security
WordPress大学
WordPress大学
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
博客园 - 【当耐特】
S
SegmentFault 最新的问题
美团技术团队
M
MIT News - Artificial intelligence
L
LangChain Blog
博客园 - 聂微东

Graphite blog

Introducing Code Tours: a new way to review Introducing Cursor Cloud Agents in Graphite Building the future of software development with Cursor Reimagining the PR Page: Designing for speed and focus Graphite changelog [11-20-2025] Graphite changelog [11-04-2025] Graphite changelog [10-16-2025] The future of engineering is collaborative (and already here) Meet Graphite Agent: the next evolution of AI code review Introducing frozen branches: A safer way to build on your teammates’ work Graphite changelog [09-17-2025] How we sped up code search for Graphite Chat Introducing Graphite Chat AI is writing code—here's why it also needs to review that code How I got Claude to write code I could actually ship How we built the first stack-aware merge queue (and why it matters) How we organize our monorepo to ship fast Graphite brings stacking to Tower Code review tooling: Should you build or buy? Making AI code review available to everyone Introducing: The new Graphite + Linear integration Graphite raises $52M and launches Diamond to reimagine code review for the age of AI Why AI will never replace human code review How stacked PRs unblock distributed development teams Graphite is going to Developer Week 2025 Beating the end of year code freeze How Graphite’s eng team ships code remarkably fast Why we chose Anthropic's Claude to power Graphite Reviewer AI code generation will remain fragmented How we redesigned Graphite's landing page in-house
Tracking and understanding GitHub PR stats: A step-by-ste...
Ninad Pathak · 2024-01-22 · via Graphite blog

Developers strive for efficiency. We want to ship high-quality code quickly, collaborate seamlessly with teammates, and create impactful features.

With a flood of notifications and constant context switching however, it can be challenging to zoom out and objectively assess the health and velocity of your projects. Without visibility, it's tough to optimize.

This is where tracking PR stats comes in handy.

Having the right PR metrics at your fingertips helps you spot pain points in your process and answer questions like:

  • Do certain pull requests take longer to merge than others?

  • Do changes get bounced back and forth endlessly before landing?

Once you identify the bottlenecks, you can correct and optimize workflows based on quantitative data. The result? Higher quality code, shipped faster.

While GitHub’s pull request workflow can be slower and make tracking insights difficult, don’t lose hope. There are many other ways to get detailed PR insights at your fingertips.

Let’s dive into what pull request metrics to track, how to get those PR insights, and how you can make the most of them for your workflow.

What pull request metrics should you track and why?

Before you begin measuring data, you need to know what metrics will make the most impact. After studying a variety of leader opinions across various platforms, we’ve identified a few PR metrics that people like to start with.

  • Time to first review: How long until someone looks at your new PR?

  • Publish to merge time: How long is your typical PR lifecycle from opening to merging?

  • Review cycles until merge: How many cycles of back-and-forth before landing code?

  • Throughput: Volume of PRs merged over time.

These help you pinpoint progress, participation, and bottlenecks over time.

Why track pull request stats?

Tracking pull request statistics on GitHub provides benefits beyond surface-level task tracking:

  • It offers deep insight into your team's work patterns.

  • It aids in identifying roadblocks early.

  • It assists with workload estimation by providing historical data.

Additionally, it fosters proactive discussions around code quality and team collaborations—two immensely valuable topics in any software development unit.

How to get pull request stats on GitHub?

GitHub provides developers access to repository data through its REST API and GraphQL API. 

At first glance, these interfaces offer everything needed to pull raw PR data and calculate custom metrics. 

However, while the foundations are there, building a metrics pipeline on top of GitHub's API is an uphill battle. You need to invest development resources in building usable insights.

The main challenges include:

  • Scattered data: Relevant PR data lives across various endpoints like pull requests, issues comments, review comments, etc. This means making multiple calls and stitching together data.

  • No out-of-the-box metrics: While GitHub returns activity log data, it does not synthesize or calculate metrics like review cycles. The developer needs to craft business logic for the required metrics here.

  • Pagination complexity: API responses return paginated data sets. To retrieve comprehensive metrics, developers must follow the subsequent page links and aggregate all records.

  • Visualization effort: Raw JSON data isn't useful alone. Developers looking to spot trends must plot time series charts and create shareable reports.

  • Maintenance overhead: Any custom GitHub metrics script breaks easily with API changes and needs upkeep. As new use cases arise, holes in the dataset get uncovered.

Let’s look at the steps in building customized PR metrics using GitHub’s API. Do note that these are not full code snippets and are only meant as a direction to help set up your custom PR metrics. 

Step 1: Authentication

Begin by generating a personal access token to authenticate against the API:

curl -u "username" -d '{"note":"metrics_token","scopes":["repo"]}' \

https://api.github.com/authorizations

Save the returned token value to use in subsequent requests.

Step 2: Locate relevant endpoints

The GitHub API has over 500 endpoints spanning REST, GraphQL, and other access methods. For metrics, potential options include:

Step 3: Query required data

Use curl commands to call endpoints and extract metrics-related data. For example, to get PR metadata:

curl -H "Authorization: token <token>" https://api.github.com/repos/:owner/:repo/pulls

Step 4: Convert data into usable form

Transform the JSON output into formats suitable for calculations and visualization. We can easily do that with the Python json library.

import json

with open('pull_requests.json') as f:

data = json.load(f)

pr_created_times = [pr['created_at'] for pr in data]

Step 5: Calculate metrics

Once the data is stored in a usable data type, the onus falls on the developer to add custom calculations, data ranges, and reporting capabilities.

from datetime import datetime

date1 = datetime.strptime(pr1_created, "%Y-%m-%dT%H:%M:%SZ")

date2 = datetime.strptime(pr2_created, "%Y-%m-%dT%H:%M:%SZ")

delta = date1 - date2

print(f"{delta.days} days")

Step 6: Graph and visualize

Use graphing libraries to chart trends over time based on the data you pull from GitHub API.

import matplotlib.pyplot as plt

weeks = []

pr_counts = []

plt.title("Weekly PRs")

plt.plot(weeks, pr_counts)

plt.savefig('pr_trends.png')

Alternative, less technical approaches

The above workflow requires significant effort. Some alternative options include:

While GitHub's API enables pulling raw activity data, all post-processing sits squarely on the developer. This requires significant initial investment, and ongoing maintenance is needed to fix broken endpoints, cover new use cases, and update visuals. 

There has to be an easier way to unlock PR insights.

How to get pull request stats using Graphite?

Graphite Insights has out-of-the-box analytics available from the start.

Once the Graphite integration is set up on your repositories, metrics are automatically compiled in the background without extra work.

Some of the key metrics provided include:

  • PRs merged: Total pull requests merged over some time.

  • Publish to merge time: Median time from review request to response.

  • Wait time to first review: Median time PR is open until merged.

  • Review cycles until merge: Volume of pull requests merged per period.

These metrics are pre-aggregated at organization and individual levels, powered by Graphite's activity timeline. It tracks every event across PRs, including reviews, comments, state changes, etc.

To access the metrics, log into your Graphite account and navigate to the Insights tab. You can then:

Switch between preset time ranges like last week, month, or pick custom dates.

You can also filter by repositories and contributors.

Then “save” and share custom metric views.

You can then explore charts and numbers and so much more.

Under the hood, Graphite handles all the complexity of tracking activity, computing metrics, visualizing trends, and refreshing the reports automatically as new data comes in.

The benefits are instantly available and shareable metrics that provide enhanced visibility into developer productivity, collaboration efficiency, and project health—with no coding required.

Get your pull request statistics and analytics seamlessly

Getting actionable insights from pull request data shouldn't be a heavy lift. While GitHub provides activity logs and comprehensive API access, transforming the data into meaningful metrics requires stitching data sources, writing scripts to process and visualize trends, and maintaining your custom solution.

Graphite does things differently.

Graphite's seamless GitHub integration and purpose-built analytics engine help your team skip straight to the metrics that matter—no duct taping. 

You get out-of-the-box visibility into developer productivity, project cadence, and collaboration friction that helps spot bottlenecks early. The shared, interactive reports empower data-informed decisions to keep teams running fast.

So why settle for makeshift metrics or flying blind? 

Graphite offers next-generation pull request analytics data that just works. This simplicity means more time building and less time reporting. 

So, when understanding what drives shipping velocity, Graphite delivers the insights that engineering teams need to make strategic decisions. 

The only question is, would you want to benefit from the increased developer productivity?