1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Phase 12E.7: structured tracing spans.
//!
//! # PURPOSE
//!
//! A single crate-visible macro that emits a `tracing` span (with
//! attributes) on the externally important operations — engine
//! put/get/range/sync/compact, store open/create, the durability
//! barrier, epoch checkpoints, GC, the optimizer — and compiles to
//! nothing when the `tracing` feature is off (the base embeddable
//! build).
//!
//! # ATTRIBUTE DISCIPLINE
//!
//! - Never log user payload bytes (the prompt's hard rule).
//! - Content ids are logged TRUNCATED (first 8 hex chars) unless a
//! caller has a stronger need and documents it.
//! - Attributes are cheap primitives (u64, &'static str, small strings).
//! - No subscriber is bundled: embedders attach their own
//! `tracing_subscriber`/collector; without one the spans are no-ops
//! (tracing's macro cost when disabled is a handful of nanoseconds on
//! per-REQUEST operations — never on per-chunk hot loops).
//!
//! # CONCURRENCY / PERFORMANCE
//!
//! Spans are per-call-site thread-local (tracing's registry); the guard
//! lives until the end of the enclosing scope, so a span covers the
//! operation's duration. The macro is a no-op expansion with the feature
//! off: zero symbols, zero runtime cost.
/// Emit a span for the rest of the enclosing scope, with attributes.
///
/// ```rust,ignore
/// crate::perf::trace::span!("engine.put_blob", op = "put_blob", len = n, id = hex);
/// ```
/// Feature-off expansion: nothing.
pub use span;