What is MergeStat? #
MergeStat is an open-source tool that enables SQL queries on the tools and processes involved in building and shipping software. It allows you to treat your code and configuration files like a database to operationalize aspects of the software development lifecycle (SDLC). MergeStat can run on most infrastructure and is fully self-deployable, ensuring security and privacy
Initially, MergeStat was a project known as Gitqlite. It aimed to streamline the process of querying historical data in code repositories by melding SQLite and Git.
MergeStat is about garnering insights from information that may be spread across different codebases and developer teams.
What is DevZero? #
DevZero is a cloud-based development platform that offers developers the ability to create and manage their own development environments quickly and easily. It allows developers to develop and test their applications in environments that closely resemble the production environment, helping them ship code faster with more confidence.
Learn more about DevZero and why you should check it out
Using MergeStat with DevZero to calculate Metrics #
1. If you haven’t yet, Create a DevZero account with our simple Get Started flow.
2. Check here for more information on how to create and set up your DevZero account and customize it further.
3. Once signed in to DevZero Console, Create a copy of MergeStat template using this link or from the dashboard.
Launch MergeStat with DevZero
4. Click Launch and it will take you to your console where it starts creating your workspace.
MergeStat workspace build in progress
5. After a few minutes, your development environment with MergeStat is ready to go.
MergeStat in DevZero is ready
6. Your environment is now set up and you are ready to go. Click on the 3 dots and select Share
Share MergeStat
7. Select port 3300 and then click Create link
Share link creation
Make a note of this link as you will need it later.
8. Select Open in Web Browser . You should see your environment fully set up.
MergeStat Template in VS Code for the Web
9. Open Terminal from the UI or with the shortcut (Ctrl + ` OR CMD+Shift+`)
10. Make sure you are already in the mergestat folder and if not, navigate to the mergestat project folder
cd /home/devzero/projects/mergestatCopy
11. Now, as mergestat mentions in their Getting Started guide, run the command
docker-compose upCopy
running docker-compose up
12. When the app is up, go to the share link you created in Step 8.
MergeStat Login Page
Login with the following credentials
Database user: postgres
Database password: passwordCopy
13. Once logged in, you should be able to access the MergeStat UI.
You ca check the queries for metrics under Queries -> Saved Queries
Queries to calculate various metrics pre-populated in saved queries
14. In order to run any queries, you first need to add a Git Source and Repos.
Add a new git source
Adding a git source
Then, add any repo URL you want to analyze and save.
Add repo url and save
NOTE: if you'd like to make use of GitHub API data (any sync type that uses the GitHub API including repo auto imports) or any private GitHub repos you will need to supply a GitHub personal access token.
15. Following the instructions here, add your PAT with necessary permissions based on if you provided a public or private repository URL.
16. Then, click on the added repo and sync the data you are interested in. For the metrics queries we have in saved queries, you would require data from the following syncs as shown in the image.
repo syncs
Once the data is synchronized, proceed to saved queries, run them and check the results for yourself. You can add your own queries or modify existing queries.
analyzing merge trends for the mergestat repo
How to contribute to MergeStat using DevZero? #
If you are interested in contributing to MergeStat project, the DevZero environment you created will be able to help. All you need to do is check out the contributing.md file and follow the instructions.
Conclusion #
By measuring these metrics and utilizing the features and benefits of MergeStat and DevZero, you can gain valuable insights into your development team's productivity and make informed decisions to improve their performance.