Usage metrics API 新增拉取请求审查阶段指标
英文标题:Usage metrics API adds pull request review stages
GitHub 面向企业和组织的仓库级 Copilot 使用指标报告,现可细分拉取请求在审查各阶段所花费的时间。`repos-1-day` 报告中的新 `pull_request_review_times` 数组提供从“准备审查”到首次审查、首次审查到最终审查,以及最终审查到合并的中位数和 90 分位耗时。该指标帮助团队判断延迟究竟发生在等待首次审查、审查往返沟通,还是已获批准但尚未合并的环节。该数据仅统计由人工发起且至少经过另一名人工审查的拉取请求,并自发布日起逐步积累,不提供历史回填。
125.0 KB
中文
企业和组织的仓库级 Copilot 使用指标报告现在会细分拉取请求在审查各阶段所花费的时间。每个 repos-1-day 行中新增的 pull_request_review_times 数组,会报告从准备审查到首次审查、首次审查到最终审查,以及最终审查到合并这三个阶段的耗时中位数和 90 分位数。
pull_request_review_times 中的每个条目包括:
authored_by和reviewed_by:此条目中拉取请求的创建者和审查者。在本次发布中,两者均为human。total_merged:该仓库当天合并的、符合条件的拉取请求数量。median_minutes_ready_to_first_review和p90_minutes_ready_to_first_review:拉取请求变为可审查状态到首次审查之间的时间。median_minutes_first_to_final_review和p90_minutes_first_to_final_review:首次审查与最终审查之间的时间。median_minutes_final_review_to_merge和p90_minutes_final_review_to_merge:最终审查到合并之间的时间。
时长以分钟为单位,并归属于拉取请求合并当日。现有的 pull_requests 字段保持不变。
团队此前已能了解拉取请求何时需要较长时间才能合并,但无法得知时间具体耗费在哪个环节。将等待时间拆分为三个阶段后,团队可以判断拉取请求是在等待他人查看、等待审查者之间的往返沟通,还是已获批准却尚未合并。每种情况都对应不同的改进措施;中位数旁的 90 分位数还能揭示是否仅有少数缓慢的拉取请求在拉高整体延迟。
- **可用性:**企业和组织的
repos-1-day报告中均已提供。 - **统计范围:**统计由人员创建且至少由另一名人员审查过的拉取请求。仅对人工审查计时。来自 Copilot code review、其他机器人及作者本人的审查将被忽略,因此,一个同时经过人员和 Copilot code review 审查的拉取请求仍会被纳入统计。因此,
pull_request_review_times[].total_merged通常低于pull_requests.total_merged,后者还会统计无需任何审查即合并的拉取请求。 - **不回填历史数据:**数据将从发布日期起持续累积,因此早期日期的数据量会较少。2026 年 9 月 21 日之前变为可审查状态的拉取请求不会纳入本部分,但仍会计入
pull_requests.total_merged。 - **没有符合条件的拉取请求时返回空数组,而不是零:**如果某个仓库当天没有合并符合条件的拉取请求,该数组为
[]。当拉取请求仅收到一次审查时,“首次审查到最终审查”阶段为0。 - **访问权限:**企业所有者和计费管理员、组织所有者,以及任何被授予
View Copilot Metrics权限的自定义组织或企业角色用户,均可访问这些报告。必须启用 Copilot 使用指标策略。
请访问 Copilot 使用指标 API 文档开始使用。
English / 原文
The enterprise and organization repository-level Copilot usage metrics reports now break down how long pull requests spend in each stage of review. A new pull_request_review_times array on each repos-1-day row reports a median and a 90th percentile for the time from ready for review to first review, first review to final review, and final review to merge.
Each entry in pull_request_review_times includes:
authored_byandreviewed_by: Who opened and who reviewed the pull requests in this entry. Both arehumanin this release.total_merged: The number of qualifying pull requests merged in the repository that day.median_minutes_ready_to_first_reviewandp90_minutes_ready_to_first_review: Time from the pull request becoming ready for review to its first review.median_minutes_first_to_final_reviewandp90_minutes_first_to_final_review: Time between the first and final review.median_minutes_final_review_to_mergeandp90_minutes_final_review_to_merge: Time from the final review to merge.
Durations are in minutes and attributed to the day the pull request merged. The existing pull_requests fields are unchanged.
Teams can already see when pull requests take a long time to merge, but not where the time goes. Splitting the wait into three stages shows whether a pull request is waiting for someone to look at it, waiting on back-and-forth between reviewers, or sitting approved and unmerged. Each of those points to a different fix, and the 90th percentile beside the median shows when a handful of slow pull requests is driving the delay.
- Availability: Present in the enterprise and organization
repos-1-dayreports. - What is counted: Pull requests that a person opened and at least one other person reviewed. Only human reviews are timed. Reviews from Copilot code review, other bots, and the author are ignored, so a pull request reviewed by both a person and Copilot code review is still included. As a result,
pull_request_review_times[].total_mergedis usually lower thanpull_requests.total_merged, which also counts pull requests merged without any reviews. - No backfill: Data builds forward from the release date, so early days will be thin. Pull requests that became ready for review before September 21, 2026 are left out of this section but still count toward
pull_requests.total_merged. - A quiet day is an empty array, not a zero: The array is
[]on days a repository merged no qualifying pull requests. The first-to-final review stage is0when pull requests receive a single review. - Access: Enterprise owners and billing managers, organization owners, and anyone with a custom organization or enterprise role that grants the
View Copilot Metricspermission can access these reports. The Copilot usage metrics policy must be enabled.
Visit the Copilot usage metrics API documentation to get started.