Total PR Cycle Time (Average)
Last updated: January 7, 2026
Definition
PR Cycle Time measures the total time from when the first commit is created until the PR is merged.
Metric Name |
|
Start Event | FirstCommit — when the first commit is created on the branch |
End Event | Merged — when the PR is merged into the target branch |
Formula |
|
How "Average" is Computed
Span uses a trimmed mean approach, not a simple arithmetic average:
Outlier Capping: Each individual PR cycle time is capped at 30 days (2,592,000 seconds)
If a PR takes 45 days, it's treated as 30 days for the average calculation
Implemented via:
MIN(actual_cycle_time, 30_days)
Aggregation: After capping, the standard
AVG()function is applied
Calculation Logic:
FOR each merged PR:
capped_cycle_time = MIN(actual_cycle_time, 30 days)
Average PR Cycle Time = SUM(all_capped_cycle_times) / COUNT(PRs)
What's Included
The metric only counts PRs that meet these criteria:
✅ Status =
Merged✅ Created by developers (flagged as
is_dev_contributor)✅ Cycle time > 0 (valid timestamps)
❌ Excludes bot-created PRs
❌ Excludes non-contributor activity
Other Aggregation Options
When viewing PR Cycle Time in Span, you can choose different aggregations:
AggregationDescription | |
Average (default) | Trimmed mean capped at 30 days |
P50 | Median — 50% of PRs are faster |
P75 | 75th percentile — 75% of PRs are faster |
P90 | 90th percentile — 90% of PRs are faster |
Max | Longest PR cycle time in the dataset |
Why Trimmed Averaging?
The 30-day cap prevents extremely long-running PRs (like long-lived feature branches or stale PRs) from artificially inflating the average. This keeps the metric representative of your team's typical workflow.
Example:
Team has 10 PRs: nine take 2 hours each, one takes 60 days
Without trimming: Average = ~144 hours (misleading)
With 30-day cap: Average = ~2.6 hours (more representative)
Complete PR Lifecycle Breakdown
PR Cycle Time (FirstCommit → Merged) encompasses all these stages:
Coding (FirstCommit → PR Opened)
Awaiting First Review (PR Opened → FirstReview)
Reworking (FirstReview → LastAction)
Idling (LastAction → Merged)
Total PR Cycle Time = Coding + Awaiting First Review + Reworking + Idling
For more details on the PR Lifecycle stages, see here.