Skip to main content

Module obs

Module obs 

Source
Expand description

Structured observability / audit spine (tracing feature, default-off).

RLX’s diagnostics are ~2600 ad-hoc eprintln!/println! sites: unstructured and impossible to feed into an audit trail. This module is the typed, opt-in alternative — a thin facade over the tracing crate that emits STRUCTURED events with a stable name plus a metadata detail. It is the foundation for the audit-logging a HIPAA/FDA validated pipeline needs (per-inference records: model + weight hash, engine version, device, shapes, timing).

§PHI-safety invariant (load-bearing)

Events carry METADATA ONLY — ids, content hashes, shapes, dtypes, op kinds, counts, timings. NEVER pass tensor contents, input values, decoded text, or raw file paths that could embed PHI. Reference data by a content hash, never the data itself. A leaked value in a log is a reportable breach, so the facade deliberately takes a formatted detail the caller controls rather than slurping arbitrary state.

§Zero-overhead default

Without the tracing feature every entry point compiles to a no-op (the optimizer removes the call), exactly like crate::kernel_trace. Turn on --features tracing to get structured logs; a downstream product installs its own tracing subscriber to route events to an append-only audit sink.

ⓘ
rlx_runtime::obs::event("inference", format_args!(
    "model={model_id} weight_sha={weight_sha} engine={engine} device={dev}"
));

This is a foundation: one representative call site (maybe_log_fusion) is wired through it. Migrating the remaining diagnostics off eprintln! is tracked follow-up — each converted site becomes audit-visible for free.

Functions§

event
No-op without the tracing feature.
init
No-op without the tracing feature.