Install
# 獲取項目
git clone https://github.com/holmari/gerritstats.git
# 構(gòu)建
./gradlew assemble
Use
獲取數(shù)據(jù)
從 gerrit 獲取統(tǒng)計數(shù)據(jù)(json)
gerrit_downloader [options]
| option | short | brief |
|---|---|---|
| --server | -s | gerrit server ssh 地址, 默認(rèn)端口 29418 |
| --project | -p | specify project list, default: [] |
| --private-key | -i | specify ssh private-key |
| --output-dir | -o | specify the output directory of statistics data |
| --limit | -l | limit the number of commits |
| --before-date | -b | commits before the date |
| --after-date | -a | commits after the date |
Caution:
- 按項目統(tǒng)計請指定 --project 參數(shù);
- 請確保通過 ssh 方式連接 gerrit server;
# 從 gerrit 服務(wù)端獲取 項目(java-deploy-demo) 數(shù)據(jù)(json) 通過 ssh 方式
./gerrit_downloader.sh --server 190.168.1.27 --project java-deploy-demo --limit 7500 --output-dir gerrit_out/
數(shù)據(jù)可視化
# 指定 統(tǒng)計數(shù)據(jù)(file/directory) 可視化
./gerrit_stats.sh -f gerrit_out/
Have a look

gerritstats_view.png
Problems
-
構(gòu)建項目報錯 Execution failed for task ':GerritStats:npmSetup'
依賴 nodejs -> 安裝 nodejs
-
ssh 連接錯誤
確認(rèn)對應(yīng)用戶的密鑰對是否配置正確
-
數(shù)據(jù)可視化報錯 ERROR in Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (72)
當(dāng)前的 Sass 不支持(匹配) 當(dāng)前環(huán)境,卸載舊版本 node-sass 并安裝最新版本。
# uninstall npm uninstall --save node-sass # install npm install --save-dev node-sass
參考文檔 Gerritstats