This project is a tool for calculating code contribution statistics for each user in a Gitlab instance. It is designed to be efficient and can handle large-scale Gitlab instances with ease.
- Calculates code contribution statistics for each user in a Gitlab instance.
- Efficiently handles large-scale Gitlab instances.
- Provides accurate and detailed code contribution information.
This tool is highly optimized for performance. On our enterprise Gitlab instance with 2100 projects and 350 users, it only takes approximately 120 seconds to calculate the code contribution statistics for an entire year.
To use this tool, you need to have Rust installed on your system. You can then clone this repository and build the project. After building the project, you need to configure the settings in the .env
file. Once the .env
file is configured, you can run the tool.
# Clone the repository
git clone [https://github.com/lmlinux/gitlab-code-counter.git]
# Build the project
cd gitlab-code-counter
cargo build --release
Modify the .env config file with the following settings:
# URL of your Gitlab instance, e.g.: http://gitlab.example.com
GITLAB_URL=http://192.168.0.10
# Private token (Personal Access Token) for accessing the Gitlab API, requires sufficient permissions
TOKEN=xxxxxx
# Name of the branch to be analyzed
BRANCH=master
# Start date for the analysis, in ISO 8601 format, e.g.: 2023-01-01T00:00:00Z
START_DATE=2023-01-01T00:00:00Z
# End date for the analysis, in ISO 8601 format, e.g.: 2023-12-31T23:59:59Z
END_DATE=2023-12-31T23:59:59Z
# Maximum number of concurrent requests to control the frequency of accessing the Gitlab API and avoid overloading
MAX_CONCURRENT_REQUESTS=100