Count incidents visible at a selected minimum severity.

incident queue Small severity lists make queue thresholds visible without using external incident systems.

Incident Queue Reliability Report

min_severity
incident_queue.pl
Replay: real traced execution (multi-file project)
use strict;
use warnings;

my $min_severity = 2;
my $visible = 0;
my $high = 0;

for my $severity (1, 2, 3, 3) {
    if ($severity >= $min_severity) {
        $visible = $visible + 1;
    }
    if ($severity >= 3) {
        $high = $high + 1;
    }
}

print "min=$min_severity visible=$visible high=$high\n";
use strict;
use warnings;

my $min_severity = 1;
my $visible = 0;
my $high = 0;

for my $severity (1, 2, 3, 3) {
    if ($severity >= $min_severity) {
        $visible = $visible + 1;
    }
    if ($severity >= 3) {
        $high = $high + 1;
    }
}

print "min=$min_severity visible=$visible high=$high\n";
use strict;
use warnings;

my $min_severity = 3;
my $visible = 0;
my $high = 0;

for my $severity (1, 2, 3, 3) {
    if ($severity >= $min_severity) {
        $visible = $visible + 1;
    }
    if ($severity >= 3) {
        $high = $high + 1;
    }
}

print "min=$min_severity visible=$visible high=$high\n";
  1. $min_severity ← 2, $visible ← 0, $high ← 0

    4my $min_severity→ 2 = 2; #@min_severity=1, 35my $visible→ 0 = 0;6my $high→ 0 = 0;
  2. for my $severity (1, 2, 3, 3)

    pass 1 of 4
    8for my $severity1 (1, 2, 3, 3) {9    if ($severity >= $min_severity) {
    All 4 passes — pass 1 is the card above
    pass$severity$high
    11
    22
    330 1
    431 2
  3. $visible ← 1

    pass 1 of 3
    8for my $severity (1, 2, 3, 3) {9    if ($severity2 >= $min_severity2) {10        $visible→ 1 = $visible + 1;11    }
    All 3 passes — pass 1 is the card above
    pass$severity$visible$high
    120 1
    231 20 1
    332 31 2
  4. $high ← 1

    pass 1 of 2
    11}12if ($severity3 >= 3) {13    $high→ 1 = $high + 1;14}
  5. $high ← 2

    pass 2 of 2
    11}12if ($severity3 >= 3) {13    $high→ 2 = $high + 1;14}
  6. print "min=$min_severity visible=$visible high=$high ";

    17print "min=$min_severity2 visible=$visible3 high=$high2\n";
    outputmin=2 visible=3 high=2
  1. $min_severity ← 1, $visible ← 0, $high ← 0

    4my $min_severity→ 1 = 1;5my $visible→ 0 = 0;6my $high→ 0 = 0;
  2. for my $severity (1, 2, 3, 3)

    pass 1 of 4
    8for my $severity1 (1, 2, 3, 3) {9    if ($severity >= $min_severity) {
    All 4 passes — pass 1 is the card above
    pass$severity$high
    11
    22
    330 1
    431 2
  3. $visible ← 1

    pass 1 of 4
    8for my $severity (1, 2, 3, 3) {9    if ($severity1 >= $min_severity1) {10        $visible→ 1 = $visible + 1;11    }
    All 4 passes — pass 1 is the card above
    pass$severity$visible$high
    110 1
    221 2
    332 30 1
    433 41 2
  4. $high ← 1

    pass 1 of 2
    11}12if ($severity3 >= 3) {13    $high→ 1 = $high + 1;14}
  5. $high ← 2

    pass 2 of 2
    11}12if ($severity3 >= 3) {13    $high→ 2 = $high + 1;14}
  6. print "min=$min_severity visible=$visible high=$high ";

    17print "min=$min_severity1 visible=$visible4 high=$high2\n";
    outputmin=1 visible=4 high=2
  1. $min_severity ← 3, $visible ← 0, $high ← 0

    4my $min_severity→ 3 = 3;5my $visible→ 0 = 0;6my $high→ 0 = 0;
  2. for my $severity (1, 2, 3, 3)

    pass 1 of 4
    8for my $severity1 (1, 2, 3, 3) {9    if ($severity >= $min_severity) {
    All 4 passes — pass 1 is the card above
    pass$severity$min_severity$visible$high
    11
    22
    3330 10 1
    4331 21 2
  3. $visible ← 1

    pass 1 of 2
    8for my $severity (1, 2, 3, 3) {9    if ($severity3 >= $min_severity3) {10        $visible→ 1 = $visible + 1;11    }
  4. $high ← 1

    pass 1 of 2
    11}12if ($severity3 >= 3) {13    $high→ 1 = $high + 1;14}
  5. $visible ← 2

    pass 2 of 2
    8for my $severity (1, 2, 3, 3) {9    if ($severity3 >= $min_severity3) {10        $visible→ 2 = $visible + 1;11    }
  6. $high ← 2

    pass 2 of 2
    11}12if ($severity3 >= 3) {13    $high→ 2 = $high + 1;14}
  7. print "min=$min_severity visible=$visible high=$high ";

    17print "min=$min_severity3 visible=$visible2 high=$high2\n";
    outputmin=3 visible=2 high=2