GithubHelp home page GithubHelp logo

jenkinsci / additional-metrics-plugin Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 10.0 260 KB

Provides additional metrics for List Views

Home Page: https://plugins.jenkins.io/additional-metrics/

License: MIT License

Java 100.00%
jenkins metrics

additional-metrics-plugin's Introduction

Additional Metrics Plugin

Jenkins Plugin Jenkins Plugin Installs Build Status

Provides additional metrics via columns in Jenkins' List View.

Provided Metrics

  • Minimum, Maximum, Average, and Standard Deviation build times for all, or only successful builds.
  • Minimum, Maximum, and Average checkout times for Pipeline builds.
  • Success, Failure, and Unstable rates.
  • Success and Failure time rates (ie Uptime and Downtime).

REST API

All provided metrics are also exposed in the Job's REST API as a job Action.

Examples

Single Job
JSON

There is no filtering in JSON tree that I am aware of. Nevertheless, you can still do:

<JENKINS_URL>/api/json?depth=3&tree=jobs[fullName,actions[jobMetrics[*]]]

And then do the filtering post execution. You may need to adjust the depth, depending on how deeply nested your project is.

XML

Using XPath, it is possible to get the metrics for one project. You may need to adjust the depth, depending on how deeply nested your project is.

<JENKINS_URL>/api/xml?depth=4&xpath=(//job[fullName='github/repo1/master']/action/jobMetrics[node()])[1]
<?xml version="1.0" encoding="UTF-8"?>
<jobMetrics>
   <avgCheckoutDuration>0</avgCheckoutDuration>
   <avgDuration>446</avgDuration>
   <avgSuccessDuration>240</avgSuccessDuration>
   <failureRate>0.125</failureRate>
   <failureTimeRate>0.00000711702773729547-5</failureTimeRate>
   <maxCheckoutDuration>0</maxCheckoutDuration>
   <maxDuration>3024</maxDuration>
   <maxSuccessDuration>1961</maxSuccessDuration>
   <minCheckoutDuration>0</minCheckoutDuration>
   <minDuration>45</minDuration>
   <minSuccessDuration>45</minSuccessDuration>
   <standardDeviationDuration>819</standardDeviationDuration>
   <standardDeviationSuccessDuration>493</standardDeviationSuccessDuration>
   <successRate>0.875</successRate>
   <successTimeRate>0.9999928829722644</successTimeRate>
   <unstableRate>0.875</unstableRate>
</jobMetrics>
List View / Build Monitor View

Assuming the view name is MyView,

<JENKINS_URL>/view/MyView/api/json?tree=jobs[fullName,actions[jobMetrics[*]]]

You will get an output similar to the below (modified for clarity):

{
  "_class": "com.smartcodeltd.jenkinsci.plugins.buildmonitor.BuildMonitorView",
  "jobs": [
    {
      "_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
      "actions": [
        {
          "_class": "org.jenkinsci.plugins.additionalmetrics.MetricsActionFactory$MetricsAction",
          "jobMetrics": {
            "avgCheckoutDuration": 19581,
            "avgDuration": 2641447,
            "avgSuccessDuration": 394148,
            "failureRate": 0.75,
            "failureTimeRate": 0.09493349090072016,
            "maxCheckoutDuration": 24734,
            "maxDuration": 3439386,
            "maxSuccessDuration": 394148,
            "minCheckoutDuration": 8226,
            "minDuration": 394148,
            "minSuccessDuration": 394148,
	    "standardDeviationDuration": 42447,
            "standardDeviationSuccessDuration": 71238,
            "successRate": 0.25,
            "successTimeRate": 0.9050665090992799, 
            "unstableRate": 0
          }
        }
      ],
      "fullName": "github/repo1/master"
    },
    {
      "_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
      "actions": [
        {
          "_class": "org.jenkinsci.plugins.additionalmetrics.MetricsActionFactory$MetricsAction",
          "jobMetrics": {
            "avgCheckoutDuration": 34089,
            "avgDuration": 316825,
            "avgSuccessDuration": 316825,
            "failureRate": 0,
            "failureTimeRate": 0,
            "maxCheckoutDuration": 43413,
            "maxDuration": 443877,
            "maxSuccessDuration": 443877,
            "minCheckoutDuration": 24766,
            "minDuration": 189773,
            "minSuccessDuration": 189773,
	    "standardDeviationDuration": 8089,
	    "standardDeviationSuccessDuration": 3014,
            "successRate": 1,
            "successTimeRate": 1, 
            "unstableRate": 0
          }
        }
      ],
      "fullName": "github/repo2/master"
    }
  ]
}

Requirements

Jenkins 2.289.3 or later.

Building

mvn package

Snapshot builds are available here.

additional-metrics-plugin's People

Contributors

basil avatar chadiem avatar dainerx avatar daniel-beck-bot avatar jetersen avatar markewaite avatar rahulsom avatar renovate[bot] avatar strangelookingnerd avatar timja avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

additional-metrics-plugin's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/cd.yaml
  • jenkins-infra/github-reusable-workflows v1
.github/workflows/jenkins-security-scan.yml
  • jenkins-infra/jenkins-security-scan v2
maven
.mvn/extensions.xml
  • io.jenkins.tools.incrementals:git-changelist-maven-extension 1.8
pom.xml
  • org.jenkins-ci.plugins:plugin 4.85
  • io.jenkins.tools.bom:bom-2.361.x 2102.v854b_fec19c92
  • org.reflections:reflections 0.10.2
maven-wrapper
.mvn/wrapper/maven-wrapper.properties
  • maven 3.9.8

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.