skip to content

incident response for a collection product · lesson 2 of 8 · sources checked 2026-11-30

the stage-reached distribution over time

This lesson reads "blocked at x instead of y" as a shift of a distribution, with a shift alarm for each target and cohort.

purpose

A report such as "blocked at x instead of y" says that the work now stops at an earlier step. One pass rate cannot show that move. A view of the stage reached shows it, and separates an event of one target from an event of a class.

objectives

  1. Explain why "blocked at x instead of y" is a shift of a distribution and not a fall of one pass rate.
  2. Build a cohort view of the stage-reached distribution for each window.
  3. Compute a shift measure, and apply a sample floor before an alarm fires.
  4. Separate a target event from a cohort event.

new terms

target-class cohort
A group of targets with the same target class or the same detection class that a monitor reads together.

how it works

The stage reached is the last ordered stage of a flow that one attempt completed. A flow can have, for example, seven stages from 0 to 6, and stage 6 is a pass. A pass rate keeps only stage 6. It loses the place where the other attempts stop.

a shift, not a fall

Take two windows of one target. In both windows, half of the attempts pass. In the first window, the other attempts stop at stage 5. In the second window, they stop at stage 3.

The pass rate is the same, but the attempts now stop two stages earlier. That is the meaning of "blocked at x instead of y". The defender now stops the collector at an earlier step, or a part of the own system fails earlier.

The stage of each attempt must be in the record first. A collector that does not record it cannot see a shift. More detail is in The oracle for a flow: stages and the stage reached (not yet published).

the cohort view

A target-class cohort is a group of targets with the same target class or the same detection class. A monitor reads the targets of a cohort together.

The view keeps one distribution for each target and for each cohort, in each window. The distribution is the share of attempts that stop at each stage. For example, take a window of 20 attempts: 10 stop at stage 6, 2 at stage 4, and 8 at stage 3. The shares are 0.5, 0.1, and 0.4.

The two levels give two readings:

  • A shift in one target only is a target event. The suspect is a target change, or a rule of that site.
  • A shift in each target of a cohort points to a cause that the targets share. It can be the own system, the supplier, or a change for one detection class.

This reading feeds the order of the suspect classes in The first 15 minutes.

the shift measure and the sample floor

The shift measure compares a new window with a reference window. One simple measure is half the sum of the absolute differences of the shares at each stage. It is 0 when the two distributions are equal, and 1 when they have no stage in common.

For example, the reference shares are 0.9 at stage 6 and 0.1 at stage 5. The new shares are 0.5 at stage 6 and 0.5 at stage 3. The differences are 0.4, 0.1, and 0.5, and the measure is half of 1.0, thus 0.5.

A small window gives a noisy measure. Thus the alarm uses a sample floor: the minimum number of attempts in a window before the alarm can fire. A window below the floor waits for more attempts.

This is an outcome alarm on a ratio, not on a count. A count alarm stays quiet on a small target with a steady low rate of failures. A ratio with a floor can fire on a small target and stay quiet on noise.

the alarm is a hypothesis

A shift alarm names a place in the flow. It does not prove a cause. For example, a shift to stage 3 can come from a new step on the site or from a fault of the own extractor. The alarm stays a hypothesis until a lab test of the stage reached confirms it. More detail is in Stage reached: compare two configurations by progress (not yet published).

On many targets, alarms for each target are too many for one on-call engineer. A grouping of the alarms by class keeps their number low enough for one engineer. More detail is in Monitors at 1,000 targets.

the two sides

automation sidedetection side
A cohort view separates a target event from a class event. A ratio alarm with a sample floor fires on a small target and stays quiet on noise.The defender changes a rule for one detection class, and the stage-reached shift appears in each target of that class. The defender sees the collector stop at an earlier step.

design decisions

optiongaincostwhen it is correct
One pass rate for each targetSimple to compute and to readA shift with the same pass rate stays hidden.Only as a first summary
A stage-reached distribution for each targetShows where the attempts stopEach attempt must record its stage.When the flow has more than two stages
A cohort level above the targetsSeparates a target event from a class eventEach target must have a target class and a detection class.With more than a few targets of one class
A ratio alarm with a sample floorFires on a small target, stays quiet on noiseA small target waits longer for a result.For each shift alarm
A count alarmSimpleStays quiet on a steady low rate of failuresNever for a shift

diagram

the cohort view: from attempt facts to a shift alarm for each target and each cohort

  1. Attempt factsEach attempt records its target, its time, and its stage reached.
  2. Targets in cohortsEach target is in one target-class cohort, by its target class or its detection class.
  3. WindowsThe attempts of each target and of each cohort go into fixed time windows.
  4. Stage-reached distributionThe share of attempts that stop at each stage, in each window.
  5. Shift measureThe new window against the reference window, for each target and for each cohort.
  6. Sample floorA window below the floor fires no alarm and waits for more attempts.

Shift alarm: a hypothesis about a target event or a cohort eventno result

The cohort view has two levels: each target and each cohort. The sample floor comes before the alarm.source: My model of the cohort view and the shift alarm

code example

