Calculate MTBF/MTTF Mean time between/to failure for a visualization

Hi @chrisronline,

I just double checked the issue was this one and I seem to have recollected it wrong - it only vaguely touches the topic.

Sample job data:

ES job index entry
 {
    "_index": "test-jobs-old",
    "_type": "doc",
    "_id": "yL_j1WMBkhQDVC7mqY67",
    "_score": 1,
    "_source": {
      "displayName": "GroovyTester_Pipeline",
      "@timestamp": "2018-06-06T16:17:25.649Z",
      "description": "",
      "lastSuccessfulBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/23/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 23
      },
      "firstBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/1/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 1
      },
      "concurrentBuild": true,
      "resumeBlocked": false,
      "keepDependencies": false,
      "beat": {
        "name": "dashboard",
        "hostname": "dashboard",
        "version": "6.2.4"
      },
      "healthReport": {
        "buildStability": {
          "remark": "4 out of the last 5 builds failed.",
          "score": 20
        }
      },
      "fullName": "GroovyTester_Pipeline",
      "nextBuildNumber": 24,
      "inQueue": false,
      "parameterDefinitions": {},
      "url": "https://bla.com/job/GroovyTester_Pipeline/",
      "lastStableBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/23/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 23
      },
      "fullDisplayName": "GroovyTester_Pipeline",
      "lastUnsuccessfulBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/22/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 22
      },
      "name": "GroovyTester_Pipeline",
      "lastCompletedBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/23/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 23
      },
      "host": "dashboard",
      "buildable": true,
      "offset": 1394532,
      "prospector": {
        "type": "log"
      },
      "color": "blue",
      "actions": [
        "hudson.plugins.jobConfigHistory.JobConfigHistoryProjectAction",
        "com.cloudbees.plugins.credentials.ViewCredentialsAction",
        "hudson.plugins.buildblocker.BuildBlockerProperty",
        "com.sonyericsson.rebuild.RebuildSettings",
        "com.synopsys.arc.jenkinsci.plugins.jobrestrictions.jobs.JobRestrictionProperty",
        "org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty"
      ],
      "lastFailedBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/22/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 22
      },
      "tags": [
        "json",
        "jenkins",
        "jobs",
        "init",
        "beats_input_raw_event"
      ],
      "builds": [
        "https://bla.com/job/GroovyTester_Pipeline/23/",
        "https://bla.com/job/GroovyTester_Pipeline/22/",
        "https://bla.com/job/GroovyTester_Pipeline/21/",
        "https://bla.com/job/GroovyTester_Pipeline/20/",
        "https://bla.com/job/GroovyTester_Pipeline/19/",
        "https://bla.com/job/GroovyTester_Pipeline/18/",
        "https://bla.com/job/GroovyTester_Pipeline/17/",
        "https://bla.com/job/GroovyTester_Pipeline/16/",
        "https://bla.com/job/GroovyTester_Pipeline/15/",
        "https://bla.com/job/GroovyTester_Pipeline/14/",
        "https://bla.com/job/GroovyTester_Pipeline/13/",
        "https://bla.com/job/GroovyTester_Pipeline/12/",
        "https://bla.com/job/GroovyTester_Pipeline/11/",
        "https://bla.com/job/GroovyTester_Pipeline/10/",
        "https://bla.com/job/GroovyTester_Pipeline/9/",
        "https://bla.com/job/GroovyTester_Pipeline/8/",
        "https://bla.com/job/GroovyTester_Pipeline/7/",
        "https://bla.com/job/GroovyTester_Pipeline/6/",
        "https://bla.com/job/GroovyTester_Pipeline/5/",
        "https://bla.com/job/GroovyTester_Pipeline/4/",
        "https://bla.com/job/GroovyTester_Pipeline/3/",
        "https://bla.com/job/GroovyTester_Pipeline/2/",
        "https://bla.com/job/GroovyTester_Pipeline/1/"
      ],
      "lastBuild": {
        "url": "https://bla.com/job/GroovyTester_Pipeline/23/",
        "class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
        "number": 23
      },
      "source": "/srv/jenkins_data/init_jobs_log_2018-06-06_163617.json",
      "@version": "1",
      "class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
      "property": []
    }
  }