Skip to main content

dial9_core/
lib.rs

1//! dial9 recording core: the event bus, recorder, and trace writer.
2
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![warn(unreachable_pub)]
5
6/// Declares an item `pub` under the `test-util` feature and `pub(crate)`
7/// otherwise. Lets sibling-crate tests reach internals (batches, the collector,
8/// raw encode/drain helpers) without putting them on the production public API.
9macro_rules! test_util_pub {
10    ($(#[$attr:meta])* $kw:ident $name:ident $($rest:tt)*) => {
11        #[cfg(feature = "test-util")]
12        $(#[$attr])* pub $kw $name $($rest)*
13        // Without the feature these are crate-internal and only the test-util
14        // consumers reference them, so dead-code analysis would flag them.
15        #[cfg(not(feature = "test-util"))]
16        $(#[$attr])* #[allow(dead_code)] pub(crate) $kw $name $($rest)*
17    };
18}
19pub(crate) use test_util_pub;
20
21/// Shared boot identifier (`{4-alpha}-{pid}`) for segment namespacing + S3 keys.
22#[doc(hidden)]
23pub mod boot_id;
24/// Rotating trace-segment buffers: the on-disk and in-memory sinks.
25pub mod buffer;
26/// Monotonic/realtime clock readings, the trace time base.
27pub mod clock;
28/// Central ring buffer of encoded event batches awaiting write.
29pub mod collector;
30/// User-provided custom events.
31pub mod custom_events;
32/// On-demand pipeline runs: trigger, request channel, and dump receipts.
33#[cfg(feature = "pipeline")]
34pub mod dump;
35/// Thread-local event encoding buffers and the `Encodable` trait.
36pub mod encoder;
37/// Flush-thread loop. Driven by `Recorder`; not public API.
38pub(crate) mod flush_loop;
39/// Wire-format events emitted by the bus itself.
40pub mod format;
41/// Writer↔worker filesystem/channel abstraction for trace segments.
42pub(crate) mod fs;
43/// Cloneable handle for recording events and controlling telemetry.
44pub mod handle;
45/// Operational metrics for the core flush path.
46pub(crate) mod metrics;
47/// Segment payload buffer. `Payload` is part of the public API via [`pipeline`].
48#[cfg(feature = "pipeline")]
49pub(crate) mod payload;
50/// `SegmentProcessor` trait and the data threaded through the pipeline.
51#[cfg(feature = "pipeline")]
52pub mod pipeline;
53/// Cfg-gated concurrency primitives (std / shuttle).
54///
55/// `pub` so sibling crates share one shuttle shim, but not part of the public
56/// API.
57#[doc(hidden)]
58pub mod primitives;
59/// Per-call-site rate limiting for log lines.
60#[doc(hidden)]
61pub mod rate_limit;
62/// The recorder builder.
63pub mod recorder;
64/// The live recorder: recording state with RAII shutdown.
65pub mod recording;
66/// Geometric/Poisson sampling primitives (RNG, exponential draws).
67#[doc(hidden)]
68pub mod sampling;
69/// Dial9 conventions layered on top of trace schema annotations.
70pub mod schema_extensions;
71/// Sealed-segment detection. The segment types are public via [`pipeline`].
72pub(crate) mod sealed;
73test_util_pub! {
74    /// Runtime-agnostic recording state shared across threads.
75    mod shared_state;
76}
77/// `Source` trait: pluggable flush-thread data sources.
78pub mod source;
79/// Test-only record/drain/write helpers.
80#[cfg(feature = "test-util")]
81pub mod test_util;
82/// Thread identity helpers.
83pub mod thread;
84/// Segment-processing worker: runs a `SegmentProcessor` pipeline over sealed segments.
85#[cfg(feature = "pipeline")]
86pub mod worker;
87
88#[cfg(all(test, shuttle))]
89mod pipeline_shuttle_tests;