GithubRepoAnalyzer is a script that analyze the views/clones of a github repository and saves them in JSON file.
You can even visualize with a chart the views/clones of a specific directory.
RepoAnalyzer file is the script used to analyze all the stats of the repository that are in the repo.json file.
The stats are saved in the RepoData.json file.
DisplayStats file is the script used to visualize in a chart the stats of a specific repository (last 14 days).
Example:

Menu file is the script used to use an interact menù.
ConvertJsonSQL file is used to convert the Json file into a MySQL DB
To use GithubRepoAnalyzer you need to:
- Have python installed
- Make a virtualenv: virtualenv "project"
- Install the dependencies on the virtualenv: pip install -r requirements.txt
At this point you can add repo to the repo.json file manually or with the menù option.
Fill the config.json file with the information needed -> You need to generate a githubAccessToken first!
Then you can save the stats with the RepoAnalyzer script or display the stats saved with the DisplayStats script.
- Configure your MySQL and create a DB for the GithubStats data, the name it's not important.
- Configure the created DB tables
CREATE TABLE `Repository` (
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;CREATE TABLE `Clones` (
`RepoName` varchar(255) NOT NULL,
`clone_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`clone_n_uniques_users` int(11) NOT NULL,
`n_clones` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;CREATE TABLE `Views` (
`RepoName` varchar(255) NOT NULL,
`view_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`view_n_uniques_users` int(11) NOT NULL,
`n_views` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;- Configure "ConvertJsonSQL" file with the correct data:
- Host = localhost or databaseHost
- Database = DB name
- User = Username
- Password = User password
- Run the Python file, now you should see the data in the Database
- Install Grafana and open it, in localhost should be: localhost:3000
- Configure Grafana (IMPORTANT: CREATE A NEW READ-ONLY DB USER AND USE IT FOR GRAFANA!)
- Settings -> Add Data Source -> MySQL -> Give a name and fill the MySQL connection settings (WITH READ-ONLY USER DATA)
- Go to "create" -> "add an empty panel" -> Select as Data source your DB -> Adjust the query as you want!
- SAVE
- Finish! Now you should see it in the "DashBoard" panel!
