# Bug longevity (age)

The life cycle of a bug, its age, is indicative of a lot more than it might first appear. A bug gets harder to fix with time, as context and root cause gets obscured and the lines of code in the codebase around it grows.

Tracking the age of bugs in your codebase tells you wether it is worth spending time on quality, or if you are losing the battle to bad prioritization. Very old bugs are usually better off closed as "won't fix", as the price gets overwhelming.

Given an id for an integration (with type Jira), you can query bug ages like so:

curl -H "X-API-Key: <your token goes here>" \
https://api.accidentalquality.com/api/bug_ages/<integration_id>
fetch('https://api.accidentalquality.com/api/bug_ages/<integration_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)
    • x string - Date for the datapoint in format yyyy-mm-dd
    • y float - The average age of all bugs on that given day. Closing the bug will lead to a decrease in the age after its closing.

Example:

    {
        "unit":"Date/Average age in days",
        "data": [
            {
                "x": "1990-01-01",
                "y": 12.3
            },
            {
                "x": "1990-01-02",
                "y": 12.123
            },
            ...
        ]
    }