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
//! Span helpers that pull connection / transaction / tenant / auth
//! context out of the runtime thread-locals and attach them to a
//! `tracing::Span`. Any log emitted while the span is entered picks
//! up these fields automatically — the caller never has to pass
//! `conn_id` / `xid` / `tenant` as parameters down through the call
//! graph.
//!
//! Usage:
//! ```ignore
//! use reddb::telemetry::span;
//! let _g = span::query_span(query).entered();
//! // subsequent tracing::info!/warn!/error! carry conn_id+xid+tenant
//! ```
use Span;
use crate;
/// Span wrapping a single `execute_query` call. Stamps the current
/// connection id, transaction xid (0 when autocommit), tenant, and
/// authenticated user so every downstream event (filter eval, scan,
/// CDC emit, error) inherits correlation context.
///
/// Keep the string cheap — we only store the length, not the query
/// body, to avoid PII leakage into logs.
/// Span for a new wire/gRPC/HTTP connection. Call at accept time so
/// every log inside that connection's lifetime carries the remote
/// peer and transport kind.
/// Span for a listener bind — emits once at startup to mark the
/// transport as ready.