1 Star 0 Fork 23

kuraudo / RepoStats

forked from 巴拉迪维 / RepoStats 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MulanPSL-2.0

RepoStats

开源代码仓库的 star、fork、commit、pull request、issue 等相关数据,是分析和了解代码仓库的客观依据,这些数据在一定程度上反应了开源项目的受欢迎程度、活跃度、影响力等。

RepoStats 致力于解决的痛点问题是:

  1. 开源代码仓库的数据抓取、存储、分析及统计 (当前版本仅支持 Gitee 平台)
  2. 开源代码仓库的相关数据可视化展示
  3. 做到全平台打通,并支持分隔、组合展示

主要原理示意图如下:

RepoStats 示意图

功能说明

  1. 当前版本的 RepoStats 仅支持 Gitee 平台相关数据获取 (后续会持续新增其他平台,国产平台优先考虑)
  2. 管理后台:支持界面化的 Gitee Oauth 配置、Grafana Token 获取配置
  3. 管理后台:支持添加单个仓库、支持批量添加个人帐号及组织帐号下的公开仓库
  4. 管理后台:支持禁用、启用 Gitee 数据抓取(启动抓取除外)
  5. 管理后台:支持 Commit 列表显示及查询、Issue 列表显示及查询、Pull Request 列表显示及查询
  6. Grafana 标签:每个面板均有附带仓库拥有者标签、仓库名称、平台名称等信息支持查询过滤

安装及配置说明

1. 使用 Docker 环境

启动 Docker 镜像前请注意查看 docker/vars.env 文件,并根据自己的实际情况调整需要的参数(eg:本地端口号等)。启动 docker/start_docker_repostats.sh 可以通过 Docker 环境将所有依赖安装并启动。该命令将:

  1. 拉取 repostats 镜像(本地构建可查看 docker/repostats.Dockerfile 文件)
  2. 通过 docker/pull_build.yml 其他描述内容构建 GrafanaPostgreSQL 镜像及服务,并对其运行状态做判断,再启动其他必要服务 (本地构建镜像请查阅 local_build.yml)
  3. 构建名为 network_repostats 的虚拟网络供上述服务使用
  4. 开启本机 9103 端口应对 RepoStats 工具、启动 13000 端口应对 Grafana 工具,启动 15432 应对 PostgreSQL 数据库

2. 通过 Makefile 构建

构建 linux 平台对应的可执行文件:

make build-linux

压缩 linux 平台对应的可执行文件(压缩可执行文件需要 upx 支持):

make compress-linux

3. 使用各系统分发版本

启动参数说明

repostats [-c config_file]

通过 Release 下载对应平台的分发版并启动运行,启动之前请确保 repostats.ini 配置文件中各项内容的正确性

[repostats]
debug = false
admin_port = 9103


[postgres]
host = localhost
port = 15432
user = postgres
password = DePmoG_123
database = repostats
max_open_conn = 20
max_idle_conn = 5

[grafana]
host = localhost
port = 13000
user = admin
password = admin

数据库说明:

  1. 请在 PostgreSQL 数据库中创建名称 repostats 的数据库
  2. 请分别 顺序执行 sql/db.sqlsql/gitee.sqlsql/roles.sql 创建必要的表及视图等

使用前置条件

RepoStats 启动成功之后,请使用帐号密码登录 Admin 管理后台。管理后台默认的账户名密码信息如下:

