Skip to content

The telemetry batching mux

A node produces metadata records continuously, on three channels: assignment status, events and logs. The telemetry batching mux sits between everything that produces a record and the control-plane endpoints that ingest it. It keeps a bounded buffer per channel, sends each channel in the mode its state calls for, puts status reports in the order the control plane expects, and hands whatever it cannot send to the outbox. This page covers the channels, the buffers, how each channel is sent, the ordering of status reports, and the profile the control plane sets for the mux.

The three channels

flowchart TB
  subgraph IN["PRODUCERS"]
    direction LR
    SR["Status reporting"]
    EV["Event envelopes"]
    LG["Log envelopes"]
  end
  subgraph MUX["TELEMETRY MUX"]
    direction TB
    SA{{"Stage with status ack<br/>sequence, dedupe key"}}
    B1[("status buffer")]
    B2[("events buffer")]
    B3[("logs buffer")]
    SA --> B1
  end
  OB[("Outbox spool")]
  subgraph CP["CONTROL PLANE"]
    direction TB
    E1["/v1/dataplane/assignments/{id}/ack,<br/>progress, complete"]
    E2["/v1/dataplane/events/batch"]
    E3["/v1/dataplane/logs/batch<br/>stream or batch"]
    E4["/v1/dataplane/logs/failover"]
  end
  SR --> SA
  EV --> B2
  LG --> B3
  B1 --> E1
  B2 --> E2
  B3 --> E3
  OB --> E4
  B1 -.->|"spill, failover"| OB
  B2 -.-> OB
  B3 -.-> OB

Every record on every channel is metadata: its body was already written to your bucket, and the record carries the reference. See Payload store runtime.

Channel Holds Sent to
status ack, progress and complete reports for assignments One call per report, to the assignment's ack, progress or complete endpoint
events Assignment and runtime events /v1/dataplane/events/batch
logs Log records /v1/dataplane/logs/batch in stream or batch mode, /v1/dataplane/logs/failover for spooled records

Each batch belongs to one workspace; the client refuses a batch that mixes workspaces before sending it. See The control-plane client.

Buffers

Each channel has an in-memory buffer bounded at max_buffer_records. When a record would push a buffer past the bound, the oldest record moves to the outbox and the new one stays, so the buffer holds the most recent records and the older ones wait in the spool. While a channel is in a failover window, new records go straight to the outbox. See Telemetry outbox and replay.

A record sent in a mode that requires an envelope identifier is given one, <channel>-<uuid>, when it has none. Failover requires it, so every spooled record can be recognised when it is delivered twice.

Sending a channel

A flush sends one channel's buffer in the mode the mux selects for it, then replays that channel's spooled records:

  1. The buffer is taken whole and sent: events as one batch, logs as one batch in stream or batch mode, status reports one at a time.
  2. After a successful send, up to max_batch_records spooled records for the channel are delivered in batch mode.
  3. The status outbox is compacted up to its acknowledgement watermark.

When a send fails, the whole buffer goes to the outbox and the channel enters a failover window. See Adaptive transport. A flush of an empty buffer still replays the channel's spool, so a quiet channel drains its backlog.

Status reports keep their order

Status reports are the channel the control plane acts on: an ack claims an assignment, a complete finishes it. The mux sends them in a fixed order:

run_id, assignment_id, status_sequence, action (ack, progress, complete),
created time, outbox_id

Before a status report enters the buffer, the mux stages it with the status ack runtime, which gives it its status_sequence and a dedupe key. A report the status ack runtime declines, such as a duplicate, is dropped there. When the control plane accepts a report, the mux marks its dedupe key acknowledged and raises the acknowledgement watermark the outbox compacts to. When the status ack runtime reports its backlog as degraded, the status channel enters a failover window. See Status ack runtime.

A status report the control plane refuses outright, with HTTP 400, 404 or 409, is marked acknowledged and not retried. A 409 is typically a report for an assignment whose lease has expired and been claimed elsewhere; retrying it would hold every newer report behind it. A malformed report, missing its action, assignment_id, run_id or node_id, is dropped the same way.

The mux profile

The control plane sets the mux's profile per workspace, served at /v1/dataplane/logs/mux-profile/<workspace_uuid>. The node refreshes it every 15 seconds by default, using the workspace of a record in its buffers:

Field Default Governs
enabled_modes stream, batch, failover The modes the mux may select
require_envelope_id_modes failover Modes whose records must carry an envelope identifier
max_batch_records 5000 Spooled records replayed per flush
max_stream_lines 20000 The stream mode's record limit
max_buffer_records The larger of the two limits Each channel's buffer bound
retry_after_seconds 2 A failover window's length after an unclassified failure
payload_transport object_store Where bodies go

payload_transport always resolves to the node's observability bucket: the node sets it from its bootstrap-managed bucket on every refresh, and the refresh fails when the node has no such bucket. A refresh that fails keeps the current profile and records the error.

The mux reports its state in the heartbeat as xratud.telemetry_mux_profile_state.v1: the profile, the last refresh time and the last refresh error. See Cycle summary and heartbeat projection.