Operational Status Reports
Queue Snapshot
Count Ticket Statuses
A queue snapshot script can count fixed status buckets and show the bucket requested by a selector.
Program
Play the script to choose the status bucket and inspect the queue snapshot report.
queue_snapshot_report.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash
wanted_status="open"
open_count=0
waiting_count=0
tickets="open:high waiting:normal open:normal"
for ticket in $tickets; do
status="${ticket%%:*}"
if [[ "$status" == "open" ]]; then
open_count=$((open_count + 1))
else
waiting_count=$((waiting_count + 1))
fi
done
if [[ "$wanted_status" == "open" ]]; then
shown=$open_count
else
shown=$waiting_count
fi
echo "$wanted_status tickets=$shown open=$open_count waiting=$waiting_count"
#!/usr/bin/env bash
wanted_status="waiting"
open_count=0
waiting_count=0
tickets="open:high waiting:normal open:normal"
for ticket in $tickets; do
status="${ticket%%:*}"
if [[ "$status" == "open" ]]; then
open_count=$((open_count + 1))
else
waiting_count=$((waiting_count + 1))
fi
done
if [[ "$wanted_status" == "open" ]]; then
shown=$open_count
else
shown=$waiting_count
fi
echo "$wanted_status tickets=$shown open=$open_count waiting=$waiting_count"
wanted_status ← open
3wanted_status="open"4open_count=0values this stepopenwanted_statusopen_count ← 0
3wanted_status="open"4open_count=05waiting_count=0values this step0open_countwaiting_count ← 0
4open_count=05waiting_count=06tickets="open:high waiting:normal open:normal"values this step0waiting_counttickets ← open:high waiting:normal open:normal
5waiting_count=06tickets="open:high waiting:normal open:normal"7for ticket in $tickets; dovalues this stepopen:high waiting:normal open:normalticketsstatus ← open
7for ticket in $tickets; do8 status="${ticket%%:*}"9 if [[ "$status" == "open" ]]; thenvalues this stepopenstatusopen:highticketopen_count ← 1
9if [[ "$status" == "open" ]]; then10 open_count=$((open_count + 1))11elsevalues this step0 → 1open_countstatus ← waiting
7for ticket in $tickets; do8 status="${ticket%%:*}"9 if [[ "$status" == "open" ]]; thenvalues this stepwaitingstatuswaiting:normalticketwaiting_count ← 1
11else12 waiting_count=$((waiting_count + 1))13fivalues this step0 → 1waiting_countstatus ← open
7for ticket in $tickets; do8 status="${ticket%%:*}"9 if [[ "$status" == "open" ]]; thenvalues this stepopenstatusopen:normalticketopen_count ← 2
9if [[ "$status" == "open" ]]; then10 open_count=$((open_count + 1))11elsevalues this step1 → 2open_countif [[ "$wanted_status" == "open" ]]; then
14done15if [[ "$wanted_status" == "open" ]]; then16 shown=$open_countvalues this stepopenwanted_statusshown ← 2
15if [[ "$wanted_status" == "open" ]]; then16 shown=$open_count17elsevalues this step2shown2open_countecho "$wanted_status tickets=$shown open=$open_count waiting=$waiting_…
19fi20echo "$wanted_status tickets=$shown open=$open_count waiting=$waiting_count"outputopen tickets=2 open=2 waiting=1values this stepopenwanted_status2shown2open_count1waiting_count
wanted_status ← waiting
3wanted_status="waiting"4open_count=0values this stepwaitingwanted_statusopen_count ← 0
3wanted_status="waiting"4open_count=05waiting_count=0values this step0open_countwaiting_count ← 0
4open_count=05waiting_count=06tickets="open:high waiting:normal open:normal"values this step0waiting_counttickets ← open:high waiting:normal open:normal
5waiting_count=06tickets="open:high waiting:normal open:normal"7for ticket in $tickets; dovalues this stepopen:high waiting:normal open:normalticketsstatus ← open
7for ticket in $tickets; do8 status="${ticket%%:*}"9 if [[ "$status" == "open" ]]; thenvalues this stepopenstatusopen:highticketopen_count ← 1
9if [[ "$status" == "open" ]]; then10 open_count=$((open_count + 1))11elsevalues this step0 → 1open_countstatus ← waiting
7for ticket in $tickets; do8 status="${ticket%%:*}"9 if [[ "$status" == "open" ]]; thenvalues this stepwaitingstatuswaiting:normalticketwaiting_count ← 1
11else12 waiting_count=$((waiting_count + 1))13fivalues this step0 → 1waiting_countstatus ← open
7for ticket in $tickets; do8 status="${ticket%%:*}"9 if [[ "$status" == "open" ]]; thenvalues this stepopenstatusopen:normalticketopen_count ← 2
9if [[ "$status" == "open" ]]; then10 open_count=$((open_count + 1))11elsevalues this step1 → 2open_countif [[ "$wanted_status" == "open" ]]; then
14done15if [[ "$wanted_status" == "open" ]]; then16 shown=$open_countvalues this stepwaitingwanted_statusshown ← 1
17else18 shown=$waiting_count19fivalues this step1shown1waiting_countecho "$wanted_status tickets=$shown open=$open_count waiting=$waiting_…
19fi20echo "$wanted_status tickets=$shown open=$open_count waiting=$waiting_count"outputwaiting tickets=1 open=2 waiting=1values this stepwaitingwanted_status1shown2open_count1waiting_count
bucket counters
Each status bucket is a scalar counter that stays easy to inspect.
status selector
The selector changes which bucket is highlighted without changing the source shape.
snapshot output
The report includes the selected bucket and the full queue summary.