Expand description
Wire contracts for the local logging and telemetry service.
The agent records logs from every process, telemetry history, discrete events, and hardware samples into one durable local store. This module carries the shared types that travel between the producers (Rust services, the Python agent) and the writer, plus the request/response envelope the read API and its clients share.
All ingest frames are msgpack with short field-rename keys and a v version
byte, so a producer and a writer on different versions stay forward
compatible: a reader that sees an unknown v can skip the frame, and new
fields ride in the open fields/tags/extra maps without a schema
change. The frames travel over the same 4-byte big-endian length framing the
other sockets use (crate::frame); this module reuses that codec and does
not duplicate it.
Redaction (redact) replaces any field whose key looks secret-bearing
with its length only. It
mirrors the agent’s structured-logging redaction so no value is ever written
to the store in the clear, regardless of which producer emitted it.
Modules§
- emitter
- The reusable event emitter that ships discrete
EventFramerecords from a service to the ingest socket. Unlike the loglayer, events are a first-class capture path, so this module is always available (not gated ontracing-layer). A reusable, non-blocking emitter that ships discreteEventFramerecords from any Rust service to the logging daemon’s ingest socket.
Structs§
- ApiError
- The error body returned for a failed request.
- Error
Envelope - The error envelope:
{ "error": { "code", "message" } }. - Event
Frame - One discrete event: a state transition, a radio lock change, a sidecar drop,
a pairing change, a transport error.
kindis a dotted classifier. - HwSnapshot
- A periodic hardware sample: temperatures, per-core frequency, power rails,
pressure-stall, per-iface counters, USB speed, throttle flags. Every reading
rides in the open
smap so a new signal does not need a schema bump. - LogFrame
- One log record from any producer (Rust service, Python agent, subprocess
tap). The
srcis the emitting process or component;tgtis the module or logger target. Structured fields ride in the openfmap. - Meta
- Response metadata: which plane served it, the envelope version, the server time, and how far the writer is behind real time.
- Page
- Pagination block: the cursor for the next page and the count in this page.
- Query
Request - A read request against the query API. All fields are optional; an empty request returns the most recent page.
- Query
Response - The success envelope shared by every read endpoint.
datais the typed payload (rows, buckets, sessions, stats),pagecarries pagination,metacarries serving metadata. - Sync
Request - The window selector a mark-synced request carries. An exported window is
flipped from unsynced to synced over exactly this selector, so it shares the
vocabulary of the export filter: an optional session, a half-open
[from_us, to_us)microsecond window, and an optional table list. An emptytablesmeans all four. All fields absent marks every unsynced row. - Sync
Response - The result of a mark-synced request: the count flipped per requested table, and the remaining unsynced count per table after the flip (always all four, so a caller sees the whole store’s pending-push watermark in one response).
- Telemetry
Frame - One telemetry sample: a single dotted metric key with a numeric value and an open tags map. Replaces the per-field history arrays sampled in the GCS.
Enums§
- Ingest
Frame - The kind tag on an ingest frame, so the writer can dispatch one stream of mixed frames to the right table.
- Level
- Severity levels, matching the integer encoding stored in the log table.
Trace/Debugare the high-volume levels dropped first under backpressure;Warnand above are always kept. - Logd
Error - Errors raised encoding or decoding an ingest frame.
- Sync
Table - One of the four durable tables a window export and its mark-synced selector
can name. Serializes to its lowercase table name so the wire vocabulary
matches the
kindquery parameter the read API already speaks. - Value
- The msgpack value type carried in the open field/detail/tag maps. Re-exported
so a downstream producer can build an
EventFramedetail without taking a direct dependency onrmpv. Represents any valid MessagePack value.
Constants§
- ENVELOPE_
VERSION - The current read-envelope version reported in
Meta::v. - LOGD_
MAX_ FRAME - Maximum ingest frame payload. Log records and hardware snapshots are small; the cap is generous headroom and guards against a runaway producer.
- REDACT_
PREFIX - Idempotency sentinel: a value already prefixed with this has been redacted and is passed through unchanged.
- SECRET_
SUFFIXES - Key suffixes (and exact keys, case-insensitive) that mark a field as secret-bearing. Kept in lockstep with the agent’s logging redaction.
- WIRE_
VERSION - The current wire version stamped on every ingest frame.
Functions§
- is_
secret_ key - True when
keymarks a secret-bearing field: a case-insensitive match where the lower-cased key ends with, or exactly equals, one ofSECRET_SUFFIXES. - redact
- Redact one string value for the given key.
- redact_
map - Redact every secret-bearing string field of an open map in place. Non-string
values, empty strings, and already-redacted values are left untouched.
Returns
trueif at least one field value was changed.
Type Aliases§
- Fields
- An open msgpack map of extra fields. Values are arbitrary so new telemetry round-trips without a schema change (mirrors the open-state pattern).