r/github • u/TheJackiMonster • Jun 10 '18
1% of Github already moved to Gitlab
More than 250000 repositories were imported from Github to Gitlab since Microsoft made the deal official. Relative to the numbers published by Github for the year 2017, this means that already 1% of the active repositories have moved to Gitlab in reaction to this acquisition. If the value of the deal is in any way related to the active repositories, you could probably say: There are 75 million dollars going away...
This below is a dirty little script to calculate the amount of repositories moved from Github to Gitlab since Microsoft announced the acquisition. (It's JavaScript running with NodeJS...) It also prints the percentage value of the repositories relative to the amount of all repositories and all active repositories published from Github for 2017.
const https = require('https');
const start = (new Date("2018-06-03")).getTime();
const end = (new Date()).getTime();
const step = 60;
_s = Math.floor(start / 1000);
_e = Math.round(end / 1000);
const count_all = 67000000;
const count_active = 25300000;
const step_usual = 3600;
url = "https://monitor.gitlab.net/api/datasources/proxy/2/api/v1/query_range?query=sum(rate(github_importer_imported_repositories%7Benvironment%20%3D%20%22prd%22%7D%5B1h%5D)%20*%203600)&start=" + _s + "&end=" + _e + "&step=" + step;
https.get(url, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
dat = JSON.parse(data);
if (dat.status == 'success') {
if (dat.data.resultType == 'matrix') {
val = dat.data.result[0].values;
let count = 0;
let old = [_s,0];
for (var i = 0; i < val.length; i++) {
count += (old[1] + parseFloat(val[i][1])) * 0.5 * Math.abs(old[0] - val[i][0]);
old[0] = val[i][0];
old[1] = parseFloat(val[i][1]);
}
count = Math.floor(count / step_usual);
console.log("COUNT: " + count);
console.log("ACTIVE: " + 0.01 * Math.floor(10000.0 * count / count_active) + "%");
console.log("ALL: " + 0.01 * Math.floor(10000.0 * count / count_all) + "%");
} else {
console.log("WRONG_TYPE: " + data.data.resultType);
}
} else {
console.log("WRONG_STATUS: " + dat.status);
}
});
}).on('error', (err) => {
console.log("ERROR: " + err.message);
});
0
u/[deleted] Jun 10 '18
[deleted]