Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts for PR metrics from github API #13

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b10b809
Add scripts for PR metrics from github API
mpg Jun 30, 2020
c531cae
Update requirements & allow use from venv
mpg Sep 30, 2020
a715053
Add comments about Ubuntu 20.04
mpg Dec 24, 2020
bae9af3
Make get-pr-data 10x faster
mpg Dec 24, 2020
00d8499
Avoid potential better-than-reality lifetime figures
mpg Dec 30, 2020
28dffa7
Adjust pr_dates() to reduce risk of misuse
mpg Dec 30, 2020
3d7880c
Adapt detection of community PRs
mpg Apr 2, 2021
37844d4
Add warning about making this work on 16.04
mpg Apr 2, 2021
cf9e41d
Avoid repeating the start date in many places
mpg Apr 2, 2021
f06becf
Update outdated comment
mpg Apr 2, 2021
cc05d6a
Make first and last date configurable
mpg Apr 2, 2021
ed1adea
Fix flake8 warnings
mpg Apr 2, 2021
08c0b7c
Rotate labels for quarters
mpg Apr 2, 2021
b2ee775
Clarify community detection
mpg May 19, 2021
3feb297
Smarter handling of p.mergeable in get-pr-data
mpg May 20, 2021
1d58093
Update pending-mergeability
mpg May 20, 2021
5f6d268
We no longer use labels for community PRs
mpg Sep 30, 2022
94533e1
Update list of core contributors
mpg Oct 12, 2022
b7f7f76
Update Readme (PR last date)
mpg Oct 12, 2022
e69fb3a
Shift one month for quarterly PR lifetime
mpg Jan 11, 2023
cd9c1f6
Update list of team member
mpg Jan 11, 2023
4d58ba0
Revert "Shift one month for quarterly PR lifetime"
mpg Jan 11, 2023
45fa6ce
Use statistics.median
mpg Jan 11, 2023
f1b54e1
Handle uncertainty about lifetimes
mpg Jan 11, 2023
ac21a51
Update Readme about incomplete results
mpg Jan 12, 2023
e095fc3
Update team members with current reviewers
mpg Apr 6, 2023
ce08049
Draw error bars, don't skip uncertain quarters
mpg Apr 6, 2023
c86237c
New script pr-backlog.py
mpg Apr 6, 2023
b7a02f6
Cosmetic adjustments
mpg Apr 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pr-metrics/pr-lifetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections import defaultdict

import matplotlib.pyplot as plt
from datetime import datetime
from datetime import datetime, timedelta

first_q = quarter(first)
last_q = quarter(last)
Expand All @@ -29,7 +29,12 @@
else:
lt = (end - beg).days

q = quarter(beg)
# Shit one month (that is, for q2 count March to May, not April to July).
# This is because we want to measure this at the end of each quarter, but
# including PRs raised too recently skew the results. Shifting one month
# means we had time to look at the PR by the time we generate quaterly
# metrics.
q = quarter(beg - timedelta(days=30))
mpg marked this conversation as resolved.
Show resolved Hide resolved
lifetimes_all[q].append(lt)
if com:
lifetimes_com[q].append(lt)
Expand Down Expand Up @@ -62,11 +67,11 @@ def median(sl):
ax.legend(loc="upper right")
ax.grid(True)
ax.set_xlabel("quarter")
ax.set_ylabel("median lifetime in days of PRs created that quarter")
ax.set_ylabel("median lifetime in days of PRs created that quarter (shifted 1 month)")
ax.tick_params(axis="x", labelrotation=90)
bot, top = ax.set_ylim()
ax.set_ylim(0, min(365, top)) # we don't care about values over 1 year
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we don't care about values over a year? Several quarters (for example 16q1) exceed this value

fig.suptitle("Median lifetime of PRs per quarter (less is better)")
fig.suptitle("Median lifetime of PRs per quarter (shifted 1 month) (less is better)")
fig.set_size_inches(12.8, 7.2) # default 100 dpi -> 720p
fig.savefig("prs-lifetime.png")

Expand Down
5 changes: 5 additions & 0 deletions pr-metrics/prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"gabor-mezei-arm",
"gilles-peskine-arm",
"hanno-arm",
"hanno-becker",
"jackbondpreston-arm",
"jarlamsa",
"jarvte",
Expand All @@ -55,10 +56,14 @@
"RonEld",
"sbutcher-arm",
"shanechko",
"silabs-hannes",
"silabs-Kusumit",
"silabs-Saketh",
"superna9999",
"tom-cosgrove-arm",
"tom-daubney-arm",
"tuvshinzayaArm",
"valeriosetti",
"wernerlewis",
"xkqian",
"yanesca",
Expand Down