# Lead times

Lead times is the first thing you see when you go to the dashboard, and represents the time it takes for your organization to deliver value to your customers after the work is already done.

In AccidentalQuality it looks something like this:

graph LR
    A((Pipeline A)) --> B((Integration 1))
    A --> E((Integration 2))
    C((Pipeline B)) --> B
    B --> D((Release))

What you get when you query it is the time it takes for a commit handed over to a given pipeline, to reach its release point or final pipeline.

This is usually referred to as lead time for code (not to be confused with business lead time, which is the journey from idea to customer).

Given an id, you can get lead times:

curl -H "X-API-Key: <your token goes here>" \
fetch('https://api.accidentalquality.com/api/lead_times/<project_id>', {
  method: "GET",
  headers: {"Content-type": "application/json;charset=UTF-8", "X-API-Key": "<your-token-goes-here>"}
.then(response => response.json()) 
.then(json => console.log(json)) 
.catch(err => console.log(err));

The data returned is in json format and structured as follows:

  • unit (string)- Unit of the data displayed in the data array
  • data (array)
    • name (string) - Pipeline's name
    • lead_times (array) - The collection of lead times.
      • path (string) - If the pipeline has multiple parents (also downstream) then lead time will vary. Path tells the alternate route taken, through a parent node.
      • lead_time (float) - The time it takes for a commit pushed to this pipeline to make its way the whole way through

Example (based on the previous graph):

        "data_name": "Lead times",
        "unit": "minutes",
        "data": [
                "name": "Pipeline A", 
                "lead_times": [
                        "path": "", 
                        "lead_time": 12.0
                        "path": "Integration 2",
                        "lead_time": 21.0