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
52
53
54
55
56
57
//! Standalone distributed tracing for fast-telemetry.
//!
//! Provides lightweight span creation, parent-child nesting, and collection
//! without the OpenTelemetry SDK dependency. Spans are buffered in thread-local
//! Vecs (zero atomics on the push path) and exported as OTLP protobuf.
//!
//! # Usage
//!
//! ```ignore
//! use std::sync::Arc;
//! use fast_telemetry::{SpanCollector, SpanKind};
//!
//! let collector = Arc::new(SpanCollector::new(8, 1024));
//!
//! // Root span (new trace).
//! let mut root = collector.start_span("handle_request", SpanKind::Server);
//! root.enter(); // set thread-local for logging
//! root.set_attribute("http.method", "GET");
//!
//! // Child span (inherits trace_id from &root).
//! {
//! let mut child = root.child("db_query", SpanKind::Client);
//! child.set_attribute("db.statement", "SELECT ...");
//! // child submitted to collector on drop
//! }
//!
//! // For outgoing HTTP requests.
//! let traceparent = root.traceparent();
//!
//! // Logging correlation on the same thread.
//! let trace_id = fast_telemetry::current_trace_id();
//! let span_id = fast_telemetry::current_span_id();
//!
//! // Exporter drains periodically.
//! let mut buf = Vec::new();
//! collector.flush_local();
//! collector.drain_into(&mut buf);
//! ```
//!
//! Call [`SpanCollector::flush_local`] before [`SpanCollector::drain_into`] when
//! draining on the same thread that just recorded spans. `SpanCollector::new`
//! keeps its historical `(shards, capacity)` signature for compatibility, but
//! those parameters are currently ignored because buffers are managed per thread.
//!
//! For manual cross-service propagation, use
//! [`SpanCollector::start_span_from_traceparent`] on inbound requests and
//! [`Span::traceparent`](super::Span::traceparent) for outbound headers.
pub
pub use SpanCollector;
pub use ;
pub use ;
pub use ;