The example builds synthetic attempt facts from counts for each stage. The floor and the alarm level are example values.

m50-x02-stage-shift.tstypescript

Compute a stage-reached distribution for each target and cohort in each window. Compare it with the reference window, and apply a sample floor.

// Stage-shift detector over synthetic attempt facts. All values are synthetic.
// Run: node --experimental-strip-types m50-x02-stage-shift.ts

type Window = "ref" | "new";
type Fact = { target: string; cohort: string; window: Window; stage: number }; // stage 0 to 6

const SAMPLE_FLOOR = 20; // example value: attempts in a window before an alarm
const ALARM_LEVEL = 0.3; // example value: shift measure that fires the alarm

// Synthetic counts for each stage: target, cohort, window, then stage -> count.
const counts: [string, string, Window, Record<number, number>][] = [
  ["1", "A", "ref", { 6: 18, 5: 2 }],
  ["1", "A", "new", { 6: 10, 3: 10 }],
  ["2", "A", "ref", { 6: 19, 5: 1 }],
  ["2", "A", "new", { 6: 4, 3: 2 }],
];

const facts: Fact[] = [];
for (const [target, cohort, window, byStage] of counts) {
  for (const [stage, n] of Object.entries(byStage)) {
    for (let i = 0; i < n; i++) facts.push({ target, cohort, window, stage: Number(stage) });
  }
}

function shares(stages: number[]): Map<number, number> {
  const out = new Map<number, number>();
  for (const s of stages) out.set(s, (out.get(s) ?? 0) + 1);
  for (const [s, n] of out) out.set(s, n / stages.length);
  return out;
}

function shift(ref: Map<number, number>, now: Map<number, number>): number {
  const keys = new Set([...ref.keys(), ...now.keys()]);
  let sum = 0;
  for (const k of keys) sum += Math.abs((ref.get(k) ?? 0) - (now.get(k) ?? 0));
  return sum / 2;
}

const groups = new Map<string, { ref: number[]; new: number[] }>();
function add(key: string, f: Fact): void {
  if (!groups.has(key)) groups.set(key, { ref: [], new: [] });
  groups.get(key)![f.window].push(f.stage);
}
for (const f of facts) {
  add(`target ${f.target}`, f);
  add(`cohort ${f.cohort}`, f);
}

for (const key of [...groups.keys()].sort()) {
  const w = groups.get(key)!;
  if (w.ref.length < SAMPLE_FLOOR || w.new.length < SAMPLE_FLOOR) {
    console.log(`${key}: below the sample floor, wait`);
    continue;
  }
  const value = shift(shares(w.ref), shares(w.new));
  const state = value >= ALARM_LEVEL ? "alarm (a hypothesis)" : "quiet";
  console.log(`${key}: shift ${value.toFixed(2)}, ${state}`);
}

output

One line for each target and each cohort: the shift measure and the alarm state, or a wait below the sample floor.

cohort A: shift 0.46, alarm (a hypothesis)
target 1: shift 0.50, alarm (a hypothesis)
target 2: below the sample floor, wait

The output shows an alarm for target 1 and for cohort A. Target 2 waits below the sample floor.

data

stage reached by a lab flow before and after a gate change, by cohort

status of this figure: simulated

stage reached by a lab flow before and after a gate change, by cohortA, gate change, beforeA, gate change, afterB, gate change, beforeB, gate change, afterA, no change, first windowA, no change, second windowB, no change, first windowB, no change, second window2071919181618209332unit: attempts1. stage 6 (passed)2. stages 4 to 53. stage 34. stages 0 to 2
  1. stage 6 (passed): A, gate change, before 20; A, gate change, after 7; B, gate change, before 19; B, gate change, after 19; A, no change, first window 18; A, no change, second window 16; B, no change, first window 18; B, no change, second window 20
  2. stages 4 to 5: A, gate change, before 0; A, gate change, after 1; B, gate change, before 1; B, gate change, after 0; A, no change, first window 1; A, no change, second window 1; B, no change, first window 0; B, no change, second window 0
  3. stage 3: A, gate change, before 0; A, gate change, after 9; B, gate change, before 0; B, gate change, after 1; A, no change, first window 1; A, no change, second window 0; B, no change, first window 0; B, no change, second window 0
  4. stages 0 to 2: A, gate change, before 0; A, gate change, after 3; B, gate change, before 0; B, gate change, after 0; A, no change, first window 0; A, no change, second window 3; B, no change, first window 2; B, no change, second window 0

source: Lab result of this course: planted gate change, 20 attempts for each cohort and window; date 2026-11-15; sample of 160; condition: Own lab gate and own egress on one shared lab host. The change is planted once. Teaching values, not data of a real service.

