Availability SLI Calculation Bug
Spot the mistake in a function that computes an availability SLI and compares it to an SLO.
Codejavascript
// SLO: 99.9% of requests should succeed
const SLO_TARGET = 0.999;
function meetsSlo(totalRequests, failedRequests) {
// availability SLI = successful / total
const sli = failedRequests / totalRequests;
return sli >= SLO_TARGET;
}
// 1,000,000 requests, 500 failed
console.log(meetsSlo(1000000, 500)); // expected: trueWhat is the bug in this SLI calculation?