How to Calculate Developer Productivity Metrics Using MergeStat and DevZero
Vishal Pallerla•

While we have previously discussed the significance of metrics in evaluating developer performance in our blog post, Measuring Developer Productivity to Maximizing Software Engineering Success, we understand that applying these concepts practically might appear challenging. To make this transition smoother, we have come up with a detailed guide on how to actually calculate some of these crucial metrics using MergeStat
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.

4. Click Launch and it will take you to your console where it starts creating your workspace.

5. After a few minutes, your development environment with MergeStat is ready to go.

6. Your environment is now set up and you are ready to go. Click on the 3 dots and select Share

7. Select port 3300 and then click Create link

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.

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/mergestat
11. Now, as mergestat mentions in their Getting Started guide, run the command
docker-compose up

12. When the app is up, go to the share link you created in Step 8.

Login with the following credentials
Database user: postgres
Database password: password
13. Once logged in, you should be able to access the MergeStat UI.
You ca check the queries for metrics under Queries -> Saved Queries

14. In order to run any queries, you first need to add a Git Source and Repos.


Then, add any repo URL you want to analyze 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.

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.

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.

Vishal Pallerla
Developer Advocate, DevZero