data table
stage reached by a lab flow before and after a gate change, by cohort
seriescohort and windowattempts
stage 6 (passed)A, gate change, before20
stage 6 (passed)A, gate change, after7
stage 6 (passed)B, gate change, before19
stage 6 (passed)B, gate change, after19
stage 6 (passed)A, no change, first window18
stage 6 (passed)A, no change, second window16
stage 6 (passed)B, no change, first window18
stage 6 (passed)B, no change, second window20
stages 4 to 5A, gate change, before0
stages 4 to 5A, gate change, after1
stages 4 to 5B, gate change, before1
stages 4 to 5B, gate change, after0
stages 4 to 5A, no change, first window1
stages 4 to 5A, no change, second window1
stages 4 to 5B, no change, first window0
stages 4 to 5B, no change, second window0
stage 3A, gate change, before0
stage 3A, gate change, after9
stage 3B, gate change, before0
stage 3B, gate change, after1
stage 3A, no change, first window1
stage 3A, no change, second window0
stage 3B, no change, first window0
stage 3B, no change, second window0
stages 0 to 2A, gate change, before0
stages 0 to 2A, gate change, after3
stages 0 to 2B, gate change, before0
stages 0 to 2B, gate change, after0
stages 0 to 2A, no change, first window0
stages 0 to 2A, no change, second window3
stages 0 to 2B, no change, first window2
stages 0 to 2B, no change, second window0
Each bar holds 20 attempts of one cohort in one window. I planted a gate change on one target of cohort A. Cohort A passed 20 of 20 before and 7 of 20 after. Cohort B passed 19 of 20 after.

The chart is a lab result of this course, not data of a real service. After the planted change, most failed attempts of cohort A stop at stage 3, and fewer attempts reach the last stage. The other cohort keeps its distribution.

In the no-change windows, the distribution moves a little with no cause, and that movement is noise.

failure modes

problemcausecorrection
The pass rate stays the same, but the product gets less data from a later step.The monitor reads only one pass rate.Keep the stage-reached distribution for each window.
An alarm never fires on a small target with a steady low rate of failures.The alarm counts failures.Use a ratio alarm with a sample floor.
The alarm fires on noise in a small window.No sample floorHold back each window below the floor.
A class event looks like many separate target events.No cohort levelGroup the targets by target class and by detection class.
The team names a cause from the alarm alone.The alarm is read as proof.Treat the alarm as a hypothesis until a lab test confirms the stage.
The monitor cannot show a shift at all.The attempts do not record the stage reached.Record the stage of each attempt first.

check questions

  1. Explain why "blocked at x instead of y" is not a fall of one pass rate.

    sample answer

    The words say that the attempts now stop at an earlier stage of the flow. The pass rate can stay the same while the place of the stop moves. Only the stage-reached distribution shows that move.

  2. A window has 20 attempts: 10 at stage 6, 2 at stage 4, and 8 at stage 3. What are the shares?

    1. 0.5, 0.1, and 0.4
    2. 10, 2, and 8
    3. 0.5 at stage 6 and 0.5 for all other stages, with no split
    answer

    a. 0.5, 0.1, and 0.4

    Each share is the count at a stage divided by the 20 attempts of the window.

  3. The sample floor is 20 attempts. A new window of a small target has 6 attempts and a large shift measure. What does the alarm do?

    1. It fires, because the shift is large.
    2. It fires, and the team names a detection change.
    3. It does not fire. The window waits for more attempts.
    answer

    c. It does not fire. The window waits for more attempts.

    A window below the sample floor fires no alarm. The measure of a small window is noisy.

  4. Each target of one cohort shows the same shift in the same window. Where does the cause probably lie?

    1. In a change of one target only
    2. In a cause that the targets share: the own system, the supplier, or a change for one detection class
    3. In noise, because a cohort has many targets
    answer

    b. In a cause that the targets share: the own system, the supplier, or a change for one detection class

    A shift in one target only is a target event. A shift in each target of a cohort points to a shared cause.

exercise

exercise Do this task on paper, with the synthetic windows below. Use the shift measure: half the sum of the absolute differences of the shares. Use the example sample floor of 20 attempts and the example alarm level of 0.3.

target and windowattemptsstage 6stages 4 to 5stage 3stages 0 to 2
Target 1, reference2018110
Target 1, new2081101
Target 2, reference2019100
Target 2, new63030

Other fact: targets 1 and 2 are in one cohort. The other targets of the cohort show no shift.

  1. Compute the shares of each window.
  2. Compute the shift measure of target 1.
  3. Apply the sample floor to target 2.
  4. Write the class of the event: a target event or a cohort event.
sample answer

The answer uses the four synthetic windows of the task.

Target 1: the reference shares are 0.90, 0.05, 0.05, and 0. The new shares are 0.40, 0.05, 0.50, and 0.05. The absolute differences are 0.50, 0, 0.45, and 0.05. Their sum is 1.00, and the shift measure is 0.50. That is above 0.3, thus the alarm fires as a hypothesis.

Target 2: the new window has 6 attempts, below the floor of 20. The alarm does not fire, and the window waits for more attempts.

The other targets of the cohort show no shift. Thus it is a target event. The next suspect is a target change of target 1.

sources

  1. My model of the stage-reached distribution over time, the cohort view, the shift measure, and the shift alarm, 2026-11 (not public).
  2. Course design: the sample floor and the alarm level of the example, 2026-11 (not public).
  3. Lab result of this course: a planted gate change in a lab flow, with a no-change control, 2026-11 (not public).