Skip to content

Commit

Permalink
2024 Q1 metrics update
Browse files Browse the repository at this point in the history
* Added missing people
* Fixed error handling in pull request metrics GitHub library
  • Loading branch information
LinuxJedi committed Apr 23, 2024
1 parent e4b7c89 commit b73623f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
1 change: 1 addition & 0 deletions commits/config/categories
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Stellar Science" Provider
"Sun Microsystems" Provider
"Trail of Bits" Other
"University of Sydney" Other
"Wind River" Provider
"Worldline Global" Provider
Aerospike Provider
Expand Down
5 changes: 5 additions & 0 deletions commits/config/employers
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
1136268146@qq.com Independent
15198894161@139.com Independent
22895992+paragoumba@users.noreply.github.com Independent
3001893+sophist-uk@users.noreply.github.com Independent
3310288189@qq.com GSoC
33860799+a97410985@users.noreply.github.com Independent
344369869@qq.com Independent
Expand Down Expand Up @@ -39,11 +40,13 @@ alan.cuevamr@gmail.com GSoC
alex.fan.q@gmail.com Gentoo
andrew@linuxjedi.co.uk MariaDB Plc. < 2020-08-15
andrew@linuxjedi.co.uk MariaDB Foundation
andrew.daugherity@gmail.com Independent
angeloudy@gmail.com Independent
anthonyryan1@gmail.com Whatbox
arkamar@atlas.cz Gentoo
askeblad@outlook.com Independent
aun.sokolov@gmail.com Independent
aurelien@aurel32.net Independent
bertrandop@gmail.com CONNECT
bluemrp9@gmail.com Independent
brad@comstyle.com OpenBSD
Expand Down Expand Up @@ -101,6 +104,7 @@ hsspig@gmail.com Independent
jonas.karlsson@kau.se Independent
jonathan.sabbe@gmail.com Worldline Global
jordy@pwning.systems Independent
jtojnar@gmail.com Independent
justin@jagieniak.net Independent
junqi_xie@outlook.com GSoC
# A large Ruby on Rails contributor
Expand Down Expand Up @@ -170,6 +174,7 @@ pavlich_eng00@mail.ru Independent
pkubaj@users.noreply.github.com HardenedBSD
plainbanana@mustardon.tokyo Independent
pmacontrol@68koncept.com Independent
psz@maths.usyd.edu.au University of Sydney
rahulanand16nov@gmail.com Independent
raj.khem@gmail.com Comcast
rantal5030@gmail.com Independent
Expand Down
2 changes: 1 addition & 1 deletion pull-requests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### get_prs.py

This tool gets the PR counts for 2022 and stores them in `prs-<START>..<END<.csv`. There is a deliberate 2 second pause between each request so as not to hit the GitHub rate limit (30 requests per minute).
This tool gets the PR counts for 2022 and stores them in `prs-<START>..<END>.csv`. There is rate-limit handling built in because some calls are only allowed to do 30 requests per minute. It will also pause and retry upon 500 server errors.

To execute this you will need a GitHub token from https://github.com/settings/tokens/new and set this as the environment variable `GITHUB_TOKEN`. You need to provide a date range using week numbers. For example, to generate a 2022 report:

Expand Down
38 changes: 24 additions & 14 deletions pull-requests/pr_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,31 @@


def get_data(url, verbose):
response = requests.get(url, headers = auth_header)
if response.status_code != 200:
print("Failed to get json data: " + str(response.headers))
exit()
if (int(response.headers['X-RateLimit-Remaining']) <= 2):
if verbose:
print("\nRate limit low, remaining " + response.headers['X-RateLimit-Remaining'] + " sleeping for 30 seconds", end='')
while(True):
response = requests.get(url, headers = auth_header)
if response.status_code == 500:
if verbose:
print("\nServer error, retrying in 30 seconds")
else:
print('*', end='')
sys.stdout.flush()
time.sleep(30)
elif response.status_code != 200:
print("\nFailed to get json data: " + str(response.headers))
print("URL: " + url)
print("Status code: " + str(response.status_code))
exit()
elif (int(response.headers['X-RateLimit-Remaining']) <= 2):
if verbose:
print("\nRate limit low, remaining " + response.headers['X-RateLimit-Remaining'] + " sleeping for 30 seconds", end='')
else:
print('_', end='')
sys.stdout.flush()
time.sleep(30)
else:
print('_', end='')
time.sleep(30)
else:
print('.', end='')
sys.stdout.flush()

return response
print('.', end='')
sys.stdout.flush()
return response

def get_paginated_data(url, verbose):
data = []
Expand Down

0 comments on commit b73623f

Please sign in to comment.