Jenkins - Metrics & Trends


Advertisements

There are various plugins which are available in Jenkins to showcase metrics for builds which are carried out over a period of time. These metrics are useful to understand your builds and how frequently they fail/pass over time. As an example, let’s look at the ‘Build History Metrics plugin’.

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

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

Step 1 − Go to the Jenkins dashboard and click on Manage Jenkins

Welcome to Jenkins

Step 2 − Go to the Manage Plugins option.

Metrics Trends Manage Plugins1

Step 3 − Go to the Available tab and search for the plugin ‘Build History Metrics plugin’ and choose to ‘install without restart’.

Install Without Restart1

Step 4 − The following screen shows up to confirm successful installation of the plugin. Restart the Jenkins instance.

Installation Success Confirmation1

When you go to your Job page, you will see a table with the calculated metrics. Metric’s are shown for the last 7 days, last 30 days and all time.

Metrics Table

To see overall trends in Jenkins, there are plugins available to gather information from within the builds and Jenkins and display them in a graphical format. One example of such a plugin is the ‘Hudson global-build-stats plugin’. So let’s go through the steps for this.

Step 1 − Go to the Jenkins dashboard and click on Manage Jenkins

Hudson Global Build Stats

Step 2 − Go to the Manage Plugins option

Metrics Trends Manage Plugins2

Step 3 − Go to the Available tab and search for the plugin ‘Hudson global-build-stats plugin’ and choose to ‘install without restart’.

Install Without Restart2

Step 4 − The following screen shows up to confirm successful installation of the plugin. Restart the Jenkins instance.

Installation Success Confirmation2

To see the Global statistics, please follow the Step 5 through 8.

Step 5 − Go to the Jenkins dashboard and click on Manage Jenkins. In the Manage Jenkins screen, scroll down and now you will now see an option called ‘Global Build Stats’. Click on this link.

Global Build Stats

Step 6 − Click on the button ‘Initialize stats’. What this does is that it gather’s all the existing records for builds which have already been carried out and charts can be created based on these results.

Initialize Stats

Step 7 − Once the data has been initialized, it’s time to create a new chart. Click on the ‘Create new chart’ link.

Create New Chart

Step 8 − A pop-up will come to enter relevant information for the new chart details. Enter the following mandatory information

  • Title – Any title information, for this example is given as ‘Demo’
  • Chart Width – 800
  • Chart Height – 600
  • Chart time scale – Daily
  • Chart time length – 30 days

The rest of the information can remain as it is. Once the information is entered, click on Create New chart.

Adding New Chart

You will now see the chart which displays the trends of the builds over time.

Displaying Trends

If you click on any section within the chart, it will give you a drill down of the details of the job and their builds.

Global Build Search
Advertisements