Skip to main content

tracing_cache/
lib.rs

1//! In-memory `tracing::Subscriber` that holds spans and events for
2//! inspection by a console UI.
3//!
4//! Open spans live in a sharded slab; closed spans flow through a
5//! lock-free spillway channel into a background [`Driver`] that
6//! commits them to a shared `BTreeMap`.  Filtering is pluggable via
7//! [`EnabledPredicate`]; the default [`LevelPredicate`] enables
8//! everything at or below a given level.
9
10// Workspace lints deny `unwrap_used` / `expect_used` /
11// `panic_in_result_fn` in production code.  Tests get
12// them back.
13#![cfg_attr(
14    test,
15    allow(clippy::unwrap_used, clippy::expect_used, clippy::panic_in_result_fn,)
16)]
17
18mod cache;
19mod config;
20mod driver;
21mod id_encoding;
22mod object_pool;
23mod predicate;
24mod record;
25mod thread_state;
26
27#[cfg(test)]
28mod tests;
29
30pub use cache::SpanCache;
31pub use config::{CacheConfig, DEFAULT_LANE_COUNT};
32pub use driver::Driver;
33// `Pool` and `ObjectPool` are crate-private — only `ReuseRef`
34// (visible on `SpanRecord.events`) and its `Resettable` bound
35// remain on the public surface.
36pub use object_pool::{Resettable, ReuseRef};
37pub use predicate::{
38    ChanceHandle, ChancePredicate, EnabledPredicate, Interest, LevelHandle, LevelPredicate,
39};
40pub use record::{EventRecord, FieldList, FieldValue, SpanRecord};