Skip to main content

Crate tracing_broadcast

Crate tracing_broadcast 

Source
Expand description

BroadcastTracingLayer — a tracing_subscriber::Layer that fans every emitted tracing::Event into a tokio::sync::broadcast channel as a TracingFrame (timestamp / level / target / message / structured fields).

The layer composes alongside the host’s normal subscriber stack (tracing_subscriber::fmt::Layer writing to stderr is unaffected); it adds one more sink without changing user-visible logging. Each subscriber gets its own broadcast::Receiver with independent backlog tracking; slow subscribers see RecvError::Lagged(n) and resume from the next available frame, which the operator-facing transport can surface as a sentinel.

TracingFrame derives serde::Serialize / Deserialize, so the transport (NDJSON, websocket text frames, JSON-RPC, …) is just serde_json::to_string(&frame).

Structs§

BroadcastTracingLayer
Tracing layer that broadcasts each event as a TracingFrame.
TracingFrame
Wire shape for a single tracing event.

Constants§

DEFAULT_BROADCAST_CAP
Default broadcast channel capacity for tracing frames. Tracing events are lower-volume than flow logs (one per log line vs one per per-step trajectory), so the channel is sized smaller — spec/flow-model.md § Flow log verbosity owns the per-stream sizing rationale. Override via VANE_TRACE_BROADCAST_CAP.
ENV_BROADCAST_CAP
Env var that overrides DEFAULT_BROADCAST_CAP at construction time. Values that fail to parse or evaluate to 0 fall back to the default — same shape as the rest of the daemon’s VANE_* knobs.