Share
Embed
Mining Github for fun and profit
Georgios Gousios
June 24, 2016
Transcript
96 slides
-
api.github.com Entities Events •static view •interlinked •current state •dynamic view
•generated by user actions •affect current entity state •can be browsing roots -
WatchEvent PushEvent ForkEvent . . . CreateEvent {{ "type": "WatchEvent",
"payload": {...}, "public": true, "repo": {...}, "created_at": "2012-05-28T12:42 "id": "1556481024", "actor": {"login": "Sarukhan"} } Events -
repositories users organizations issues /users/:user /user/repos /repos/:user/:repo/issues /orgs/:org { "type":
"User", "public_gists": 10, "login": "gousiosg", "followers": 64, "name": "Georgios Gousios", "public_repos": 20, "created_at": ..., "id": 386172, "following": 16, } { Entities . . . -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits <<api>> /:user/:repo/sha ensure_commit -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits <<api>> /:user/:repo/sha ensure_commit <<api>> /repos/:user/:repo/ commits/:sha/comments ensure_commit_comments -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits <<api>> /:user/:repo/sha ensure_commit <<api>> /users/:user/ followers ensure_followers <<api>> /repos/:user/:repo/ commits/:sha/comments ensure_commit_comments -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits <<api>> /:user/:repo/sha ensure_commit <<api>> /users/:user/ followers ensure_followers <<api>> /repos/:user/:repo/ commits/:sha/comments ensure_commit_comments <<api>> /users/:user/orgs ensure_orgs -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits <<api>> /:user/:repo/sha ensure_commit <<api>> /users/:user/ followers ensure_followers <<api>> /repos/:user/:repo/ commits/:sha/comments ensure_commit_comments <<api>> /users/:user/orgs ensure_orgs <<api>> /orgs/:org/teams ensure_teams -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits ensure_user <<api>> /:user/:repo/sha ensure_commit <<api>> /users/:user/ followers ensure_followers <<api>> /repos/:user/:repo/ commits/:sha/comments ensure_commit_comments <<api>> /users/:user/orgs ensure_orgs <<api>> /orgs/:org/teams ensure_teams -
<<event>> PushEvent <<api>> /users/:user ensure_user <<api>> /repos/:user/:repo/ ensure_repo <<api>> /repos/:user/:repo/commits
ensure_commits ensure_user <<api>> /:user/:repo/sha ensure_commit ensure_user <<api>> /users/:user/ followers ensure_followers <<api>> /repos/:user/:repo/ commits/:sha/comments ensure_commit_comments <<api>> /users/:user/orgs ensure_orgs <<api>> /orgs/:org/teams ensure_teams -
Github API Event Retrieval Commits Queue Project Events Queue Events
Data Retrieval Projects Commits evt.commit evt.watch evt.fork Data Retrieval Data Retrieval Data Retrieval Mirroring Cluster Distributed data processing -
repositories users organizations issues /users/:user /user/repos /repos/:user/:repo/issues /orgs/:org { "type":
"User", "public_gists": 10, "login": "gousiosg", "followers": 64, "name": "Georgios Gousios", "public_repos": 20, "created_at": ..., "id": 386172, "following": 16, } { . . . MongoDB as query-able cache -
Roll your own dataset $ gem install sqlite3 bundler $
git clone https://github.com/gousiosg/github-mirror $ cd github-mirror $ bundle install $ mv config.yaml.standalone > config.yaml $ ruby -Ilib bin/ght-retrieve-repo -t token rails rails -
Statistics Since Feb 2012 12TB in MongoDB 4.5B rows in
MySQL 2GB per hour 120k API reqs/hour 46 user donated API keys G. Gousios, “The GHTorrent dataset and tool suite,” in MSR, 2013: 233-236 130+ users, 80+ institutions 80+ papers 3 data mining challenges 2 best paper awards G. Gousios and D. Spinellis, “ GHTorrent: GitHub’s Data from a Firehose,” in MSR, 2012, 12–21 -
MongoDB MySQL Diff 2016/2013 Events 476 11.1x Users 6,7 9,2
8.4x Repos 28 25,5 21.8x Commits 367 362 12.3x Issues 24,1 25,3 10.3x Pull requests 11,9 11,1 9.7x Issue comments 42 43 14.6x Watchers 51 37 6.6x G. Gousios, The Evolution of GHTorrent: Growing an Open Access Dataset 10x Growth -
1000 10000 100000 2012 2013 2014 2015 2016 Date Number
of events Event Type CommitCommentEvent FollowEvent ForkEvent IssueCommentEvent IssuesEvent MemberEvent PullRequestEvent PullRequestReviewCommentEvent PushEvent TeamAddEvent WatchEvent G. Gousios, The Evolution of GHTorrent: Growing an Open Access Dataset 10x -
0 100000 200000 300000 2012 2013 2014 2015 2016 Date
Number of events Event Type CommitCommentEvent FollowEvent ForkEvent IssueCommentEvent IssuesEvent MemberEvent PullRequestEvent PullRequestReviewCommentEvent PushEvent TeamAddEvent WatchEvent G. Gousios, The Evolution of GHTorrent: Growing an Open Access Dataset 10x -
Here are my changes Please fix those issues Here are
my updates Looks great, thanks! contributor integrator changes integrated changes examined changes re- examined -
Across 5k repos/ ~1M pull requests 85% merged, 70% with
merge button 80% < 150 lines, < 7 files, 3 commits 66% < 1 day to merge 80% 4 comments, 3 participants Mostly rejected due to observability/awareness issues (not technical!) G. Gousios, M. Pinzger, and A. van Deursen, “An Exploratory Study of the Pull-based Software Development Model,” ICSE 2014, pp. 345–355 What factors affect PR acceptance? -
G. Gousios et al., “Distributed software development with pull requests”.
Unpublished. Which factors affect PR acceptance? Do we know the submitter? Can we handle the workload? How ready is our project for PRs? What does the PR look like? -
G. Gousios et al., “Distributed software development with pull requests”.
Unpublished. Which factors affect PR acceptance? Do we know the submitter? Can we handle the workload? How ready is our project for PRs? Do we know the submitter? What does the PR look like? -
G. Gousios et al., “Distributed software development with pull requests”.
Unpublished. Which factors affect PR acceptance? Do we know the submitter? Can we handle the workload? How ready is our project for PRs? Can we handle the workload? What does the PR look like? -
G. Gousios et al., “Distributed software development with pull requests”.
Unpublished. Which factors affect PR acceptance? Do we know the submitter? Can we handle the workload? How ready is our project for PRs? What does the PR look like? What does the PR look like? -
G. Gousios et al., “Distributed software development with pull requests”.
Unpublished. Which factors affect PR acceptance? Do we know the submitter? Can we handle the workload? How ready is our project for PRs? What does the PR look like? How ready is our project for PRs? -
Can we handle the workload? G. Gousios et al., “Distributed
software development with pull requests”. Unpublished. Which factors affect the time to process PRs? Do we know the submitter? How ready is our project for PRs? What does the PR look like? -
Can we handle the workload? G. Gousios et al., “Distributed
software development with pull requests”. Unpublished. Which factors affect the time to process PRs? Do we know the submitter? How ready is our project for PRs? What does the PR look like? Can we handle the workload? -
Can we handle the workload? G. Gousios et al., “Distributed
software development with pull requests”. Unpublished. Which factors affect the time to process PRs? Do we know the submitter? How ready is our project for PRs? What does the PR look like? Do we know the submitter? -
Can we handle the workload? G. Gousios et al., “Distributed
software development with pull requests”. Unpublished. Which factors affect the time to process PRs? Do we know the submitter? How ready is our project for PRs? What does the PR look like? How ready is our project for PRs? -
Can we handle the workload? G. Gousios et al., “Distributed
software development with pull requests”. Unpublished. Which factors affect the time to process PRs? Do we know the submitter? How ready is our project for PRs? What does the PR look like? What does the PR look like? -
Survey of 650 integrators Generally, few complains about the process
Points of pain are mostly social (workload, drive-by PRs, explaining rejection) Needed tools Quality analysis Impact analysis Work prioritization G. Gousios, A. Zaidman, M.-A. Storey, and A. van Deursen, “Work Practices and Challenges in Pull-Based Development: The Integrator’s Perspective,” ICSE 2015, pp. 358–368. What do integrators actually believe? -
Survey of 640 contributors. Similar issues, reversed Awareness Asynchrony Responsiveness
G. Gousios, M.-A. Storey, and A. Bacchelli, “Work Practices and Challenges in Pull-Based Development: The Contributor’s Perspective,” ICSE, 2016. What do contributors actually believe? -
Decide change Code/Check quality Submit Discuss intentions Feedback Code review
Submit Proposed fixes Discuss fixes Code review Accept Code/Check quality contributors integrators -
Decide change Code/Check quality Submit Discuss intentions Feedback Code review
Submit Proposed fixes Discuss fixes Code review Accept Code/Check quality contributors integrators -
Which are ? IMPORTANT
-
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 -
Which are ? IMPORTANT
Day 1 Day 2 Day 3 Day 4 IMPORTANT = about to be active -
Precision Recall AUC Accuracy Random Forests 0.66 0.63 0.89 0.86
Naive Bayes 0.34 0.79 0.75 0.60 Logistic regression 0.36 0.84 0.81 0.62 E. van der Veen, G. Gousios, and A. Zaidman, “Automatically Prioritizing Pull Requests,” MSR, 2015, pp. 357–361. -
Precision Recall AUC Accuracy Random Forests 0.66 0.63 0.89 0.86
Naive Bayes 0.34 0.79 0.75 0.60 Logistic regression 0.36 0.84 0.81 0.62 E. van der Veen, G. Gousios, and A. Zaidman, “Automatically Prioritizing Pull Requests,” MSR, 2015, pp. 357–361. -
Openess perf reports How open is your project to community
contributions? • 5k projects • every 15 days http://ghtorrent.org/pullreq-perf -
Reviewer recommendation Yue Yu, Huaimin Wang, Gang Yin, Tao Wang,
Reviewer recommendation for pull- requests in GitHub: What can we learn from code review and bug assignment?,IST, 2016 Exploit @mention networks to propose top-3 reviewers for incoming pull requests. Accuracy ~60% on top-3 recommendation -
Automated code review Vincent J. Hellendoorn, Premkumar T. Devanbu, and
Alberto Bacchelli. 2015. Will they like this?: evaluating code contributions with language models. MSR ’15, pp157-167 Examine how “natural” the PR code is WRT the project’s code base. Accepted PRs are significantly similar to the project More debated PRs are significantly less similar -
Gender and Tenure Vasilescu, Posnett, Ray, van den Brand, Serebrenik,
Devanbu, and Filkov. Gender and Tenure Diversity in GitHub Teams. CHI. 2015 “Our study suggests that, overall, when forming or recruiting a software team, increased gender and tenure diversity are associated with greater productivity.” -
Geographical equality A. Rastogi, N. Nagappan, and G. Gousios, “All
contributors are equal; some contributors are more equal than others,”, TR, 2016 Traces of bias on contributions from certain countries • Contributors perceive it • Integrator’s do not -
Gender & Contributions Terrell J, Kofink A, Middleton J, Rainear
C, Murphy-Hill E, Parnin C. (2016) Gender bias in open source: Pull request acceptance of women versus men. PeerJ PrePrints 4:e1733v1 When gender is identifiable: women rejected more often When gender is not identifiable: women accepted more often -
I am not a lawyer! • Other commenters are no
lawyers either • The law is complicated and open to interpretation -
Two important issues • Copyright: Who owns the data? •
Privacy: How does GHTorrent protect users from personal data misuse? -
Copyright —General terms • For original content, the publisher maintains
full copyright by default • Licenses restrict the effect of copyright • Events (e.g. the fact that an issue comment was created) are not copyrightable, but their content may be -
Copyright — GitHub’s POV • GitHub: We claim no intellectual
property rights over the material you provide to the Service. (TOS F.1) • Structure of API responses is GitHub’s IP • Several fields in API responses may contain copyrighted material -
Copyright situation example { "id": "4141500869", "type": "IssueCommentEvent", "actor": {},
"repo": {}, "payload": { "action": "created", "issue": { "id": 158442053, "number": 138, "title": "Issue in CopyrightedProjectName", "user": {}, "labels": [], "state": "closed", "body": "Added data holding classes and a map manager. Will add a system soon" }, "comment": { "created_at": "2016-06-14T05:51:16Z", "updated_at": "2016-06-14T05:51:16Z", "body": "continuing in #141 \r\n" } } } -
Copyright situation example { "id": "4141500869", "type": "IssueCommentEvent", "actor": {},
"repo": {}, "payload": { "action": "created", "issue": { "id": 158442053, "number": 138, "title": "Issue in CopyrightedProjectName", "user": {}, "labels": [], "state": "closed", "body": "Added data holding classes and a map manager. Will add a system soon" }, "comment": { "created_at": "2016-06-14T05:51:16Z", "updated_at": "2016-06-14T05:51:16Z", "body": "continuing in #141 \r\n" } } } ©Issue initiator -
Copyright situation example { "id": "4141500869", "type": "IssueCommentEvent", "actor": {},
"repo": {}, "payload": { "action": "created", "issue": { "id": 158442053, "number": 138, "title": "Issue in CopyrightedProjectName", "user": {}, "labels": [], "state": "closed", "body": "Added data holding classes and a map manager. Will add a system soon" }, "comment": { "created_at": "2016-06-14T05:51:16Z", "updated_at": "2016-06-14T05:51:16Z", "body": "continuing in #141 \r\n" } } } ©Issue initiator ©Issue commenter -
Copyright situation example { "id": "4141500869", "type": "IssueCommentEvent", "actor": {},
"repo": {}, "payload": { "action": "created", "issue": { "id": 158442053, "number": 138, "title": "Issue in CopyrightedProjectName", "user": {}, "labels": [], "state": "closed", "body": "Added data holding classes and a map manager. Will add a system soon" }, "comment": { "created_at": "2016-06-14T05:51:16Z", "updated_at": "2016-06-14T05:51:16Z", "body": "continuing in #141 \r\n" } } } ©Project Name ©Issue initiator ©Issue commenter -
Copyright situation example { "id": "4141500869", "type": "IssueCommentEvent", "actor": {},
"repo": {}, "payload": { "action": "created", "issue": { "id": 158442053, "number": 138, "title": "Issue in CopyrightedProjectName", "user": {}, "labels": [], "state": "closed", "body": "Added data holding classes and a map manager. Will add a system soon" }, "comment": { "created_at": "2016-06-14T05:51:16Z", "updated_at": "2016-06-14T05:51:16Z", "body": "continuing in #141 \r\n" } } } ©GitHub ©Project Name ©Issue initiator ©Issue commenter -
Privacy is the ability of an individual or group to
seclude themselves, or information about themselves, and thereby express themselves selectively. -
Privacy provisions — EU • Personal data identify a person
uniquely • Facts are not personal data • GHTorrent processes personal data, therefore is a controller • Controllers must • get consent for processing (except in the case of legitimate interest) • include mechanisms for opting out -
Privacy provisions — USA • No single law/directive • Consent
only required for specific types of data storage (e.g. social security numbers) • Offering an opting out mechanism -
What did GHTorrent do? • Stopped distributing user names and
emails in MySQL data dumps • Researchers can “sign” a form to get access to private data • Created an opt-out process • In the process of creating Terms of Fair Use -
A question of research ethics Can we, in the name
of science, • send emails to developers? • create developer profiles? • recommend work to developers? • rank developers based on contributions? • compare project characteristics? • characterise community practices?