= Collecting Bug Statistics = == Use Cases == === Transition Over Time Graphs === For groups of bugs (bugs on a particular target, for example), it is useful to know how long does it take for bugs to transition from one status to another. In particular, the following transitions are interesting: * NEW to TRIAGED (to track the work of the QA team) * TRIAGED TO FIXCOMMITTED (to track the work of the development team) * NEW to date_linked_upstream (to track forwarding bugs upstream) * Duration in INCOMPLETE (to track the community response to requests for information) These transitions are best displayed as a graph where one axis displays the number, or percentage of bugs, and the other axis displays the time interval (in fixed units of time). The values for several different targets, or several periods within the same target, can be displayed in the same graph. {{attachment:time-to-triaged.png}} === Bugs Timeline === A graph of the numbers of bugs in each status over time. One axis shows the number or precentage of bugs, and the other axis shows the flow of time. Several different statuses can be layered. {{attachment:openoffice.org-month-triage.png}} == Schema Changes == Add the following field to the BugTask table. * date_linked_upstream - The date on which this bug task was linked to an upstream bug for the first time * date_importance_set - The date on which this bug task's importance was set for the first time Add a new table BugTaskStatusTransitions. * bugtask * status * date_entered * date_left == Code Changes == === Date Linked Upstream === Record date_linked_upstream when the upstream bugtask for this (ubuntu) bugtask is linked to a bugwatch (or when the upstream bug task is created, for projects that use launchpad for bug tracking). === Date Importance Set === Record date_importance_set when the bug task's importance is set for the first time (from transitionToImportance). === Bug Task Status Transitions === When transitioning to a new bug task status, set the date_left of the last BugTaskStatusTransitions record and insert a new record for the new status with date_entered set to NOW. === Querying Status History === Add a new method, HasBugs.getStatusStatistics(from_date, to_date) which returns a sequence of entries for each day, with mappings from status to number of bugs. For example: {{{ {'2008-08-01': { 'NEW': 21, 'CONFIRMED': 45, ... }, ... } }}} === Querying Status Durations === Add the following methods: * HasBugs.getTimeToTriaged(from_date, to_date) * HasBugs.getTimeToClosed(from_date, to_date) * HasBugs.getTimeToLinkUpstream(from_date, to_date) * HasBugs.getTimeToSetImportance(from_date, to_date) * HasBugs.getTimeInIncomplete(from_date, to_date) Each of these methods returns a mapping from days to bug numbers (only positive integers). For example: {{{ {1: 89, 2: 54, 3: 34, 4: 22, 5: 11, 6: 5} }}}