Expand description
Runtime engine for the obs SDK — the spine that user code emits into.
Phase-3 surface (specs/91-impl-plan.md tasks 3.1–3.15):
callsite—ObsCallsite, atomic-Interestcache (spec 11 § 2).observer— three-tier resolution + per-tier worker pool +StandardObserver(spec 11 §§ 3, 4 + 6.4).registry— schema registry +ScrubbedEnvelope(spec 14).envelope— envelope builder + projection helpers (spec 11 § 5).scope—obs::scope!/obs::context!runtime support (spec 13 §§ 2, 3, 6).instrumented—Instrumented<F>future adapter andInstrument/WithObservertraits (spec 13 § 3).sampling— head sampler (spec 13 § 6).filter— EnvFilter-shapedobs::Filter(spec 13 § 7).audit_spool— AUDIT-tier disk spool (spec 11 § 6.4).panic_hook—install_panic_hook(spec 11 § 6.1).span_trace—obs::SpanTrace(spec 13 § 9).sink— sink trait + writers (spec 20).
Re-exports§
pub use callsite::ObsCallsite;pub use codegen_helpers::BuildableTo;pub use codegen_helpers::EnumCount;pub use codegen_helpers::FieldCapture;pub use codegen_helpers::SpanCtx;pub use codegen_helpers::SpanFrame;pub use config::EventsConfig;pub use config::SamplingConfig;pub use config_watcher::ConfigWatcher;pub use config_watcher::DEFAULT_DEBOUNCE;pub use emit::Emit;pub use envelope::Envelope;pub use envelope::EventSchema;pub use envelope::FieldMeta;pub use envelope::FieldRole;pub use filter::Filter;pub use instrumented::Instrument;pub use instrumented::Instrumented;pub use instrumented::WithObserver;pub use metric::MetricEmitter;pub use metric::NoopMetricEmitter;pub use observer::BuildError;pub use observer::InMemoryHandle;pub use observer::InMemoryObserver;pub use observer::NoopObserver;pub use observer::Observer;pub use observer::StandardObserver;pub use observer::StandardObserverBuilder;pub use observer::ThreadObserverGuard;pub use observer::WeakObserver;pub use observer::WorkerCounters;pub use observer::install_observer;pub use observer::install_observer_arc;pub use observer::observer;pub use observer::observer_weak;pub use observer::with_observer_task;pub use observer::with_observer_task_sync;pub use observer::with_observer_thread_local;pub use observer::with_test_observer;pub use panic_hook::install_panic_hook;pub use propagator::ObsTraceCtx;pub use propagator::W3cPropagator;pub use propagator::extract_w3c;pub use propagator::fresh_span_id;pub use propagator::fresh_trace_id;pub use propagator::inject_w3c;pub use propagator::status_class;pub use registry::ArrowEventSchema;pub use registry::ArrowField;pub use registry::ArrowLeafType;pub use registry::ArrowSchemaModel;pub use registry::ArrowStructBuilder;pub use registry::CallsiteRecord;pub use registry::CallsiteSource;pub use registry::DecodeError;pub use registry::ENVELOPE_COLUMNS;pub use registry::EVENT_SCHEMAS;pub use registry::EventSchemaErased;pub use registry::ObsCallsiteRegistry;pub use registry::OtelAttributeView;pub use registry::OtlpValue;pub use registry::SchemaRegistry;pub use registry::ScrubError;pub use registry::ScrubbedEnvelope;pub use registry::callsite_id;pub use registry::render_payload_json;pub use registry::scrub_payload;pub use resource::ResourceAttrs;pub use sampling::SamplingDecision;pub use sampling::decide as sample_decide;pub use scope::ScopeField;pub use scope::ScopeFrame;pub use scope::ScopeFrameBuilder;pub use scope::ScopeGuard;pub use scope::ScopeKind;pub use sink::FanOutSink;pub use sink::FormatterStyle;pub use sink::InMemorySink;pub use sink::LevelSplitWriter;pub use sink::MakeWriter;pub use sink::NdjsonFileSink;pub use sink::NonBlockingWriter;pub use sink::NoopSink;pub use sink::RollingFileWriter;pub use sink::RollingFileWriterBuilder;pub use sink::RollingPolicy;pub use sink::Sink;pub use sink::StderrWriter;pub use sink::StdoutSink;pub use sink::StdoutWriter;pub use sink::TeeWriter;pub use sink::WorkerGuard;pub use span_trace::SpanTrace;
Modules§
- audit_
spool - AUDIT spool — binary length-prefixed envelope file with CRC32C tail integrity. Spec 11 § 6.4.
- callsite
ObsCallsiteand the atomicInterestcache.- codegen_
helpers - Auxiliary trait surface — the small set of cross-cutting traits the codegen and the bridge use to talk to the runtime without dragging the whole event type into every consumer. Spec 12 § 3.6.
- config
EventsConfig— runtime-tunable configuration loaded fromobs.yamland exposed viaArcSwapfor live reload. Spec 15 + spec 93 P0-9.- config_
watcher notify-driven file watcher forobs.yamlreload. Spec 15 § 5.3 / spec 93 P0-9.- emit
Emitblanket trait — provides.emit()/.emit_at(sev)on every type that implementsEventSchema.- envelope
- Envelope construction and projection helpers.
- filter
obs::Filter— EnvFilter-shaped DSL ported fromtracing-subscriber::filter::env.- forensic
- Per-callsite rate limiter used by the
obs::forensic!macro. - instrumented
Instrumented<F>— async scope + observer adapter.- metric
MetricEmitter— visitor implemented by metric sinks. Spec 12 § 3.6.- observer
- Three-tier observer resolution + the
Observertrait. - panic_
hook install_panic_hook— emits oneObsPanickedevent then callsObserver::shutdown_blocking(2s)so the inflight sinks have a chance to flush before the prior hook (potentiallypanic = abort) takes the process down.- propagator
- W3C Trace Context propagation. Spec 20 § 2.6 / spec 40 § 1.
- registry
- Schema registry —
EventSchemaErasedobject-safe trait, thelinkme-collectedEVENT_SCHEMASdistributed slice, the runtimeSchemaRegistry, and theScrubbedEnvelopeworker→sink handoff. - resource
ResourceAttrs— workspace-shared resource attribute set held by the observer. Spec 20 § 2.1 / spec 94 § 2.7 / P1-E.- sampling
- Head sampler — per
(full_name, sev)rate decision. - scope
obs::scope!andobs::context!runtime support — task-local / thread-local stacks ofScopeFrames, the tail-on-error ring buffer, and the auto-fill machinery used byEventSchema::project.- self_
events_ public - Public re-exports for self-event helpers consumed by sinks/middleware
that emit them on behalf of the runtime (e.g. OTLP trace sink emits
ObsSpanPairOrphanedafter pair_timeout). Spec 93 P1-2 + P1-7. - sink
- Sinks consume
ScrubbedEnvelopeand ship it to a destination (stdout, NDJSON file, OTLP, ClickHouse, etc.). - span_
trace obs::SpanTrace— capture the active scope/span ancestry for attaching to error types.- wire
- Wire-format helpers for obs.
Structs§
Enums§
Constants§
- ENVELOPE_
FORMAT_ VER - Wire-format version of the
ObsEnvelope/ObsBatchshape.
Functions§
- cap_
external_ string - Cap an external string at
max_bytes(UTF-8-safe boundary), append the…<truncated:N>suffix when the input was clipped, and emit oneObsLabelOversizedself-event for telemetry. Returns the (possibly truncated) string. Spec 95 § 3.10 / P2-AH. - now_ns
- Wall-clock timestamp in nanoseconds since the Unix epoch, saturated
at
u64::MAX. - self_
event - Build a labels-only self-event envelope with
sampling_reason = SAMPLING_REASON_RUNTIMEand the current wall-clockts_ns.