Operational Reliability Reports
Incident Queue Reliability Report
Count visible incidents and high-severity incidents from a small queue.
incident-queue-report
Counting with a loop makes the threshold and the visible queue size explicit.
Incident Queue Reliability Report
IncidentQueueReliabilityReport.scala
Replay: real traced execution (multi-file project)
object Main {
def main(args: Array[String]): Unit = {
val minSeverity = 2
val severities = List(1, 2, 3, 3)
var visible = 0
var high = 0
for (severity <- severities) {
if (severity >= minSeverity) {
visible = visible + 1
}
if (severity >= 3) {
high = high + 1
}
}
println("min=" + minSeverity)
println("visible=" + visible)
println("high=" + high)
}
}
object Main {
def main(args: Array[String]): Unit = {
val minSeverity = 1
val severities = List(1, 2, 3, 3)
var visible = 0
var high = 0
for (severity <- severities) {
if (severity >= minSeverity) {
visible = visible + 1
}
if (severity >= 3) {
high = high + 1
}
}
println("min=" + minSeverity)
println("visible=" + visible)
println("high=" + high)
}
}
object Main {
def main(args: Array[String]): Unit = {
val minSeverity = 3
val severities = List(1, 2, 3, 3)
var visible = 0
var high = 0
for (severity <- severities) {
if (severity >= minSeverity) {
visible = visible + 1
}
if (severity >= 3) {
high = high + 1
}
}
println("min=" + minSeverity)
println("visible=" + visible)
println("high=" + high)
}
}
minSeverity ← 2, severities ← List(1, 2, 3, 3), visible ← 0, high ← 0
1object Main {2 def main(args: Array[String]): Unit = {3 val minSeverity→ 2 = 2 //@minSeverity=1, 34 val severities→ List(1, 2, 3, 3) = List(1, 2, 3, 3)5 var visible→ 0 = 06 var high→ 0 = 078 for (severity <- severities) {for (severity <- severities)
pass 1 of 48for (severity1 <- severitiesList(1, 2, 3, 3)) {9 if (severity >= minSeverity) {All 4 passes — pass 1 is the card above pass severityhigh1 1 — 2 2 — 3 3 0 → 1 4 3 1 → 2 visible ← 1
pass 1 of 38for (severity <- severities) {9 if (severity2 >= minSeverity2) {10 visible→ 1 = visible + 111 }12 if (severity >= 3) {All 3 passes — pass 1 is the card above pass severityvisiblehigh1 2 0 → 1 — 2 3 1 → 2 0 → 1 3 3 2 → 3 1 → 2 high ← 1
pass 1 of 211 }12 if (severity3 >= 3) {13 high→ 1 = high + 114 }15}high ← 2
pass 2 of 211 }12 if (severity3 >= 3) {13 high→ 2 = high + 114 }15}println("min=" + minSeverity)
17 println("min=" + minSeverity2)18 println("visible=" + visible3)19 println("high=" + high2)20 }21}outputmin=2 visible=3 high=2
minSeverity ← 1, severities ← List(1, 2, 3, 3), visible ← 0, high ← 0
1object Main {2 def main(args: Array[String]): Unit = {3 val minSeverity→ 1 = 14 val severities→ List(1, 2, 3, 3) = List(1, 2, 3, 3)5 var visible→ 0 = 06 var high→ 0 = 078 for (severity <- severities) {for (severity <- severities)
pass 1 of 48for (severity1 <- severitiesList(1, 2, 3, 3)) {9 if (severity >= minSeverity) {All 4 passes — pass 1 is the card above pass severityhigh1 1 — 2 2 — 3 3 0 → 1 4 3 1 → 2 visible ← 1
pass 1 of 48for (severity <- severities) {9 if (severity1 >= minSeverity1) {10 visible→ 1 = visible + 111 }12 if (severity >= 3) {All 4 passes — pass 1 is the card above pass severityvisiblehigh1 1 0 → 1 — 2 2 1 → 2 — 3 3 2 → 3 0 → 1 4 3 3 → 4 1 → 2 high ← 1
pass 1 of 211 }12 if (severity3 >= 3) {13 high→ 1 = high + 114 }15}high ← 2
pass 2 of 211 }12 if (severity3 >= 3) {13 high→ 2 = high + 114 }15}println("min=" + minSeverity)
17 println("min=" + minSeverity1)18 println("visible=" + visible4)19 println("high=" + high2)20 }21}outputmin=1 visible=4 high=2
minSeverity ← 3, severities ← List(1, 2, 3, 3), visible ← 0, high ← 0
1object Main {2 def main(args: Array[String]): Unit = {3 val minSeverity→ 3 = 34 val severities→ List(1, 2, 3, 3) = List(1, 2, 3, 3)5 var visible→ 0 = 06 var high→ 0 = 078 for (severity <- severities) {for (severity <- severities)
pass 1 of 48for (severity1 <- severitiesList(1, 2, 3, 3)) {9 if (severity >= minSeverity) {All 4 passes — pass 1 is the card above pass severityminSeverityvisiblehigh1 1 — — — 2 2 — — — 3 3 3 0 → 1 0 → 1 4 3 3 1 → 2 1 → 2 visible ← 1
pass 1 of 28for (severity <- severities) {9 if (severity3 >= minSeverity3) {10 visible→ 1 = visible + 111 }12 if (severity >= 3) {high ← 1
pass 1 of 211 }12 if (severity3 >= 3) {13 high→ 1 = high + 114 }15}visible ← 2
pass 2 of 28for (severity <- severities) {9 if (severity3 >= minSeverity3) {10 visible→ 2 = visible + 111 }12 if (severity >= 3) {high ← 2
pass 2 of 211 }12 if (severity3 >= 3) {13 high→ 2 = high + 114 }15}println("min=" + minSeverity)
17 println("min=" + minSeverity3)18 println("visible=" + visible2)19 println("high=" + high2)20 }21}outputmin=3 visible=2 high=2