The table presents a sequence of events for a PR from creation to merge. Note that the stats are only computed when the PR is merged, not at each individual step.
Event | Step | Insights impact |
---|---|---|
1 | Author creates a PR in draft state that adds 10 lines of code and deletes 5 lines of code | Lines of code added increases by 10 for Author; lines of code deleted increase by 5 for Author |
2 | Author publishes the PR, making it ready for review | Starts the virtual timer for publish to merge time calculation |
3 | Author requests reviews from three people | Starts the virtual timer for response time calculation |
4 | Reviewer A requests changes on the PR | PRs reviewed increases by 1 for Reviewer A; Reviewer A response time = time at event 4 - time at event 3 ; wait time until first review for Author = time at event 4 - time at event 2 |
5 | Reviewer B leaves a comment on the PR | PRs reviewed increases by 1 for Reviewer B; Reviewer B response time = time at event 5 - time at event 3 |
6 | Author makes updates, and re-requests reviews from Reviewers A and B | Starts a new virtual timer for response time calculation |
7 | Reviewer A leaves a comment on the PR | PRs reviewed does not change; Reviewer A response time = time at event 7 - time at event 6 |
8 | Reviewer B leaves a comment on the PR | PRs reviewed does not change; Reviewer B response time = time at event 8 - time at event 6 ; review cycles for Reviewer B = [(event 8, event 6), (event 5, event 3)] (count = 2) |
9 | Author makes updates, and re-requests a review from Reviewer A | Starts a new virtual timer for response time calculation |
10 | Reviewer A approves the PR | PRs reviewed does not change; Reviewer A response time = time at event 10 - time at event 9 ; time waiting on reviews for Author = (time at event 4 - time at event 3) + (time at event 7 - time at event 6 ; review cycles for Reviewer A = [(event 10, event 9), (event 7, event 6), (event 4, event 3)] (count = 3) |
11 | Author merges the PR | PRs merged increases by 1 for Author; publish to merge time for Author = time at event 11 - time at event 2 ; max review cycles for Author = max(3, 2) ⇒ 3 |
Four calculations feed into the PR author's aggregated median statistic:
- Wait time to first review, how long the author waited until anyone reviewed their PR after it was published/ready for review
- Publish to merge time, how it took for the PR to be merged after it was published/ready for review
- Review cycles until merge, the max number of review request/response pairs for a single a reviewer until the PR was merged
- Time waiting on reviews, the sum of time spent waiting on anyone to review the PR
Note that we didn’t count the time between event 10 and event 9 here because there was a review from Reviewer B on the PR—so the author wasn’t waiting on reviews during this time. If the Author re-requested a review from both Reviewer A and Reviewer B in event 9, we would also add time at event 10 - time at event 9
into the computation above.
Response time to review requests is computed for each reviewer on each review as review time - review request time
. Each computed response time factors into the reviewer's aggregated median statistic.
In the above flow, Reviewer C did not participate, creating no statistical impact.