Operational Reliability Reports
Incident Queue Reliability
Count Severity
A Bash incident report can count visible severities and keep high-severity incidents visible.
Program
Play the script to choose the minimum severity and inspect the queue count report.
incident_queue_reliability_report.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash
min_severity=2
severities="1 3 2 3"
visible=0
high=0
for severity in $severities; do
if (( severity >= min_severity )); then
visible=$((visible + 1))
fi
if (( severity == 3 )); then
high=$((high + 1))
fi
done
echo "min=$min_severity visible=$visible high=$high"
#!/usr/bin/env bash
min_severity=1
severities="1 3 2 3"
visible=0
high=0
for severity in $severities; do
if (( severity >= min_severity )); then
visible=$((visible + 1))
fi
if (( severity == 3 )); then
high=$((high + 1))
fi
done
echo "min=$min_severity visible=$visible high=$high"
#!/usr/bin/env bash
min_severity=3
severities="1 3 2 3"
visible=0
high=0
for severity in $severities; do
if (( severity >= min_severity )); then
visible=$((visible + 1))
fi
if (( severity == 3 )); then
high=$((high + 1))
fi
done
echo "min=$min_severity visible=$visible high=$high"
min_severity ← 2
3min_severity=24severities="1 3 2 3"values this step2min_severityseverities ← 1 3 2 3
3min_severity=24severities="1 3 2 3"5visible=0values this step1 3 2 3severitiesvisible ← 0
4severities="1 3 2 3"5visible=06high=0values this step0visiblehigh ← 0
5visible=06high=07for severity in $severities; dovalues this step0highif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step1severity2min_severityif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step1severityif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step3severity2min_severityvisible ← 1
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step0 → 1visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step3severityhigh ← 1
11if (( severity == 3 )); then12 high=$((high + 1))13fivalues this step0 → 1highif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step2severity2min_severityvisible ← 2
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step1 → 2visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step2severityif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step3severity2min_severityvisible ← 3
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step2 → 3visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step3severityhigh ← 2
11if (( severity == 3 )); then12 high=$((high + 1))13fivalues this step1 → 2highecho "min=$min_severity visible=$visible high=$high"
14done15echo "min=$min_severity visible=$visible high=$high"outputmin=2 visible=3 high=2values this step2min_severity3visible2high
min_severity ← 1
3min_severity=14severities="1 3 2 3"values this step1min_severityseverities ← 1 3 2 3
3min_severity=14severities="1 3 2 3"5visible=0values this step1 3 2 3severitiesvisible ← 0
4severities="1 3 2 3"5visible=06high=0values this step0visiblehigh ← 0
5visible=06high=07for severity in $severities; dovalues this step0highif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step1severity1min_severityvisible ← 1
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step0 → 1visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step1severityif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step3severity1min_severityvisible ← 2
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step1 → 2visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step3severityhigh ← 1
11if (( severity == 3 )); then12 high=$((high + 1))13fivalues this step0 → 1highif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step2severity1min_severityvisible ← 3
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step2 → 3visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step2severityif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step3severity1min_severityvisible ← 4
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step3 → 4visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step3severityhigh ← 2
11if (( severity == 3 )); then12 high=$((high + 1))13fivalues this step1 → 2highecho "min=$min_severity visible=$visible high=$high"
14done15echo "min=$min_severity visible=$visible high=$high"outputmin=1 visible=4 high=2values this step1min_severity4visible2high
min_severity ← 3
3min_severity=34severities="1 3 2 3"values this step3min_severityseverities ← 1 3 2 3
3min_severity=34severities="1 3 2 3"5visible=0values this step1 3 2 3severitiesvisible ← 0
4severities="1 3 2 3"5visible=06high=0values this step0visiblehigh ← 0
5visible=06high=07for severity in $severities; dovalues this step0highif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step1severity3min_severityif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step1severityif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step3severity3min_severityvisible ← 1
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step0 → 1visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step3severityhigh ← 1
11if (( severity == 3 )); then12 high=$((high + 1))13fivalues this step0 → 1highif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step2severity3min_severityif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step2severityif (( severity >= min_severity )); then
7for severity in $severities; do8 if (( severity >= min_severity )); then9 visible=$((visible + 1))values this step3severity3min_severityvisible ← 2
8if (( severity >= min_severity )); then9 visible=$((visible + 1))10fivalues this step1 → 2visibleif (( severity == 3 )); then
10fi11if (( severity == 3 )); then12 high=$((high + 1))values this step3severityhigh ← 2
11if (( severity == 3 )); then12 high=$((high + 1))13fivalues this step1 → 2highecho "min=$min_severity visible=$visible high=$high"
14done15echo "min=$min_severity visible=$visible high=$high"outputmin=3 visible=2 high=2values this step3min_severity2visible2high
severity threshold
`min_severity` controls which incident values count as visible.
loop counters
The script uses scalar counters so every update is replayable.
high count
Severity 3 incidents stay visible in a separate total.