Skip to content

Cycle flush

A node sends its telemetry at a fixed point in every reconcile cycle, once the cycle's work has run, and the amount it sends is part of the node's own load management. The cycle flush takes the flush budget the performance governor set for this cycle, flushes each channel the budget allows, and then records what the cycle did. Status and events are sent every cycle. Logs are held back while the node is under pressure, so a busy node spends its capacity on work and on the reports the control plane acts on. This page covers where the flush sits in the cycle, the budget, the order of the completion phase, and what a shutdown changes.

Where telemetry moves in a cycle

flowchart TB
  subgraph PREP["PREPARATION"]
    direction TB
    RF["Refresh the mux profile<br/>every 15 s"]
    OS["Capture trace, audit<br/>and mux state"]
    GV{{"Performance governor<br/>limits, flush gates"}}
    RF --> OS --> GV
  end
  HB["HEARTBEAT<br/>node state, spool metrics"]
  INT["INTAKE"]
  subgraph WK["WORKER EXECUTION"]
    direction TB
    AK["An ack flushes<br/>the status channel at once"]
  end
  subgraph COMP["COMPLETION"]
    direction TB
    FL["Cycle flush<br/>status, events, logs"]
    DR{{"Drain check"}}
    SN["Observability snapshot"]
    SM[("Cycle summary")]
    FL --> DR --> SN --> SM
  end
  PREP --> HB --> INT --> WK --> COMP

Most records wait in their buffers until the completion phase. One kind does not: an ack flushes the status channel as soon as it is reported, so the control plane learns the node has taken an assignment within the same cycle. See Status lifecycle and reporting.

The flush budget

The performance governor computes the cycle's limits during preparation, and three of them gate the flush:

Gate Value Held back when
flush_status Always 1 Never
flush_events Always 1 Never
flush_logs 1, or 0 The node is under backpressure, its queue is at 90% of its watermark or above, or 2,000 or more records wait in the outbox

A held-back channel is not flushed this cycle; its records stay in the buffer, and the buffer's bound moves the oldest to the outbox if it fills. The logs channel flushes again on the first cycle the pressure lifts, and sends what it held along with the spool. The governor's limits are also reported in the heartbeat. See Scaling and the performance governor.

The completion phase

  1. Flush. The flush plan is resolved from the governor's gates, and each channel whose gate is open is flushed in order: status, events, logs. Each flush sends the channel's buffer in its current mode and replays its spool. See The telemetry batching mux.
  2. Drain check. The node reads its queue and the leases it still holds, and decides whether a requested shutdown can finish now. See Shutdown and drain.
  3. Observability snapshot. The node captures the trace layer's state, the audit spool's metrics and the mux's profile state.
  4. Cycle summary. The cycle's counts and every section captured become the cycle summary. See Cycle summary and heartbeat projection.

The flush result records the plan and the number of records each channel sent:

{
  "flush_plan": {"flush_status": 1, "flush_events": 1, "flush_logs": 0},
  "flushed": {"status": 4, "events": 11, "logs": 0}
}

A channel that sent nothing because it is in a failover window reports 0; its records are in the outbox. See Adaptive transport.

Shutdown flushes everything

Once a shutdown is requested the governor's gates no longer apply: every cycle flushes status, events and logs, so a draining node sends what it holds before it exits. The run loop ends when the drain check reports the node ready to exit. Records still in the outbox at that point end with the process; see Telemetry outbox and replay.