repostats
-2aDzm=0(ln_9^1

在开始爬取 Gitee 数据并向 Grafana 推送相关统计结果之前,需要对其进行一定的配置:

  1. 在 Admin 管理界面中的 Gitee 配置 页面根据提示配置必要的 Oauth 参数 从而保证能够正常获取 Gitee 相关数据
  2. 在 Admin 管理界面中的 Grafana 配置 页面中根据提示配置必要的 Grafana 参数 从而确保能够与 Grafana 进行通信
  3. 上一步骤中,与 Grafana 通信成功之后,需要在 Grafana 操作页面中对数据源进行一次 Test & Save 才能保证数据源正常 (这个问题暂时似乎是没办法处理的,后续会想办法处理)
  4. 在 Admin 管理界面中的 代码仓库列表 页面中,根据界面提示添加想要关注的代码仓库

统计指标说明

RepoStats 当前版本支持3大类共计21项统计数据可视化结果展示,这些统计数据不能表示一个开源项目的好与坏,仅从数据层面对开源代码仓库进行一定的展示。这些数据指标分类以下三类:

1. 统计汇总

统计汇总 分类中展示的数据,与时间无关,它们代表的是所有项目(Gitee Overview)后者是某个指定的项目的汇总数据结果,其中包括:

  • 仓库统计
    当前抓取的仓库总数量、总 Star 人数、总 Fork 人数、总 Watch 人数

  • 基本信息
    当前仓库的 Star 人数、Fork 人数、Watch 人数

  • Commit 统计
    Commit 总数、Commit Author 总数(去重)、Commit Committer 总数(去重)

  • Issue 统计
    Issue 综述、Issue 总人数、打开状态的 Issue 总数、已关闭状态的 Issue 总数、已拒绝状态的 Issue 总数、处理中的 Issue 总数

  • Issue 状态图
    已关闭、已拒绝、打开、处理中 状态的 Issue 占比示意图

  • Pull Request 统计
    Pull Request 总数、Pull Request 人数、打开状态的 Pull Request 总数、已合并状态的 Pull Request 总数、已关闭状态的 Pull Request 总数

  • Pull Request 状态图
    已合并、打开、已关闭 的 Pull Reqeust 占比示意图

  • Issue 处理时间分析
    所有 Issue 从 created_atfinished_at 的最小耗时、平均耗时、最大耗时,单位:小时

  • Pull Request 合并时间分析
    所有 可合并的 Pull Request 从 created_atmerged_at 的最小耗时、平均耗时、最大耗时,单位:小时

2. 动态趋势

动态趋势 分类中展示的数据,是 某个时间段内 数据量的动态变化过程,可以通过 Grafana 面板右上角的时间选项查看指定时间范围内的变化趋势,其中包括:

  • Star 趋势图
    指定时间范围内,关注仓库的总人数变化趋势

  • Commit 趋势图
    指定时间范围内,Commit 提交次数的变化趋势

  • Issue 趋势图
    指定时间范围内,新增 Issue 数的变化趋势

  • Pull Request 趋势图
    指定时间范围内,新增 Pull Request 数的变化趋势

  • Pull Request 合并时间分析
    指定时间范围内,可合并的 Pull Request 从 created_atmerged_at 的最小耗时、平均耗时、最大耗时,单位:小时

  • Issue 处理时间分析
    指定时间范围内,新增的 Issue 从 created_atfinished_at 的最小耗时、平均耗时、最大耗时,单位:小时

3. 数据列表

数据列表 分类中展示的数据,与时间无关,它们代表的是所有项目(Gitee Overview)后者是某个指定的项目的汇总数据结果,其中包括:

  • 仓库列表
    所有仓库的明细列表

  • Commit 列表
    Commit 明细列表

  • Issue 列表
    Issue 明细列表

  • Pull Request 列表
    Pull Request 明细列表

  • Commit Author 排行
    Commit Auhtor 次数排行

  • Commit Committer 排行 Commit Committer 次数排行

数据抓取策略

RepoStats 启动之后,默认情况下每隔 6小时 抓取一次数据并更新 Grafana 视图面板

Screenshots

  1. 所有仓库总视图 所有仓库总视图

  2. 指定某个仓库的视图
    指定某个仓库的视图

  3. Admin 后端管理界面 Admin 后端管理界面

Contributor License Agreement

第一次提交 Pull Request 时 ,请您在 Pull Request 内容中明确写明「本人自愿接受并签署 《RepoStats Contributor License Agreement》」,并在 Pull Request 信息中附带该协议链接信息。

Inspired By

  1. CNCF DevStats
  2. cncf/devstatscode

Give Thanks To

由衷感谢以下开源软件、框架等(包括但不限于)

  1. Grafana
  2. gin-gonic/gin
  3. FomanticUI
  4. dchest/captcha
  5. Masterminds/sprig
  6. jmoiron/sqlx
  7. go-ini/ini
木兰宽松许可证, 第2版 木兰宽松许可证, 第2版 2020年1月 http://license.coscl.org.cn/MulanPSL2 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: 0. 定义 “软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 “贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 “贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 “法人实体”是指提交贡献的机构及其“关联实体”。 “关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 1. 授予版权许可 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 2. 授予专利许可 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 3. 无商标许可 “本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 4. 分发限制 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 5. 免责声明与责任限制 “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 6. 语言 “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 条款结束 如何将木兰宽松许可证,第2版,应用到您的软件 如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: 1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; 2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; 3, 请将如下声明文本放入每个源文件的头部注释中。 Copyright (c) [Year] [name of copyright holder] [Software Name] is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. Mulan Permissive Software License,Version 2 Mulan Permissive Software License,Version 2 (Mulan PSL v2) January 2020 http://license.coscl.org.cn/MulanPSL2 Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: 0. Definition Software means the program and related documents which are licensed under this License and comprise all Contribution(s). Contribution means the copyrightable work licensed by a particular Contributor under this License. Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. Legal Entity means the entity making a Contribution and all its Affiliates. Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. 1. Grant of Copyright License Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. 2. Grant of Patent License Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. 3. No Trademark License No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. 4. Distribution Restriction You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. 5. Disclaimer of Warranty and Limitation of Liability THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 6. Language THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. END OF THE TERMS AND CONDITIONS How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package; iii Attach the statement to the appropriate annotated syntax at the beginning of each source file. Copyright (c) [Year] [name of copyright holder] [Software Name] is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.

简介

开源代码仓库的 star、fork、commit、pull request、issue 等相关数据统计并可视化展示 展开 收起
Go
MulanPSL-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/gasho/repostats.git
git@gitee.com:gasho/repostats.git
gasho
repostats
RepoStats
main

搜索帮助

14c37bed 8189591 565d56ea 8189591