GitLab-Stats is a command-line interface that gathers GitLab metrics from a specified instance. It requires a GitLab hostname and token to authenticate to the instance. The tool outputs the results to a CSV file with a default filename of gitlab-stats-YYYY-MM-DD-HH-MM-SS.csv
. Give it a try and see what metrics you can gather!
- GitHub CLI
- Go 1.21 or higher
- A GitLab Server (tested on v16.2.4) (Note: This tool is not compatible with
GitLab.com
)
Name | Description | Required | Default |
---|---|---|---|
hostname |
The hostname of the GitLab instance to gather metrics from. E.g https://gitlab.company.com |
Yes | N/A |
token |
The token to use to authenticate to the GitLab instance. | Yes | N/A |
output-file |
The output file name to write the results to. | No | gitlab-stats-YYYY-MM-DD-HH-MM-SS.csv |
groups |
A comma-separated list of groups to gather metrics from. | No | "" |
gh extension install mona-actions/gh-gitlab-stats
- Run the tool:
gh gitlab-stats --hostname <hostname> --token <token> --output-file <filename>
gh extension upgrade gitlab-stats
gh gitlab-stats --help
gh cli extension for analyzing GitLab Instance to get migration statistics of
repositories, issues...
Usage:
gh gitlab-stats [flags]
Flags:
-g, --groups string The specific groups to gather metrics from. E.g group1,group2,group3
-h, --help help for gh
-s, --hostname string The hostname/server of the GitLab instance to gather metrics from E.g https://gitlab.company.com
-f, --output-file string The output file name to write the results to (default "gitlab-stats-YYYY-MM-DD-HH-MM-SS.csv")
-t, --token string The token to use to authenticate to the GitLab instance
The following permissions are required to run gitlab-stats
, take into account that you will need to be an admin to get the full list of projects:
api
- Grants read-only access to the API, including all groups and projects, issues, merge requests, and the GraphQL APIread_user
- Grants read-only access to the authenticated user's profile through the /user API endpoint, including username, public email, and full nameread_repository
- Grants read-only access to repositories, including private repositories
gitlab-stats
outputs the following metrics to a CSV file:
Namespace Name,Project_Name,Is_Empty,Last_Push,Last_Update,isFork,Repository_Size(mb),Record_Count,Collaborator_Count,Protected_Branch_Count,MR_Review_Count,Milestone_Count,Issue_Count,MergeRequest_Count,MR_Review_Comment_Count,Commit_Comment_Count,Issue_Comment_Count,Issue_Event_Count,Release_Count,Issue_Board_Count,Branch_Count,Tag_Count,Discussion_Count,Has Wiki,Full_URL,Migration_Issue
theleafvillage/hyuga,neji,false,2023-08-31T22:08:34Z,2023-08-31T22:08:33Z,false,0,2,2,1," Mr Review Count To be implemented",0,0,0,0,0,0,N\A,0,0,1,0,N\A,false,http://gitlab-amenocal.expert-services.io/theleafvillage/hyuga/neji
thesandvillage,gara,false,2023-08-31T22:07:10Z,2023-08-31T22:07:10Z,false,0,2,1,1," Mr Review Count To be implemented",0,0,0,0,0,0,N\A,0,0,1,0,N\A,false,http://gitlab-amenocal.expert-services.io/thesandvillage/gara
theleafvillage,repo10,false,2023-01-24T16:22:59-06:00,2023-08-24T17:57:27Z,false,0,5,2,1," Mr Review Count To be implemented",0,3,0,0,0,0,N\A,0,0,1,0,N\A,false,http://gitlab-amenocal.expert-services.io/theleafvillage/repo10
theleafvillage,repo9,false,2023-01-24T16:22:59-06:00,2023-08-24T17:57:26Z,false,0,5,2,1," Mr Review Count To be implemented",0,3,0,0,0,0,N\A,0,0,1,0,N\A,false,http://gitlab-amenocal.expert-services.io/theleafvillage/repo9
theleafvillage,repo8,false,2023-01-24T16:22:59-06:00,2023-08-24T17:57:26Z,false,0,5,2,1," Mr Review Count To be implemented",0,3,0,0,0,0,N\A,0,0,1,0,N\A,false,http://gitlab-amenocal.expert-services.io/theleafvillage/repo8
theleafvillage,repo7,false,2023-01-24T16:22:59-06:00,2023-08-24T17:57:25Z,false,0,5,2,1," Mr Review Count To be implemented",0,3,0,0,0,0,N\A,0,0,1,0,N\A,false,http://gitlab-amenocal.expert-services.io/theleafvillage/repo7
Namespace_Name
: Namespace path of the ProjectRepo_Name
: Repository nameIs_Empty
: Whether the repository is emptyLast_Push
: Date/time when a push was last made to the default branchLast_Update
: Date/time when an update was last madeisFork
: Whether the repository is a forkRepo_Size(mb)
: Size of the repository in megabytesRecord_Count
: Number of database records this repository representsCollaborator_Count
: Number of users who are members to this repositoryProtected_Branch_Count
: Number of protected branchesMR_Review_Count
: To be implementedMilestone_Count
: Number of milestonesIssue_Count
: Number of issuesMergeRequest_Count
: Number of Merge requestsMR_Review_Comment_Count
: Number of merge request commentsCommit_Comment_Count
: Number of commit commentsIssue_Comment_Count
: Number of issue commentsIssue_Event_Count
: "N\A"Release_Count
: Number of releasesIssue_Board_Count
: Number of Issue BoardsBranch_Count
: Number of branchesTag_Count
: Number of tagsDiscussion_Count
: "N\A"Has_Wiki
: Whether the repository has wiki feature enabled; unable to tell whether user via APIFull_URL
: Repository URLMigration_Issue
: Indicates whether the repository might have a problem during migration due to- 60,000 or more number of objects being imported
- 1.5 GB or larger size on disk
- Watch out for RateLimiting when running this tools. Extensive testing hasn't been done.
- Some metrics are not exported due to them not being available or need to be implemented. See in columns section.