-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
422 additions
and
66 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
[ | ||
{ | ||
"ID": "1", | ||
"label": "Incident 1", | ||
"title": "Incident 1", | ||
"difficulty": "4", | ||
"description": "MySQL master does not accept writes" | ||
"scenario": "MySQL master does not accept writes" | ||
}, | ||
{ | ||
"ID": "2", | ||
"label": "Incident 2", | ||
"title": "Incident 2", | ||
"difficulty": "2", | ||
"description": "Load balancer is down" | ||
"scenario": "Load balancer is down" | ||
}, | ||
{ | ||
"ID": "3", | ||
"label": "Incident 3", | ||
"title": "Incident 3", | ||
"difficulty": "5", | ||
"description": "Blob storage system is unable to store objects" | ||
"scenario": "Blob storage system is unable to store objects" | ||
}, | ||
{ | ||
"ID": "4", | ||
"label": "Incident 4", | ||
"title": "Incident 4", | ||
"difficulty": "4", | ||
"description": "DC eu-1 has a power outage" | ||
"scenario": "DC eu-1 has a power outage" | ||
}, | ||
{ | ||
"ID": "5", | ||
"label": "Incident 5", | ||
"title": "Incident 5", | ||
"difficulty": "3", | ||
"description": "Redis server is randomly killed" | ||
"scenario": "Redis server is randomly killed" | ||
}, | ||
{ | ||
"ID": "6", | ||
"label": "Incident 6", | ||
"title": "Incident 6", | ||
"difficulty": "2", | ||
"description": "High HTTP 5xx error rate" | ||
"scenario": "High HTTP 5xx error rate" | ||
}, | ||
{ | ||
"ID": "7", | ||
"label": "Incident 7", | ||
"title": "Incident 7", | ||
"difficulty": "1", | ||
"description": "High query latency in the RPC server" | ||
"scenario": "High query latency in the RPC server" | ||
}, | ||
{ | ||
"ID": "8", | ||
"label": "Incident 8", | ||
"title": "Incident 8", | ||
"difficulty": "4", | ||
"description": "LDAP clients cannot query LDAP server" | ||
"scenario": "LDAP clients cannot query LDAP server" | ||
} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* Kudos to Billy Brown: https://codepen.io/_Billy_Brown/pen/dbJeh */ | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Stopwatch = function () { | ||
function Stopwatch(display, results) { | ||
_classCallCheck(this, Stopwatch); | ||
this.running = false; | ||
this.display = display; | ||
this.results = results; | ||
this.laps = []; | ||
this.reset(); | ||
this.print(this.times); | ||
} _createClass(Stopwatch, [{ | ||
key: 'reset', value: function reset() { | ||
this.times = [0, 0, 0]; | ||
} | ||
}, { | ||
key: 'start', value: function start() { | ||
if (!this.time) this.time = performance.now(); | ||
if (!this.running) { | ||
this.running = true; | ||
requestAnimationFrame(this.step.bind(this)); | ||
} | ||
} | ||
}, { | ||
key: 'lap', value: function lap() { | ||
var times = this.times; | ||
var li = document.createElement('li'); | ||
li.innerText = this.format(times); | ||
this.results.appendChild(li); | ||
} | ||
}, { | ||
key: 'stop', value: function stop() { | ||
this.running = false; | ||
this.time = null; | ||
} | ||
}, { | ||
key: 'restart', value: function restart() { | ||
if (!this.time) this.time = performance.now(); | ||
if (!this.running) { | ||
this.running = true; | ||
requestAnimationFrame(this.step.bind(this)); | ||
} | ||
this.reset(); | ||
} | ||
}, { | ||
key: 'clear', value: function clear() { | ||
clearChildren(this.results); | ||
} | ||
}, { | ||
key: 'step', value: function step( | ||
|
||
timestamp) { | ||
if (!this.running) return; | ||
this.calculate(timestamp); | ||
this.time = timestamp; | ||
this.print(); | ||
requestAnimationFrame(this.step.bind(this)); | ||
} | ||
}, { | ||
key: 'calculate', value: function calculate( | ||
|
||
timestamp) { | ||
var diff = timestamp - this.time; | ||
// Hundredths of a second are 100 ms | ||
this.times[2] += diff / 10; | ||
// Seconds are 100 hundredths of a second | ||
if (this.times[2] >= 100) { | ||
this.times[1] += 1; | ||
this.times[2] -= 100; | ||
} | ||
// Minutes are 60 seconds | ||
if (this.times[1] >= 60) { | ||
this.times[0] += 1; | ||
this.times[1] -= 60; | ||
} | ||
} | ||
}, { | ||
key: 'print', value: function print() { | ||
this.display.innerText = this.format(this.times); | ||
} | ||
}, { | ||
key: 'format', value: function format( | ||
|
||
times) { | ||
return ( | ||
pad0(times[0], 2) + ':' + | ||
pad0(times[1], 2) + ':' + | ||
pad0(Math.floor(times[2]), 2)); | ||
} | ||
}]); return Stopwatch; | ||
}(); | ||
|
||
|
||
function pad0(value, count) { | ||
var result = value.toString(); | ||
for (; result.length < count; --count) { | ||
result = '0' + result; | ||
} | ||
return result; | ||
} | ||
|
||
function clearChildren(node) { | ||
while (node.lastChild) { | ||
node.removeChild(node.lastChild); | ||
} | ||
} | ||
|
||
var stopwatch = new Stopwatch( | ||
document.querySelector('.stopwatch'), | ||
document.querySelector('.results')); |
Oops, something went wrong.