Throughput metrics (LTFC + Deployment Frequency)¶
Repeatable delivery metrics sourced from local git. Built to iterate on the throughput calcs and the per-active-contributor benchmark.
Why these sources are trustworthy¶
- LTFC (lead time for changes) uses git author dates — immune to rebase (rebase rewrites committer dates only). Verify author ≈ committer dates on the target repo.
- DF: a merge to the trunk counts as a deployment only if merges deploy. Confirm the deploy trigger before labelling merge frequency as deployment frequency.
- Cycle time (PR
created_on→ merge) needs a forge API and is out of the default git-only path.
Pure-Python, stdlib only (subprocess) — no pip install required.
Files¶
| File | Role |
|---|---|
metrics.py |
Pure calc engine (no IO). All formulas + classification live here. |
test_metrics.py |
unittest tests for the engine. |
collect.py |
IO layer: enumerate PR merges from git, print/emit records. |
Run¶
# from this scripts/ directory
python -m unittest test_metrics.py
# current 30-day window
python collect.py --since 2026-05-17 --until 2026-06-16
# by day-count instead of an end date
python collect.py --since 2026-05-17 --days 30
# dump raw records for offline analysis
python collect.py --since 2026-04-17 --json /tmp/records.json
Definitions (tunable in metrics.py)¶
- Micro change:
files<=1 and churn<=5 and commits<=1(trivial one-liner). - Meaningful change: not micro.
- Genuinely-active contributor:
>=3 PRs OR >=5 active daysin the window (require_both=Trueto AND them). - Benchmark: 1 good change per 2 active contributors per work-day
(
contributors_per_change=2→ 0.5 meaningful PRs / active contributor / work-day). - AUTHOR_ALIASES: start empty; extend per target project.