Build History Metrics in Jenkins

HOME

Jenkins includes a number of plugins for displaying metrics for builds that take place over time. These metrics can help you understand your builds and how often they fail/pass over time. Consider the ‘Build History Metrics plugin‘ as an example.

What is Build History Plugin?

This plugin calculates the following metrics for all of your builds once installed:

  • Mean Time To Failure (MTTF)
  • Mean Time To Recovery (MTTR)
  • Standard Deviation of Build Times

The calculated metrics are displayed in a table on each jobs page showing the metric for the last 7 days, last 30 days, and all time.

How to install the metric-related plugin in Jenkins?

Implementation Steps

Step 1: Start the Jenkins server and open the browser and navigate to the localhost and the port in which Jenkins is running

http://localhost:8080/

Step 2: Log in to Jenkins UI

Provide a username and password and click on the Sign-in Button.

Step 3: Download and Install Build History Metrics Plugin

Click on the Manage Jenkins. Choose Manage Plugins.

Step 4: Add the Build History Metrics Plugin

On the Plugins Page, go to the Available option.

  1. Select the Build History Metrics Plugin
  2. Click on Install without restart. The plugin will take a few moments to finish downloading depending on your internet connection, and will be installed automatically.
  3. You can also select the option Download now and Install after the restart button. In which plugin is installed after the restart
  4. You will be shown a “No updates available” message if you already have the TestNG Report plugin installed.

Step 5: Restart Jenkins

Click on the checkbox “Restart Jenkins when installation is complete when no jobs are running“.

 For verification of the successful installation of the plugin, we can go to the “installed”  tab, and we can see the presence of the build history metrics plugin.

How to view metrics in Jenkins?

Step 1: Go to the Jenkins dashboard and click on any job. Here we can see the metrics like MTTR, MTTF, and Standard deviation in the tabular form highlighted below.

Note: If, after installing the plugin below, the tabular form does not display, then restart Jenkins.

Metrics are shown for the last 7 days, last 30 days, and all time.

Step 2: Run any job for which the build is showing as failed status, and then we can see the time for MTTR and MTTF as mentioned in the below image.

Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s