Compute the four DORA metrics for StudyBuddy from its deployment log.
Input: first line days n — the length of the period in days and the number of deployments. Then n lines, each:
leadTimeHours result [restoreMinutes]
where result is OK or FAIL; a FAIL line has a third number, the minutes needed to restore service.
Print:
Deployments: n
Deployment frequency: X per week
Average lead time: Y hours
Change failure rate: Z%
Mean time to restore: W minutes
- frequency =
n * 7 / days, two decimals; - average lead time: two decimals (
0.00ifnis 0); - change failure rate: failures × 100 / n, one decimal (
0.0ifnis 0); - mean time to restore: average of the restore minutes of the failures, one decimal, or
n/aif there were no failures.
Input:
14 5
2 OK
4 OK
1 FAIL 90
3 OK
5 FAIL 30
Output:
Deployments: 5
Deployment frequency: 2.50 per week
Average lead time: 3.00 hours
Change failure rate: 40.0%
Mean time to restore: 60.0 minutes