Jenkins – Metrics and Trends
Jenkins provides many plugins to present the metrics for builds which are carried out over a period of time. These metrics are useful to see the build and to understand how frequently they fail/pass over time.
Let’s see the “Build History Metrics Plugin”, this plugin is used to calculate the following metrics for all of the builds once installed:
- MTTF (Metrics Time to Failure)
- MTTR (Mean Time to Recovery)
- Standard Deviation of Build Times
Step 1: First, go to Jenkins Dashboard and then click on Manage Jenkins.
Step 2: Then select Manage Plugins.
Step 3: On the Available tab, filter for the Build History Metrics plugin and select install without restart button.
Step 4: The following screen is showing the installation process and success of the installation of plugins.
After successful installation, click on Go back to the top page.
Step 5: Select any job and go to that job page. When you go to that job page, you will see a table with the calculated metrics. Metrics are displayed for the last 7 days, last 30 days and all time.
Trends in Jenkins
To see the overall Trends, Jenkins provides many plugins like Build-metrics plugin. This plugin is used to gather the information from within the builds and Jenkins and display them in a graphical format.
Step 1: Go to the Jenkins Dashboard.
Step 2: Select the Manage Plugins option.
Step 3: Go to the Available tab then search for “build-metrics” in the filter option and click on Install without restart button.
Step 4: The following screen is showing the installation process and success of the installation of plugins.
After successful installation of plugins, click on Go back to the top page link.
Step 5: Now go to the Jenkins Dashboard and click on Manage Jenkins.
Step 6: Scroll down, and now you will see an option called “Global Build Stats”. Click on this option.
Step 7: Click on the Initialize stats button. This button is used to gather all the existing records for builds which have already been carried out, and charts can be created based on these results. Once you click this button, you will see a text “data successful initialized“.
Step 8: Once the data has been initialized, it is the time to create a new chart. To create the new chart, click on “Create new chart configuration” link.
Step 9: When you enter that link, a pop up will appear. Enter all the information for the new chart details. Enter the following information which is mandatory:
- Title – give any label, I have given “Result”
- Chart Width – 600
- Chart Height – 500
- Chart time scale – Daily
- Chart time length – 30 days
You can leave the rest of the information as it is. Once the information is entered, select the Create new chart button.
Here, it will display the trends of the build over time.
If you click on any section of the chart, it will show you a drill-down of the details of the job and their builds.